mirror of
https://github.com/dart-lang/sdk
synced 2024-11-05 18:22:09 +00:00
[tests/ffi] Folder deletion on Windows
On windows we do have a crashpad handler we use to capture coredumps. This functionality is initialized in `runtime/bin/main_impl.cc` / `runtime/bin/crashpad.cc`. That may start a subprocess. If that subprocess has the tempdir as working directory (or inherit handles referring to it / subdirs/subfiles) it may prevent it from being deleted. Adding '--suppress-core-dump' to the Dart process invocations prevents this. TEST=ffi/native_assets/infer_native_assets_yaml_dart_kernel_snapshot TEST=ffi/native_assets/infer_native_assets_yaml_process_run Closes: https://github.com/dart-lang/sdk/issues/51067 Change-Id: I75807e65e9911653983158a238194968aaedb51f Cq-Include-Trybots: luci.dart.try:vm-kernel-nnbd-win-debug-x64-try,vm-kernel-nnbd-win-release-ia32-try,vm-kernel-nnbd-win-release-x64-try,vm-kernel-precomp-nnbd-win-release-x64-try Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/279399 Commit-Queue: Daco Harkes <dacoharkes@google.com> Reviewed-by: Martin Kustermann <kustermann@google.com>
This commit is contained in:
parent
899d9074a8
commit
90668fba0c
3 changed files with 18 additions and 13 deletions
|
@ -4,3 +4,7 @@ analyzer:
|
|||
|
||||
enable-experiment:
|
||||
- records # TODO(http://dartbug.com/50586): Remove this when records are no longer an experiment.
|
||||
|
||||
linter:
|
||||
rules:
|
||||
- unawaited_futures
|
||||
|
|
|
@ -59,7 +59,7 @@ Future<void> selfInvokes() async {
|
|||
}
|
||||
|
||||
Future<void> runTests() async {
|
||||
testExecutable();
|
||||
await testExecutable();
|
||||
testNonExistingFunction();
|
||||
}
|
||||
|
||||
|
|
|
@ -72,13 +72,13 @@ Future<void> withTempDir(
|
|||
Future<void> fun(Uri tempUri), {
|
||||
String prefix = 'tests_ffi_native_assets_',
|
||||
}) async {
|
||||
final tempDir = Directory.systemTemp.createTempSync(prefix);
|
||||
final tempDir = await Directory.systemTemp.createTemp(prefix);
|
||||
try {
|
||||
await fun(tempDir.uri);
|
||||
} finally {
|
||||
if (!Platform.environment.containsKey(keepTempKey) ||
|
||||
Platform.environment[keepTempKey]!.isEmpty) {
|
||||
tempDir.deleteSync(recursive: true);
|
||||
await tempDir.delete(recursive: true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -123,7 +123,7 @@ Future<void> runGenKernel({
|
|||
required Uri outputUri,
|
||||
Uri? inputUri,
|
||||
Uri? nativeAssetsUri,
|
||||
}) async =>
|
||||
}) =>
|
||||
runProcess(
|
||||
executable: genKernelUri.toFilePath(),
|
||||
arguments: [
|
||||
|
@ -148,14 +148,13 @@ Future<void> createDillFile({
|
|||
required Uri dartProgramUri,
|
||||
required Uri nativeAssetsUri,
|
||||
required Runtime runtime,
|
||||
}) async {
|
||||
await runGenKernel(
|
||||
runtime: runtime,
|
||||
outputUri: outputUri,
|
||||
inputUri: dartProgramUri,
|
||||
nativeAssetsUri: nativeAssetsUri,
|
||||
);
|
||||
}
|
||||
}) =>
|
||||
runGenKernel(
|
||||
runtime: runtime,
|
||||
outputUri: outputUri,
|
||||
inputUri: dartProgramUri,
|
||||
nativeAssetsUri: nativeAssetsUri,
|
||||
);
|
||||
|
||||
Future<void> runGenSnapshot({
|
||||
required Uri dillUri,
|
||||
|
@ -180,6 +179,8 @@ Future<void> runDart({
|
|||
runProcess(
|
||||
executable: dartUri.toFilePath(),
|
||||
arguments: [
|
||||
// Prevent subprocesses holding on to [workingDirectory] on Windows.
|
||||
'--suppress-core-dump',
|
||||
...toolArgs,
|
||||
if (packageConfigUri != null)
|
||||
'--packages=${packageConfigUri.toFilePath()}',
|
||||
|
@ -194,7 +195,7 @@ Future<void> runDartKernelSnapshot({
|
|||
required Uri inputUri,
|
||||
Uri? packageConfigUri,
|
||||
Uri? workingDirectory,
|
||||
}) async =>
|
||||
}) =>
|
||||
runDart(
|
||||
workingDirectory: workingDirectory,
|
||||
toolArgs: [
|
||||
|
|
Loading…
Reference in a new issue