Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion pkgs/ffigen/test/test_utils.dart
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ String configPath(String directory, String file) =>
absPath(configPathForTest(directory, file));

/// Returns the temp directory used to store bindings generated by tests.
String tmpDir = path.join(packagePathForTests, 'test', '.temp');
String tmpDir = path.join(packagePathForTests, 'test', '.temp with spaces');

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There's already a PR in progress for the ffigen part of this: https://github.com/dart-lang/native/pull/3029/changes. This is not the only place in ffigen that creates temporary directories, so that PR has ended up being quite complicated.

How sure are you that you've found all the temp directory locations? Don't restrict your search to test directories.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the pointer, I’ll take a look at #3029 and avoid overlapping changes to ffigen there...

also do a broader search across the repo for all temp directory usages and update this PR to cover any I’ve missed.

Pardon me for late reply...
Will update as soon as possible for me...

Thank you...


/// Generates actual file using library and tests using [expect] with expected.
///
Expand Down
2 changes: 1 addition & 1 deletion pkgs/hooks/test/helpers.dart
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ Future<void> inTempDir(
String? prefix,
bool keepTemp = false,
}) async {
final tempDir = await Directory.systemTemp.createTemp(prefix);
final tempDir = await Directory.systemTemp.createTemp('${prefix ?? ''} ');
// Deal with Windows temp folder aliases.
final tempUri = Directory(
await tempDir.resolveSymbolicLinks(),
Expand Down
4 changes: 2 additions & 2 deletions pkgs/hooks_runner/test/helpers.dart
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ Future<void> inTempDir(
String? prefix,
bool keepTemp = false,
}) async {
final tempDir = await Directory.systemTemp.createTemp(prefix);
final tempDir = await Directory.systemTemp.createTemp('${prefix ?? ''} ');
// Deal with Windows temp folder aliases.
final tempUri = Directory(
await tempDir.resolveSymbolicLinks(),
Expand All @@ -58,7 +58,7 @@ Future<void> inTempDir(
}

Future<Uri> tempDirForTest({String? prefix, bool keepTemp = false}) async {
final tempDir = await Directory.systemTemp.createTemp(prefix);
final tempDir = await Directory.systemTemp.createTemp('${prefix ?? ''} ');
// Deal with Windows temp folder aliases.
final tempUri = Directory(
await tempDir.resolveSymbolicLinks(),
Expand Down
6 changes: 3 additions & 3 deletions pkgs/jnigen/test/test_util/test_util.dart
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ const largeTestTag = 'large_test';
const summarizerTestTag = 'summarizer_test';

Directory getTempDir(String prefix) {
return _currentDirectory.createTempSync(prefix);
return _currentDirectory.createTempSync('$prefix ');
}

Future<bool> isEmptyOrNotExistDir(String path) async {
Expand Down Expand Up @@ -117,7 +117,7 @@ Future<void> generateAndCompareBindings(Config config) async {
final dartReferenceBindings =
config.outputConfig.dartConfig.path.toFilePath();
final currentDir = Directory.current;
final tempDir = currentDir.createTempSync('jnigen_test_temp');
final tempDir = currentDir.createTempSync('jnigen_test_temp ');
final singleFile =
config.outputConfig.dartConfig.structure == OutputStructure.singleFile;
final tempLib = singleFile
Expand All @@ -133,7 +133,7 @@ Future<void> generateAndCompareBindings(Config config) async {

Future<void> generateAndAnalyzeBindings(Config config,
{Iterable<String> confirmExists = const []}) async {
final tempDir = Directory.current.createTempSync('jnigen_test_temp');
final tempDir = Directory.current.createTempSync('jnigen_test_temp ');
try {
await _generateTempBindings(config, tempDir);
final analyzeResult = Process.runSync('dart', ['analyze', tempDir.path]);
Expand Down
2 changes: 1 addition & 1 deletion pkgs/native_toolchain_c/test/helpers.dart
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ String testSuffix(List<Object> tags) => switch (tags) {
const keepTempKey = 'KEEP_TEMPORARY_DIRECTORIES';

Future<Uri> tempDirForTest({String? prefix, bool keepTemp = false}) async {
final tempDir = await Directory.systemTemp.createTemp(prefix);
final tempDir = await Directory.systemTemp.createTemp('${prefix ?? ''} ');
// Deal with Windows temp folder aliases.
final tempUri = Directory(
await tempDir.resolveSymbolicLinks(),
Expand Down
2 changes: 1 addition & 1 deletion pkgs/swiftgen/test/integration/util.dart
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ class TestGenerator {
TestGenerator(this.name)
: isObjCCompatible = objCCompatibleTests.contains(name) {
testDir = path.absolute(path.join(pkgDir, 'test/integration'));
tempDir = path.join(testDir, 'temp');
tempDir = path.join(testDir, 'temp with spaces');
inputFile = path.join(testDir, '$name.swift');
wrapperFile = path.join(tempDir, '${name}_wrapper.swift');
outputFile = path.join(tempDir, '${name}_output.dart');
Expand Down
Loading