Chromium Code Reviews| 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("dart:isolate"); | 6 #import("dart:isolate"); |
| 7 #import("../../../tools/testing/dart/test_runner.dart"); | 7 #import("../../../tools/testing/dart/test_runner.dart"); |
| 8 #import("../../../tools/testing/dart/status_file_parser.dart"); | 8 #import("../../../tools/testing/dart/status_file_parser.dart"); |
| 9 #import("../../../tools/testing/dart/test_options.dart"); | 9 #import("../../../tools/testing/dart/test_options.dart"); |
| 10 #source("process_test_util.dart"); | 10 #source("process_test_util.dart"); |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 50 void testTestRunner() { | 50 void testTestRunner() { |
| 51 new RunningProcess(MakeTestCase("pass", [PASS])).start(); | 51 new RunningProcess(MakeTestCase("pass", [PASS])).start(); |
| 52 new RunningProcess(MakeTestCase("fail", [FAIL])).start(); | 52 new RunningProcess(MakeTestCase("fail", [FAIL])).start(); |
| 53 new RunningProcess(MakeTestCase("timeout", [TIMEOUT])).start(); | 53 new RunningProcess(MakeTestCase("timeout", [TIMEOUT])).start(); |
| 54 | 54 |
| 55 // The crash test sometimes times out. Run it with a large timeout to help | 55 // The crash test sometimes times out. Run it with a large timeout to help |
| 56 // diagnose the delay. | 56 // diagnose the delay. |
| 57 // The test loads a new executable, which may sometimes take a long time. | 57 // The test loads a new executable, which may sometimes take a long time. |
| 58 // It involves a wait on the VM event loop, and possible system delays. | 58 // It involves a wait on the VM event loop, and possible system delays. |
| 59 var configuration = new TestOptionsParser().parse(['--timeout', '60'])[0]; | 59 var configuration = new TestOptionsParser().parse(['--timeout', '60'])[0]; |
| 60 // TODO(1947): Remove the TIMEOUT from this case when it stops timing out. | |
|
Mads Ager (google)
2012/08/22 09:06:36
Shouldn't we update the status file instead with P
| |
| 60 new RunningProcess(new TestCase("CrashTest", | 61 new RunningProcess(new TestCase("CrashTest", |
| 61 [new Command(getProcessTestFileName(), | 62 [new Command(getProcessTestFileName(), const ["0", "0", "1", "1"])], |
| 62 const ["0", "0", "1", "1"])], | 63 configuration, |
| 63 configuration, | 64 TestController.processCompletedTest, |
| 64 TestController.processCompletedTest, | 65 new Set<String>.from([CRASH, TIMEOUT]))).start(); |
| 65 new Set<String>.from([CRASH]))).start(); | |
| 66 Expect.equals(4, TestController.numTests); | 66 Expect.equals(4, TestController.numTests); |
| 67 // Test that the test runner throws an exception if a test with | 67 // Test that the test runner throws an exception if a test with |
| 68 // expectation SKIP is run. Throw must be from the synchronous part | 68 // expectation SKIP is run. The RunningProcess constructor must throw |
| 69 // of the RunninProcess starter, for the exception to be caught here. | 69 // the exception synchronously, for it to be caught here at the call site. |
| 70 Expect.throws(new RunningProcess(MakeTestCase("pass", [SKIP])).start); | 70 Expect.throws(new RunningProcess(MakeTestCase("pass", [SKIP])).start); |
| 71 } | 71 } |
| 72 | 72 |
| 73 void main() { | 73 void main() { |
| 74 // Run the test_runner_test if there are no command-line options. | 74 // Run the test_runner_test if there are no command-line options. |
| 75 // Otherwise, run one of the component tests that always pass, | 75 // Otherwise, run one of the component tests that always pass, |
| 76 // fail, or timeout. | 76 // fail, or timeout. |
| 77 var arguments = new Options().arguments; | 77 var arguments = new Options().arguments; |
| 78 if (arguments.isEmpty()) { | 78 if (arguments.isEmpty()) { |
| 79 testTestRunner(); | 79 testTestRunner(); |
| 80 } else { | 80 } else { |
| 81 switch (arguments[0]) { | 81 switch (arguments[0]) { |
| 82 case 'pass': | 82 case 'pass': |
| 83 return; | 83 return; |
| 84 case 'fail': | 84 case 'fail': |
| 85 Expect.fail("This test always fails, to test the test scripts."); | 85 Expect.fail("This test always fails, to test the test scripts."); |
| 86 break; | 86 break; |
| 87 case 'timeout': | 87 case 'timeout': |
| 88 // Run for 10 seconds, then exit. This tests a 2 second timeout. | 88 // Run for 10 seconds, then exit. This tests a 2 second timeout. |
| 89 new Timer(10 * 1000, (t){ }); | 89 new Timer(10 * 1000, (t){ }); |
| 90 break; | 90 break; |
| 91 default: | 91 default: |
| 92 throw "Unknown option ${arguments[0]} passed to test_runner_test"; | 92 throw "Unknown option ${arguments[0]} passed to test_runner_test"; |
| 93 } | 93 } |
| 94 } | 94 } |
| 95 } | 95 } |
| OLD | NEW |