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

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

Issue 2285223003: Fix native extension lookup (Closed)
Patch Set: Update test for error message change Created 4 years, 4 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 | « runtime/bin/utils_win.cc ('k') | tests/standalone/io/test_relative_extension.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tests/standalone/io/test_extension_fail_test.dart
diff --git a/tests/standalone/io/test_extension_fail_test.dart b/tests/standalone/io/test_extension_fail_test.dart
index 3a9d0cfb40176ce498fc62d88255e60d1eb0ce66..c9893678c11a44fbdcee82dd4a37d12926c3cbf0 100644
--- a/tests/standalone/io/test_extension_fail_test.dart
+++ b/tests/standalone/io/test_extension_fail_test.dart
@@ -35,37 +35,55 @@ String getExtensionPath(String buildDirectory) {
}
}
-void main() {
+bool checkExitCode(int code) {
+ return ((code == 255) || (code == 253));
+}
+
+bool checkStdError(String err) {
+ return err.contains("Unhandled exception:") ||
+ err.contains(
+ "Native extension path must be absolute, or simply the file name");
+}
+
+// name is either "extension" or "relative_extension"
+Future test(String name, bool checkForBall) {
String scriptDirectory = dirname(Platform.script.toFilePath());
String buildDirectory = dirname(Platform.executable);
Directory tempDirectory =
- Directory.systemTemp.createTempSync('dart_test_extension_fail');
+ Directory.systemTemp.createTempSync('dart_test_${name}_fail');
String testDirectory = tempDirectory.path;
// Copy test_extension shared library, test_extension.dart and
// test_extension_fail_tester.dart to the temporary test directory.
copyFileToDirectory(getExtensionPath(buildDirectory),
testDirectory).then((_) {
- var extensionDartFile = join(scriptDirectory, 'test_extension.dart');
+ var extensionDartFile = join(scriptDirectory, 'test_${name}.dart');
return copyFileToDirectory(extensionDartFile, testDirectory);
}).then((_) {
var testExtensionTesterFile =
- join(scriptDirectory, 'test_extension_fail_tester.dart');
+ join(scriptDirectory, 'test_${name}_fail_tester.dart');
return copyFileToDirectory(testExtensionTesterFile, testDirectory);
}).then((_) {
- var script = join(testDirectory, 'test_extension_fail_tester.dart');
- return Process.run(Platform.executable, [script]);
+ var script = join(testDirectory, 'test_${name}_fail_tester.dart');
+ return Process.run(Platform.executable, ['--trace-loading', script]);
}).then((ProcessResult result) {
print("ERR: ${result.stderr}\n\n");
print("OUT: ${result.stdout}\n\n");
- if (result.exitCode != 255) {
- throw new StateError("bad exit code");
+ if (!checkExitCode(result.exitCode)) {
+ throw new StateError("bad exit code: ${result.exitCode}");
}
- if (!result.stderr.contains("Unhandled exception:")) {
+ if (!checkStdError(result.stderr)) {
throw new StateError("stderr doesn't contain unhandled exception.");
}
- if (!result.stderr.contains("ball")) {
- throw new StateError("stderr doesn't contain 'ball'.");
+ if (checkForBall) {
+ if (!result.stderr.contains("ball")) {
+ throw new StateError("stderr doesn't contain 'ball'.");
+ }
}
}).whenComplete(() => tempDirectory.deleteSync(recursive: true));
}
+
+main() async {
+ await test("extension", true);
+ await test("relative_extension", false);
+}
« no previous file with comments | « runtime/bin/utils_win.cc ('k') | tests/standalone/io/test_relative_extension.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698