Chromium Code Reviews| 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:io"); | 14 #import("dart:io"); |
| 15 #import("dart:isolate"); | 15 #import("dart:isolate"); |
| 16 #import("status_file_parser.dart"); | 16 #import("status_file_parser.dart"); |
| 17 #import("test_progress.dart"); | 17 #import("test_progress.dart"); |
| 18 #import("test_suite.dart"); | 18 #import("test_suite.dart"); |
| 19 | 19 |
| 20 final int NO_TIMEOUT = 0; | 20 final int NO_TIMEOUT = 0; |
| 21 final int SLOW_TIMEOUT_MULTIPLIER = 4; | |
| 21 | 22 |
| 22 /** A command executed as a step in a test case. */ | 23 /** A command executed as a step in a test case. */ |
| 23 class Command { | 24 class Command { |
| 24 /** Path to the executable of this command. */ | 25 /** Path to the executable of this command. */ |
| 25 String executable; | 26 String executable; |
| 26 | 27 |
| 27 /** Command line arguments to the executable. */ | 28 /** Command line arguments to the executable. */ |
| 28 List<String> arguments; | 29 List<String> arguments; |
| 29 | 30 |
| 30 /** The actual command line that will be executed. */ | 31 /** The actual command line that will be executed. */ |
| (...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 117 final newCommand = new Command(newExecutablePath, newArguments); | 118 final newCommand = new Command(newExecutablePath, newArguments); |
| 118 newCommands.add(newCommand); | 119 newCommands.add(newCommand); |
| 119 // If there are extra spaces inside the prefix or suffix, this fails. | 120 // If there are extra spaces inside the prefix or suffix, this fails. |
| 120 Expect.stringEquals('$prefix ${c.commandLine} $suffix'.trim(), | 121 Expect.stringEquals('$prefix ${c.commandLine} $suffix'.trim(), |
| 121 newCommand.commandLine); | 122 newCommand.commandLine); |
| 122 } | 123 } |
| 123 commands = newCommands; | 124 commands = newCommands; |
| 124 } | 125 } |
| 125 } | 126 } |
| 126 | 127 |
| 127 int get timeout() => configuration['timeout']; | 128 int get timeout() { |
| 129 int timeout = configuration['timeout']; | |
| 130 if (expectedOutcomes.contains(SLOW)) { | |
| 131 timeout *= SLOW_TIMEOUT_MULTIPLIER; | |
| 132 } | |
| 133 return timeout; | |
| 134 } | |
| 128 | 135 |
|
Bill Hesse
2012/08/15 11:41:03
How about
if (expectedOutcomes.contains(SLOW))
| |
| 129 String get configurationString() { | 136 String get configurationString() { |
| 130 final compiler = configuration['compiler']; | 137 final compiler = configuration['compiler']; |
| 131 final runtime = configuration['runtime']; | 138 final runtime = configuration['runtime']; |
| 132 final mode = configuration['mode']; | 139 final mode = configuration['mode']; |
| 133 final arch = configuration['arch']; | 140 final arch = configuration['arch']; |
| 134 return "$compiler-$runtime ${mode}_$arch"; | 141 return "$compiler-$runtime ${mode}_$arch"; |
| 135 } | 142 } |
| 136 | 143 |
| 137 List<String> get batchRunnerArguments() => ['-batch']; | 144 List<String> get batchRunnerArguments() => ['-batch']; |
| 138 List<String> get batchTestArguments() => commands.last().arguments; | 145 List<String> get batchTestArguments() => commands.last().arguments; |
| (...skipping 1040 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1179 // the developer doesn't waste his or her time trying to fix a bunch of | 1186 // the developer doesn't waste his or her time trying to fix a bunch of |
| 1180 // tests that appear to be broken but were actually just flakes that | 1187 // tests that appear to be broken but were actually just flakes that |
| 1181 // didn't get retried because there had already been one failure. | 1188 // didn't get retried because there had already been one failure. |
| 1182 bool allowRetry = _MAX_FAILED_NO_RETRY > _progress.numFailedTests; | 1189 bool allowRetry = _MAX_FAILED_NO_RETRY > _progress.numFailedTests; |
| 1183 new RunningProcess(test, allowRetry, this).start(); | 1190 new RunningProcess(test, allowRetry, this).start(); |
| 1184 } | 1191 } |
| 1185 _numProcesses++; | 1192 _numProcesses++; |
| 1186 } | 1193 } |
| 1187 } | 1194 } |
| 1188 } | 1195 } |
| OLD | NEW |