Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(568)

Unified Diff: tests/standalone/io/process_start_exception_test.dart

Issue 2639043003: Gardening: Fix standalone/io/process_start_exception_test.dart. (Closed)
Patch Set: Created 3 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tests/standalone/io/process_start_exception_test.dart
diff --git a/tests/standalone/io/process_start_exception_test.dart b/tests/standalone/io/process_start_exception_test.dart
index 2c30400882ce4eaad02304452e4f737da6686358..2bf38cc95f1498d92d7410c30b2df820dee38eab 100644
--- a/tests/standalone/io/process_start_exception_test.dart
+++ b/tests/standalone/io/process_start_exception_test.dart
@@ -8,34 +8,24 @@ import "package:expect/expect.dart";
import 'dart:async';
import 'dart:io';
-// Constants from errno.h
+// ENOENT and ERROR_FILE_NOT_FOUND on Windows both have the same value.
+// Note: we are setting PATH to an empty string in tests below because on
+// POSIX systems if target binary name does not contain `/` then it is
+// searched through PATH and if it is not found anywhere in the PATH
+// but some folder in PATH is inaccessible then underlying execvp(...)
+// call will return EACCES (13) instead of ENOENT.
+// For example on some Android devices PATH would include /sbin with is
+// inaccessible - so this test will fail.
const ENOENT = 2;
-const EACCES = 13;
-
-// TODO(http://dartbug.com/28299) This code is added in attempt to collect more
-// information about the flakyness this test experiences on Android bots:
-// sometimes the test fails because we get EACCES instead of ENOENT error
-// from the OS.
-checkForAccessError(error) {
- if (error.errorCode == EACCES) {
- report(obj) {
- final stat = obj.statSync();
- print("${obj} | ${stat.type} | ${stat.modeString()}");
- }
-
- report(Directory.current);
- report(new File("__path_to_something_that_should_not_exist__"));
- }
-}
testStartError() {
Future<Process> processFuture =
Process.start("__path_to_something_that_should_not_exist__",
- const []);
+ const [],
+ environment: {"PATH": ""});
processFuture.then((p) => Expect.fail('got process despite start error'))
.catchError((error) {
Expect.isTrue(error is ProcessException);
- checkForAccessError(error);
Expect.equals(ENOENT, error.errorCode, error.toString());
});
}
@@ -43,12 +33,12 @@ testStartError() {
testRunError() {
Future<ProcessResult> processFuture =
Process.run("__path_to_something_that_should_not_exist__",
- const []);
+ const [],
+ environment: {"PATH": ""});
processFuture.then((result) => Expect.fail("exit handler called"))
.catchError((error) {
Expect.isTrue(error is ProcessException);
- checkForAccessError(error);
Expect.equals(ENOENT, error.errorCode, error.toString());
});
}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698