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

Side by Side Diff: tests/standalone/io/test_runner_test.dart

Issue 10521003: Eliminate standalone timeout_test, pass_test, and fail_test. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Change a forgotten string. Created 8 years, 6 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « tests/standalone/fail_test.dart ('k') | tests/standalone/pass_test.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 17 matching lines...) Expand all
28 print("Exit code: ${output.exitCode}"); 28 print("Exit code: ${output.exitCode}");
29 29
30 ++numCompletedTests; 30 ++numCompletedTests;
31 print("$numCompletedTests/$numTests"); 31 print("$numCompletedTests/$numTests");
32 if (numCompletedTests == numTests) { 32 if (numCompletedTests == numTests) {
33 print("test_runner_test.dart PASSED"); 33 print("test_runner_test.dart PASSED");
34 } 34 }
35 } 35 }
36 } 36 }
37 37
38
39 TestCase MakeTestCase(String testName, List<String> expectations) { 38 TestCase MakeTestCase(String testName, List<String> expectations) {
40 String test_path = "tests/standalone/${testName}.dart";
41 // Working directory may be dart/runtime rather than dart.
42 if (!new File(test_path).existsSync()) {
43 test_path = "../tests/standalone/${testName}.dart";
44 }
45
46 var configuration = new TestOptionsParser().parse(['--timeout', '2'])[0]; 39 var configuration = new TestOptionsParser().parse(['--timeout', '2'])[0];
47 return new TestCase(testName, 40 return new TestCase(testName,
48 [new Command(new Options().executable, 41 [new Command(new Options().executable,
49 <String>["--ignore-unrecognized-flags", 42 <String>[new Options().script,
50 "--enable_type_checks", 43 testName])],
51 test_path])],
52 configuration, 44 configuration,
53 TestController.processCompletedTest, 45 TestController.processCompletedTest,
54 new Set<String>.from(expectations)); 46 new Set<String>.from(expectations));
55 } 47 }
56 48
57 49 void testTestRunner() {
58 void main() { 50 new RunningProcess(MakeTestCase("pass", [PASS])).start();
59 new RunningProcess(MakeTestCase("pass_test", [PASS])).start(); 51 new RunningProcess(MakeTestCase("fail", [FAIL])).start();
60 new RunningProcess(MakeTestCase("fail_test", [FAIL])).start(); 52 new RunningProcess(MakeTestCase("timeout", [TIMEOUT])).start();
61 new RunningProcess(MakeTestCase("timeout_test", [TIMEOUT])).start();
62 53
63 // The crash test sometimes times out. Run it with a large timeout to help 54 // The crash test sometimes times out. Run it with a large timeout to help
64 // diagnose the delay. 55 // diagnose the delay.
65 // The test loads a new executable, which may sometimes take a long time. 56 // 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. 57 // It involves a wait on the VM event loop, and possible system delays.
67 var configuration = new TestOptionsParser().parse(['--timeout', '60'])[0]; 58 var configuration = new TestOptionsParser().parse(['--timeout', '60'])[0];
68 new RunningProcess(new TestCase("CrashTest", 59 new RunningProcess(new TestCase("CrashTest",
69 [new Command(getProcessTestFileName(), 60 [new Command(getProcessTestFileName(),
70 const ["0", "0", "1", "1"])], 61 const ["0", "0", "1", "1"])],
71 configuration, 62 configuration,
72 TestController.processCompletedTest, 63 TestController.processCompletedTest,
73 new Set<String>.from([CRASH]))).start(); 64 new Set<String>.from([CRASH]))).start();
74 Expect.equals(4, TestController.numTests); 65 Expect.equals(4, TestController.numTests);
75 // Throw must be from body of start() function for this test to work. 66 // Test that the test runner throws an exception if a test with
76 Expect.throws(new RunningProcess(MakeTestCase("pass_test", [SKIP])).start); 67 // expectation SKIP is run. Throw must be from the synchronous part
68 // of the RunninProcess starter, for the exception to be caught here.
69 Expect.throws(new RunningProcess(MakeTestCase("pass", [SKIP])).start);
77 } 70 }
71
72 void main() {
73 // Run the test_runner_test if there are no command-line options.
74 // Otherwise, run one of the component tests that always pass,
75 // fail, or timeout.
76 var arguments = new Options().arguments;
77 if (arguments.isEmpty()) {
78 testTestRunner();
79 } else {
80 switch (arguments[0]) {
81 case 'pass':
82 return;
83 case 'fail':
84 Expect.fail("This test always fails, to test the test scripts.");
85 break;
86 case 'timeout':
87 // Run for 10 seconds, then exit. This tests a 2 second timeout.
88 new Timer(10 * 1000, (t){ });
89 break;
90 default:
91 throw "Unknown option ${arguments[0]} passed to test_runner_test";
92 }
93 }
94 }
OLDNEW
« no previous file with comments | « tests/standalone/fail_test.dart ('k') | tests/standalone/pass_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698