[infra] Add Windows support to test.dart.
Change-Id: I1070b630f14a7a0b00d828f0fae47ec80d09d292
Reviewed-on: https://dart-review.googlesource.com/c/90464
Reviewed-by: Johnni Winther <johnniwinther@google.com>
diff --git a/tools/test.dart b/tools/test.dart
index cd956ef..79c9793 100755
--- a/tools/test.dart
+++ b/tools/test.dart
@@ -48,9 +48,10 @@
}
/// Runs a process and exits likewise if the process exits non-zero.
-Future<ProcessResult> runProcess(
- String executable, List<String> arguments) async {
- final processResult = await Process.run(executable, arguments);
+Future<ProcessResult> runProcess(String executable, List<String> arguments,
+ {bool runInShell = false}) async {
+ final processResult =
+ await Process.run(executable, arguments, runInShell: runInShell);
if (processResult.exitCode != 0) {
final command =
([executable]..addAll(arguments)).map(simpleShellSingleQuote).join(" ");
@@ -63,9 +64,10 @@
/// Runs a process and exits likewise if the process exits non-zero, but let the
/// child process inherit out stdio handles.
Future<ProcessResult> runProcessInheritStdio(
- String executable, List<String> arguments) async {
+ String executable, List<String> arguments,
+ {bool runInShell = false}) async {
final process = await Process.start(executable, arguments,
- mode: ProcessStartMode.inheritStdio);
+ mode: ProcessStartMode.inheritStdio, runInShell: runInShell);
final exitCode = await process.exitCode;
final processResult = new ProcessResult(process.pid, exitCode, "", "");
if (processResult.exitCode != 0) {
@@ -138,7 +140,8 @@
return commit;
}
final arguments = ["merge-base", "$remote/$branch", "HEAD"];
- final result = await Process.run("git", arguments);
+ final result =
+ await Process.run("git", arguments, runInShell: Platform.isWindows);
if (result.exitCode != 0) {
throw new Exception("Failed to run: git ${arguments.join(' ')}\n"
"stdout:\n${result.stdout}\n"
@@ -273,7 +276,9 @@
print("".padLeft(80, "="));
print("$stepName: Running tests");
print("".padLeft(80, "="));
- await runProcessInheritStdio("tools/test.py", fullArguments);
+ await runProcessInheritStdio(
+ "python", ["tools/test.py"]..addAll(fullArguments),
+ runInShell: Platform.isWindows);
stepResultsPaths.add("${stepDirectory.path}/results.json");
stepLogsPaths.add("${stepDirectory.path}/logs.json");
// Find the list of tests to deflake.
@@ -309,7 +314,9 @@
"--test-list=$deflakeListPath",
])
..addAll(options.rest);
- await runProcessInheritStdio("tools/test.py", deflakeArguments);
+ await runProcessInheritStdio(
+ "python", ["tools/test.py"]..addAll(deflakeArguments),
+ runInShell: Platform.isWindows);
deflakingResultsPaths.add("${deflakeDirectory.path}/results.json");
}
// Update the flakiness information based on what we've learned.