| OLD | NEW |
| 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file |
| 2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
| 3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
| 4 | 4 |
| 5 #import("dart:io"); | 5 #import("dart:io"); |
| 6 #import("../../../tools/testing/dart/test_runner.dart"); | 6 #import("../../../tools/testing/dart/test_runner.dart"); |
| 7 #import("../../../tools/testing/dart/status_file_parser.dart"); | 7 #import("../../../tools/testing/dart/status_file_parser.dart"); |
| 8 #import("../../../tools/testing/dart/test_options.dart"); | 8 #import("../../../tools/testing/dart/test_options.dart"); |
| 9 #source("process_test_util.dart"); | 9 #source("process_test_util.dart"); |
| 10 | 10 |
| (...skipping 27 matching lines...) Expand all Loading... |
| 38 | 38 |
| 39 TestCase MakeTestCase(String testName, List<String> expectations) { | 39 TestCase MakeTestCase(String testName, List<String> expectations) { |
| 40 String test_path = "tests/standalone/${testName}.dart"; | 40 String test_path = "tests/standalone/${testName}.dart"; |
| 41 // Working directory may be dart/runtime rather than dart. | 41 // Working directory may be dart/runtime rather than dart. |
| 42 if (!new File(test_path).existsSync()) { | 42 if (!new File(test_path).existsSync()) { |
| 43 test_path = "../tests/standalone/${testName}.dart"; | 43 test_path = "../tests/standalone/${testName}.dart"; |
| 44 } | 44 } |
| 45 | 45 |
| 46 var configuration = new TestOptionsParser().parse(['--timeout', '2'])[0]; | 46 var configuration = new TestOptionsParser().parse(['--timeout', '2'])[0]; |
| 47 return new TestCase(testName, | 47 return new TestCase(testName, |
| 48 [new Command(getDartFileName(), | 48 [new Command(new Options().executable, |
| 49 <String>["--ignore-unrecognized-flags", | 49 <String>["--ignore-unrecognized-flags", |
| 50 "--enable_type_checks", | 50 "--enable_type_checks", |
| 51 test_path])], | 51 test_path])], |
| 52 configuration, | 52 configuration, |
| 53 TestController.processCompletedTest, | 53 TestController.processCompletedTest, |
| 54 new Set<String>.from(expectations)); | 54 new Set<String>.from(expectations)); |
| 55 } | 55 } |
| 56 | 56 |
| 57 | 57 |
| 58 void main() { | 58 void main() { |
| 59 new RunningProcess(MakeTestCase("pass_test", [PASS])).start(); | 59 new RunningProcess(MakeTestCase("pass_test", [PASS])).start(); |
| 60 new RunningProcess(MakeTestCase("fail_test", [FAIL])).start(); | 60 new RunningProcess(MakeTestCase("fail_test", [FAIL])).start(); |
| 61 new RunningProcess(MakeTestCase("timeout_test", [TIMEOUT])).start(); | 61 new RunningProcess(MakeTestCase("timeout_test", [TIMEOUT])).start(); |
| 62 | 62 |
| 63 // The crash test sometimes times out. Run it with a large timeout to help | 63 // The crash test sometimes times out. Run it with a large timeout to help |
| 64 // diagnose the delay. | 64 // diagnose the delay. |
| 65 // The test loads a new executable, which may sometimes take a long time. | 65 // The test loads a new executable, which may sometimes take a long time. |
| 66 // It involves a wait on the VM event loop, and possible system delays. | 66 // It involves a wait on the VM event loop, and possible system delays. |
| 67 var configuration = new TestOptionsParser().parse(['--timeout', '60'])[0]; | 67 var configuration = new TestOptionsParser().parse(['--timeout', '60'])[0]; |
| 68 new RunningProcess(new TestCase("CrashTest", | 68 new RunningProcess(new TestCase("CrashTest", |
| 69 [new Command(getProcessTestFileName(), | 69 [new Command(getProcessTestFileName(), |
| 70 const ["0", "0", "1", "1"])], | 70 const ["0", "0", "1", "1"])], |
| 71 configuration, | 71 configuration, |
| 72 TestController.processCompletedTest, | 72 TestController.processCompletedTest, |
| 73 new Set<String>.from([CRASH]))).start(); | 73 new Set<String>.from([CRASH]))).start(); |
| 74 Expect.equals(4, TestController.numTests); | 74 Expect.equals(4, TestController.numTests); |
| 75 // Throw must be from body of start() function for this test to work. | 75 // Throw must be from body of start() function for this test to work. |
| 76 Expect.throws(new RunningProcess(MakeTestCase("pass_test", [SKIP])).start); | 76 Expect.throws(new RunningProcess(MakeTestCase("pass_test", [SKIP])).start); |
| 77 } | 77 } |
| OLD | NEW |