More fix for #1094: LibTest/io/Process tests updated to check process exit code correctly, new test added.
diff --git a/LibTest/io/Process/run_A01_t01.dart b/LibTest/io/Process/run_A01_t01.dart
index 3285107..d557e6b 100644
--- a/LibTest/io/Process/run_A01_t01.dart
+++ b/LibTest/io/Process/run_A01_t01.dart
@@ -20,8 +20,8 @@
/// Returns a Future<ProcessResult> that completes with the result of running
/// the process, i.e., exit code, standard out and standard in.
///
-/// @description Checks that static method [run] starts a process and runs it
-/// non-interactively to completion. Returns a Future<ProcessResult> that
+/// @description Checks that static method [run] starts a process, runs it
+/// non-interactively to completion and returns a Future<ProcessResult> that
/// completes with the result of running the process, i.e., exit code, standard
/// out and standard in.
/// @author ngl@unipro.ru
diff --git a/LibTest/io/Process/run_A01_t02.dart b/LibTest/io/Process/run_A01_t02.dart
index 7158cf5..572889a 100644
--- a/LibTest/io/Process/run_A01_t02.dart
+++ b/LibTest/io/Process/run_A01_t02.dart
@@ -20,10 +20,11 @@
/// Returns a Future<ProcessResult> that completes with the result of running
/// the process, i.e., exit code, standard out and standard in.
///
-/// @description Checks that static method [run] starts a process and runs it
-/// non-interactively to completion. Returns a Future<ProcessResult> that
+/// @description Checks that static method [run] starts a process, runs it
+/// non-interactively to completion and returns a Future<ProcessResult> that
/// completes with the result of running the process, i.e., exit code, standard
-/// out and standard in. Test valid file path
+/// out and standard in. Tests dart process which exits correctly with exit code
+/// 0.
/// @author sgrekhov@unipro.ru
/// @issue 31611
diff --git a/LibTest/io/Process/run_A01_t03.dart b/LibTest/io/Process/run_A01_t03.dart
index b1cfabe..1476d0f 100644
--- a/LibTest/io/Process/run_A01_t03.dart
+++ b/LibTest/io/Process/run_A01_t03.dart
@@ -20,12 +20,13 @@
/// Returns a Future<ProcessResult> that completes with the result of running
/// the process, i.e., exit code, standard out and standard in.
///
-/// @description Checks that static method [run] starts a process and runs it
-/// non-interactively to completion. Returns a Future<ProcessResult> that
+/// @description Checks that static method [run] starts a process, runs it
+/// non-interactively to completion and returns a Future<ProcessResult> that
/// completes with the result of running the process, i.e., exit code, standard
-/// out and standard in. Test that there should be an error code 64 if invalid
-/// file path is used on Windows
-/// (see https://github.com/dart-lang/sdk/issues/31611)
+/// out and standard in. Tests that there should be an error code which is not
+/// zero (not success)and not 255 (not a runtime error) if invalid file path is
+/// used - which is all we really know about the `dart` executable. Any other
+/// error should be fine.
/// @author sgrekhov@unipro.ru
/// @issue 31611
@@ -33,14 +34,13 @@
import "../../../Utils/expect.dart";
main() {
- if (Platform.isWindows) {
- String executable = Platform.resolvedExecutable;
- File file = new File.fromUri(Platform.script.resolve("not_existing.dart"));
- asyncStart();
- Process.run(executable, [file.path]).then((ProcessResult results) {
- Expect.equals(64, results.exitCode);
- Expect.notEquals("", results.stderr);
- asyncEnd();
- });
- }
+ String executable = Platform.resolvedExecutable;
+ File file = new File.fromUri(Platform.script.resolve("not_existing.dart"));
+ asyncStart();
+ Process.run(executable, [file.path]).then((ProcessResult results) {
+ Expect.notEquals(0, results.exitCode);
+ Expect.notEquals(255, results.exitCode);
+ Expect.notEquals("", results.stderr);
+ asyncEnd();
+ });
}
diff --git a/LibTest/io/Process/run_A01_t04.dart b/LibTest/io/Process/run_A01_t04.dart
new file mode 100644
index 0000000..b18de3b
--- /dev/null
+++ b/LibTest/io/Process/run_A01_t04.dart
@@ -0,0 +1,59 @@
+// Copyright (c) 2017, the Dart project authors. Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+
+/// @assertion
+/// Future<ProcessResult> run(
+/// String executable,
+/// List<String> arguments, {
+/// String workingDirectory,
+/// Map<String, String> environment,
+/// bool includeParentEnvironment: true,
+/// bool runInShell: false,
+/// Encoding stdoutEncoding: systemEncoding,
+/// Encoding stderrEncoding: systemEncoding
+/// })
+///
+/// Starts a process and runs it non-interactively to completion. The process
+/// run is executable with the specified arguments.
+/// ...
+/// Returns a Future<ProcessResult> that completes with the result of running
+/// the process, i.e., exit code, standard out and standard in.
+///
+/// @description Checks that static method [run] starts a process, runs it
+/// non-interactively to completion and returns a Future<ProcessResult> that
+/// completes with the result of running the process, i.e., exit code, standard
+/// out and standard in. Tests dart process which exits correctly with exit code
+/// 16.
+/// @author sgrekhov@unipro.ru
+/// @issue 31611
+
+import "dart:io";
+import "../../../Utils/expect.dart";
+
+runMain() {
+ String executable = Platform.resolvedExecutable;
+ String eScript = Platform.script.toString();
+
+ asyncStart();
+ Process.run(executable, [...Platform.executableArguments, eScript, "run"])
+ .then((ProcessResult results) {
+ Expect.equals(16, results.exitCode);
+ Expect.equals("Lily was here", results.stdout);
+ Expect.equals("", results.stderr);
+ asyncEnd();
+ });
+}
+
+runProcess() {
+ stdout.write("Lily was here");
+ exit(16);
+}
+
+main(List<String> args) {
+ if (args.length > 0)
+ runProcess();
+ else {
+ runMain();
+ }
+}