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 /** | 5 /** |
6 * Classes and methods for executing tests. | 6 * Classes and methods for executing tests. |
7 * | 7 * |
8 * This module includes: | 8 * This module includes: |
9 * - Managing parallel execution of tests, including timeout checks. | 9 * - Managing parallel execution of tests, including timeout checks. |
10 * - Evaluating the output of each test as pass/fail/crash/timeout. | 10 * - Evaluating the output of each test as pass/fail/crash/timeout. |
11 */ | 11 */ |
12 library test_runner; | 12 library test_runner; |
13 | 13 |
14 import "dart:async"; | 14 import "dart:async"; |
15 import "dart:collection" show Queue; | 15 import "dart:collection" show Queue; |
16 import "dart:convert" show LineSplitter, UTF8, JSON; | 16 import "dart:convert" show LineSplitter, UTF8, JSON; |
17 // We need to use the 'io' prefix here, otherwise io.exitCode will shadow | 17 // We need to use the 'io' prefix here, otherwise io.exitCode will shadow |
18 // CommandOutput.exitCode in subclasses of CommandOutput. | 18 // CommandOutput.exitCode in subclasses of CommandOutput. |
19 import "dart:io" as io; | 19 import "dart:io" as io; |
20 import "dart:math" as math; | 20 import "dart:math" as math; |
21 import 'dependency_graph.dart' as dgraph; | 21 import 'dependency_graph.dart' as dgraph; |
22 import "browser_controller.dart"; | 22 import "browser_controller.dart"; |
23 import "status_file_parser.dart"; | 23 import "status_file_parser.dart"; |
24 import "test_progress.dart"; | 24 import "test_progress.dart"; |
25 import "test_suite.dart"; | 25 import "test_suite.dart"; |
26 import "utils.dart"; | 26 import "utils.dart"; |
27 import 'record_and_replay.dart'; | 27 import 'record_and_replay.dart'; |
28 | 28 |
29 import 'fletch_warnings_suite.dart' show | 29 import 'dartino_warnings_suite.dart' show |
30 FletchWarningsOutputCommand; | 30 DartinoWarningsOutputCommand; |
31 | 31 |
32 import 'fletch_test_suite.dart' show | 32 import 'dartino_test_suite.dart' show |
33 FletchTestCommand; | 33 DartinoTestCommand; |
34 | 34 |
35 import 'fletch_session_command.dart' show | 35 import 'dartino_session_command.dart' show |
36 FletchSessionCommand; | 36 DartinoSessionCommand; |
37 | 37 |
38 import 'decode_exit_code.dart' show | 38 import 'decode_exit_code.dart' show |
39 DecodeExitCode; | 39 DecodeExitCode; |
40 | 40 |
41 import '../../../pkg/fletchc/lib/src/hub/exit_codes.dart' show | 41 import '../../../pkg/dartino_compiler/lib/src/hub/exit_codes.dart' show |
42 DART_VM_EXITCODE_COMPILE_TIME_ERROR, | 42 DART_VM_EXITCODE_COMPILE_TIME_ERROR, |
43 DART_VM_EXITCODE_UNCAUGHT_EXCEPTION; | 43 DART_VM_EXITCODE_UNCAUGHT_EXCEPTION; |
44 | 44 |
45 const int CRASHING_BROWSER_EXITCODE = -10; | 45 const int CRASHING_BROWSER_EXITCODE = -10; |
46 const int SLOW_TIMEOUT_MULTIPLIER = 4; | 46 const int SLOW_TIMEOUT_MULTIPLIER = 4; |
47 | 47 |
48 const MESSAGE_CANNOT_OPEN_DISPLAY = 'Gtk-WARNING **: cannot open display'; | 48 const MESSAGE_CANNOT_OPEN_DISPLAY = 'Gtk-WARNING **: cannot open display'; |
49 const MESSAGE_FAILED_TO_RUN_COMMAND = 'Failed to run command. return code=1'; | 49 const MESSAGE_FAILED_TO_RUN_COMMAND = 'Failed to run command. return code=1'; |
50 | 50 |
51 typedef void TestCaseEvent(TestCase testCase); | 51 typedef void TestCaseEvent(TestCase testCase); |
(...skipping 1601 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1653 [int pid = 0]) { | 1653 [int pid = 0]) { |
1654 if (command is ContentShellCommand) { | 1654 if (command is ContentShellCommand) { |
1655 return new BrowserCommandOutputImpl( | 1655 return new BrowserCommandOutputImpl( |
1656 command, exitCode, timedOut, stdout, stderr, | 1656 command, exitCode, timedOut, stdout, stderr, |
1657 time, compilationSkipped); | 1657 time, compilationSkipped); |
1658 } else if (command is BrowserTestCommand) { | 1658 } else if (command is BrowserTestCommand) { |
1659 return new HTMLBrowserCommandOutputImpl( | 1659 return new HTMLBrowserCommandOutputImpl( |
1660 command, exitCode, timedOut, stdout, stderr, | 1660 command, exitCode, timedOut, stdout, stderr, |
1661 time, compilationSkipped); | 1661 time, compilationSkipped); |
1662 } else if (command is AnalysisCommand) { | 1662 } else if (command is AnalysisCommand) { |
1663 return new FletchWarningsOutputCommand( | 1663 return new DartinoWarningsOutputCommand( |
1664 command, exitCode, timedOut, stdout, stderr, | 1664 command, exitCode, timedOut, stdout, stderr, |
1665 time, compilationSkipped); | 1665 time, compilationSkipped); |
1666 } else if (command is VmCommand) { | 1666 } else if (command is VmCommand) { |
1667 return new VmCommandOutputImpl( | 1667 return new VmCommandOutputImpl( |
1668 command, exitCode, timedOut, stdout, stderr, time, pid); | 1668 command, exitCode, timedOut, stdout, stderr, time, pid); |
1669 } else if (command is CompilationCommand) { | 1669 } else if (command is CompilationCommand) { |
1670 return new CompilationCommandOutputImpl( | 1670 return new CompilationCommandOutputImpl( |
1671 command, exitCode, timedOut, stdout, stderr, time, compilationSkipped); | 1671 command, exitCode, timedOut, stdout, stderr, time, compilationSkipped); |
1672 } else if (command is JSCommandlineCommand) { | 1672 } else if (command is JSCommandlineCommand) { |
1673 return new JsCommandlineOutputImpl( | 1673 return new JsCommandlineOutputImpl( |
(...skipping 830 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2504 if (command is BrowserTestCommand) { | 2504 if (command is BrowserTestCommand) { |
2505 return _startBrowserControllerTest(command, timeout); | 2505 return _startBrowserControllerTest(command, timeout); |
2506 } else if (command is CompilationCommand && dart2jsBatchMode) { | 2506 } else if (command is CompilationCommand && dart2jsBatchMode) { |
2507 return _getBatchRunner("dart2js") | 2507 return _getBatchRunner("dart2js") |
2508 .runCommand("dart2js", command, timeout, command.arguments); | 2508 .runCommand("dart2js", command, timeout, command.arguments); |
2509 } else if (command is AnalysisCommand && batchMode) { | 2509 } else if (command is AnalysisCommand && batchMode) { |
2510 return _getBatchRunner(command.flavor) | 2510 return _getBatchRunner(command.flavor) |
2511 .runCommand(command.flavor, command, timeout, command.arguments); | 2511 .runCommand(command.flavor, command, timeout, command.arguments); |
2512 } else if (command is ScriptCommand) { | 2512 } else if (command is ScriptCommand) { |
2513 return command.run(); | 2513 return command.run(); |
2514 } else if (command is FletchTestCommand) { | 2514 } else if (command is DartinoTestCommand) { |
2515 return command.run(timeout); | 2515 return command.run(timeout); |
2516 } else if (command is FletchSessionCommand) { | 2516 } else if (command is DartinoSessionCommand) { |
2517 return command.run(timeout, globalConfiguration['verbose']); | 2517 return command.run(timeout, globalConfiguration['verbose']); |
2518 } else { | 2518 } else { |
2519 return new RunningProcess(command, timeout).run(); | 2519 return new RunningProcess(command, timeout).run(); |
2520 } | 2520 } |
2521 } | 2521 } |
2522 | 2522 |
2523 BatchRunnerProcess _getBatchRunner(String identifier) { | 2523 BatchRunnerProcess _getBatchRunner(String identifier) { |
2524 // Start batch processes if needed | 2524 // Start batch processes if needed |
2525 var runners = _batchProcesses[identifier]; | 2525 var runners = _batchProcesses[identifier]; |
2526 if (runners == null) { | 2526 if (runners == null) { |
(...skipping 427 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2954 } | 2954 } |
2955 } | 2955 } |
2956 | 2956 |
2957 void eventAllTestsDone() { | 2957 void eventAllTestsDone() { |
2958 for (var listener in _eventListener) { | 2958 for (var listener in _eventListener) { |
2959 listener.allDone(); | 2959 listener.allDone(); |
2960 } | 2960 } |
2961 _allDone(); | 2961 _allDone(); |
2962 } | 2962 } |
2963 } | 2963 } |
OLD | NEW |