| 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 "dart:async"; | 7 import "dart:async"; |
| 8 import "dart:utf"; |
| 8 import "../../../tools/testing/dart/test_runner.dart"; | 9 import "../../../tools/testing/dart/test_runner.dart"; |
| 9 import "../../../tools/testing/dart/status_file_parser.dart"; | 10 import "../../../tools/testing/dart/status_file_parser.dart"; |
| 10 import "../../../tools/testing/dart/test_options.dart"; | 11 import "../../../tools/testing/dart/test_options.dart"; |
| 11 import "process_test_util.dart"; | 12 import "process_test_util.dart"; |
| 12 | 13 |
| 13 class TestController { | 14 class TestController { |
| 14 static const int numTests = 4; | 15 static const int numTests = 4; |
| 15 static int numCompletedTests = 0; | 16 static int numCompletedTests = 0; |
| 16 | 17 |
| 17 // Used as TestCase.completedCallback. | 18 // Used as TestCase.completedCallback. |
| 18 static processCompletedTest(TestCase testCase) { | 19 static processCompletedTest(TestCase testCase) { |
| 19 CommandOutput output = testCase.lastCommandOutput; | 20 CommandOutput output = testCase.lastCommandOutput; |
| 20 print("Test: ${testCase.commands.last.commandLine}"); | 21 print("Test: ${testCase.commands.last.commandLine}"); |
| 21 if (output.unexpectedOutput) { | 22 if (output.unexpectedOutput) { |
| 22 throw "Unexpected output: ${output.result}"; | 23 throw "Unexpected output: ${output.result}"; |
| 23 } | 24 } |
| 24 print("stdout: "); | 25 print("stdout: "); |
| 25 print(new String.fromCharCodes(output.stdout)); | 26 print(decodeUtf8(output.stdout)); |
| 26 print("stderr: "); | 27 print("stderr: "); |
| 27 print(new String.fromCharCodes(output.stderr)); | 28 print(decodeUtf8(output.stderr)); |
| 28 | 29 |
| 29 print("Time: ${output.time}"); | 30 print("Time: ${output.time}"); |
| 30 print("Exit code: ${output.exitCode}"); | 31 print("Exit code: ${output.exitCode}"); |
| 31 | 32 |
| 32 ++numCompletedTests; | 33 ++numCompletedTests; |
| 33 print("$numCompletedTests/$numTests"); | 34 print("$numCompletedTests/$numTests"); |
| 34 if (numCompletedTests == numTests) { | 35 if (numCompletedTests == numTests) { |
| 35 print("test_runner_test.dart PASSED"); | 36 print("test_runner_test.dart PASSED"); |
| 36 } | 37 } |
| 37 } | 38 } |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 87 break; | 88 break; |
| 88 case 'timeout': | 89 case 'timeout': |
| 89 // Run for 10 seconds, then exit. This tests a 2 second timeout. | 90 // Run for 10 seconds, then exit. This tests a 2 second timeout. |
| 90 new Timer(10 * 1000, (t){ }); | 91 new Timer(10 * 1000, (t){ }); |
| 91 break; | 92 break; |
| 92 default: | 93 default: |
| 93 throw "Unknown option ${arguments[0]} passed to test_runner_test"; | 94 throw "Unknown option ${arguments[0]} passed to test_runner_test"; |
| 94 } | 95 } |
| 95 } | 96 } |
| 96 } | 97 } |
| OLD | NEW |