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 | 21 |
22 import 'package:yaml/yaml.dart'; | 22 import 'package:yaml/yaml.dart'; |
23 | 23 |
24 import 'android.dart'; | 24 import 'android.dart'; |
| 25 import "browser_controller.dart"; |
25 import 'dependency_graph.dart' as dgraph; | 26 import 'dependency_graph.dart' as dgraph; |
26 import "browser_controller.dart"; | |
27 import "path.dart"; | 27 import "path.dart"; |
| 28 import 'record_and_replay.dart'; |
| 29 import "runtime_configuration.dart"; |
28 import "status_file_parser.dart"; | 30 import "status_file_parser.dart"; |
29 import "test_progress.dart"; | 31 import "test_progress.dart"; |
30 import "test_suite.dart"; | 32 import "test_suite.dart"; |
31 import "utils.dart"; | 33 import "utils.dart"; |
32 import 'record_and_replay.dart'; | |
33 | 34 |
34 const int CRASHING_BROWSER_EXITCODE = -10; | 35 const int CRASHING_BROWSER_EXITCODE = -10; |
35 const int SLOW_TIMEOUT_MULTIPLIER = 4; | 36 const int SLOW_TIMEOUT_MULTIPLIER = 4; |
36 | 37 |
37 const MESSAGE_CANNOT_OPEN_DISPLAY = 'Gtk-WARNING **: cannot open display'; | 38 const MESSAGE_CANNOT_OPEN_DISPLAY = 'Gtk-WARNING **: cannot open display'; |
38 const MESSAGE_FAILED_TO_RUN_COMMAND = 'Failed to run command. return code=1'; | 39 const MESSAGE_FAILED_TO_RUN_COMMAND = 'Failed to run command. return code=1'; |
39 | 40 |
40 typedef void TestCaseEvent(TestCase testCase); | 41 typedef void TestCaseEvent(TestCase testCase); |
41 typedef void ExitCodeEvent(int exitCode); | 42 typedef void ExitCodeEvent(int exitCode); |
42 typedef void EnqueueMoreWork(ProcessQueue queue); | 43 typedef void EnqueueMoreWork(ProcessQueue queue); |
(...skipping 2650 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2693 return new RunningProcess(command, timeout).run(); | 2694 return new RunningProcess(command, timeout).run(); |
2694 } | 2695 } |
2695 } | 2696 } |
2696 | 2697 |
2697 Future<CommandOutput> _runAdbPrecompilationCommand( | 2698 Future<CommandOutput> _runAdbPrecompilationCommand( |
2698 AdbDevice device, AdbPrecompilationCommand command, int timeout) async { | 2699 AdbDevice device, AdbPrecompilationCommand command, int timeout) async { |
2699 var runner = command.precompiledRunnerFilename; | 2700 var runner = command.precompiledRunnerFilename; |
2700 var processTest = command.processTestFilename; | 2701 var processTest = command.processTestFilename; |
2701 var testdir = command.precompiledTestDirectory; | 2702 var testdir = command.precompiledTestDirectory; |
2702 var arguments = command.arguments; | 2703 var arguments = command.arguments; |
2703 var devicedir = '/data/local/tmp/precompilation-testing'; | 2704 var devicedir = DartPrecompiledAdbRuntimeConfiguration.DeviceDir; |
2704 var deviceTestDir = '/data/local/tmp/precompilation-testing/test'; | 2705 var deviceTestDir = DartPrecompiledAdbRuntimeConfiguration.DeviceTestDir; |
2705 | 2706 |
2706 // We copy all the files which the vm precompiler puts into the test | 2707 // We copy all the files which the vm precompiler puts into the test |
2707 // directory. | 2708 // directory. |
2708 List<String> files = new io.Directory(testdir) | 2709 List<String> files = new io.Directory(testdir) |
2709 .listSync() | 2710 .listSync() |
2710 .map((file) => file.path) | 2711 .map((file) => file.path) |
2711 .map((path) => path.substring(path.lastIndexOf('/') + 1)) | 2712 .map((path) => path.substring(path.lastIndexOf('/') + 1)) |
2712 .toList(); | 2713 .toList(); |
2713 | 2714 |
2714 var timeoutDuration = new Duration(seconds: timeout); | 2715 var timeoutDuration = new Duration(seconds: timeout); |
(...skipping 496 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3211 } | 3212 } |
3212 } | 3213 } |
3213 | 3214 |
3214 void eventAllTestsDone() { | 3215 void eventAllTestsDone() { |
3215 for (var listener in _eventListener) { | 3216 for (var listener in _eventListener) { |
3216 listener.allDone(); | 3217 listener.allDone(); |
3217 } | 3218 } |
3218 _allDone(); | 3219 _allDone(); |
3219 } | 3220 } |
3220 } | 3221 } |
OLD | NEW |