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

Side by Side Diff: tests/standalone/src/io/TestRunnerTest.dart

Issue 10078011: Fix flaky standalone/io/TestRunnerTest, a unit test of the testing framework. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Use test_options.dart to make the configurations. Created 8 years, 8 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 | « no previous file | no next file » | 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 #source("ProcessTestUtil.dart"); 9 #source("ProcessTestUtil.dart");
9 10
10 class TestController { 11 class TestController {
11 static final int numTests = 4; 12 static final int numTests = 4;
12 static int numCompletedTests = 0; 13 static int numCompletedTests = 0;
13 14
14 // Used as TestCase.completedCallback. 15 // Used as TestCase.completedCallback.
15 static processCompletedTest(TestCase testCase) { 16 static processCompletedTest(TestCase testCase) {
16 TestOutput output = testCase.output; 17 TestOutput output = testCase.output;
17 print("Test: ${testCase.commands.last().commandLine}"); 18 print("Test: ${testCase.commands.last().commandLine}");
(...skipping 17 matching lines...) Expand all
35 } 36 }
36 37
37 38
38 TestCase MakeTestCase(String testName, List<String> expectations) { 39 TestCase MakeTestCase(String testName, List<String> expectations) {
39 String test_path = "tests/standalone/src/${testName}.dart"; 40 String test_path = "tests/standalone/src/${testName}.dart";
40 // Working directory may be dart/runtime rather than dart. 41 // Working directory may be dart/runtime rather than dart.
41 if (!new File(test_path).existsSync()) { 42 if (!new File(test_path).existsSync()) {
42 test_path = "../tests/standalone/src/${testName}.dart"; 43 test_path = "../tests/standalone/src/${testName}.dart";
43 } 44 }
44 45
45 var configuration = { 'timeout': 2, 46 var configuration = new TestOptionsParser().parse(['--timeout', '2'])[0];
46 'special-command': '' };
47 return new TestCase(testName, 47 return new TestCase(testName,
48 [new Command(getDartFileName(), 48 [new Command(getDartFileName(),
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 var configuration = { 'timeout': 2,
60 'special-command': '' };
61 new RunningProcess(MakeTestCase("PassTest", [PASS])).start(); 59 new RunningProcess(MakeTestCase("PassTest", [PASS])).start();
62 new RunningProcess(MakeTestCase("FailTest", [FAIL])).start(); 60 new RunningProcess(MakeTestCase("FailTest", [FAIL])).start();
63 new RunningProcess(MakeTestCase("TimeoutTest", [TIMEOUT])).start(); 61 new RunningProcess(MakeTestCase("TimeoutTest", [TIMEOUT])).start();
64 62
63 var configuration = new TestOptionsParser().parse(['--timeout', '10'])[0];
65 new RunningProcess(new TestCase("CrashTest", 64 new RunningProcess(new TestCase("CrashTest",
66 [new Command(getProcessTestFileName(), 65 [new Command(getProcessTestFileName(),
67 const ["0", "0", "1", "1"])], 66 const ["0", "0", "1", "1"])],
68 configuration, 67 configuration,
69 TestController.processCompletedTest, 68 TestController.processCompletedTest,
70 new Set<String>.from([CRASH]))).start(); 69 new Set<String>.from([CRASH]))).start();
71 Expect.equals(4, TestController.numTests); 70 Expect.equals(4, TestController.numTests);
72 // Throw must be from body of start() function for this test to work. 71 // Throw must be from body of start() function for this test to work.
73 Expect.throws(new RunningProcess(MakeTestCase("PassTest", [SKIP])).start); 72 Expect.throws(new RunningProcess(MakeTestCase("PassTest", [SKIP])).start);
74 } 73 }
OLDNEW
« 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