| 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. |
| (...skipping 14 matching lines...) Expand all Loading... |
| 25 /** Path to the executable of this command. */ | 25 /** Path to the executable of this command. */ |
| 26 String executable; | 26 String executable; |
| 27 | 27 |
| 28 /** Command line arguments to the executable. */ | 28 /** Command line arguments to the executable. */ |
| 29 List<String> arguments; | 29 List<String> arguments; |
| 30 | 30 |
| 31 /** The actual command line that will be executed. */ | 31 /** The actual command line that will be executed. */ |
| 32 String commandLine; | 32 String commandLine; |
| 33 | 33 |
| 34 Command(this.executable, this.arguments) { | 34 Command(this.executable, this.arguments) { |
| 35 if (Platform.operatingSystem == 'windows') { |
| 36 // Windows can't handle the first command if it is a .bat file or the like |
| 37 // with the slashes going the other direction. |
| 38 // TODO(efortuna): Remove this when fixed (Issue 1306). |
| 39 executable = executable.replaceAll('/', '\\'); |
| 40 } |
| 35 commandLine = "$executable ${Strings.join(arguments, ' ')}"; | 41 commandLine = "$executable ${Strings.join(arguments, ' ')}"; |
| 36 } | 42 } |
| 37 | 43 |
| 38 String toString() => commandLine; | 44 String toString() => commandLine; |
| 39 } | 45 } |
| 40 | 46 |
| 41 /** | 47 /** |
| 42 * TestCase contains all the information needed to run a test and evaluate | 48 * TestCase contains all the information needed to run a test and evaluate |
| 43 * its output. Running a test involves starting a separate process, with | 49 * its output. Running a test involves starting a separate process, with |
| 44 * the executable and arguments given by the TestCase, and recording its | 50 * the executable and arguments given by the TestCase, and recording its |
| (...skipping 562 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 607 Expect.isFalse(testCase.expectedOutcomes.contains(SKIP)); | 613 Expect.isFalse(testCase.expectedOutcomes.contains(SKIP)); |
| 608 stdout = new List<String>(); | 614 stdout = new List<String>(); |
| 609 stderr = new List<String>(); | 615 stderr = new List<String>(); |
| 610 currentStep = 0; | 616 currentStep = 0; |
| 611 startTime = new Date.now(); | 617 startTime = new Date.now(); |
| 612 runCommand(testCase.commands[currentStep++], stepExitHandler); | 618 runCommand(testCase.commands[currentStep++], stepExitHandler); |
| 613 } | 619 } |
| 614 | 620 |
| 615 void runCommand(Command command, | 621 void runCommand(Command command, |
| 616 void exitHandler(int exitCode)) { | 622 void exitHandler(int exitCode)) { |
| 617 if (Platform.operatingSystem == 'windows') { | |
| 618 // Windows can't handle the first command if it is a .bat file or the like | |
| 619 // with the slashes going the other direction. | |
| 620 // TODO(efortuna): Remove this when fixed (Issue 1306). | |
| 621 command.executable = command.executable.replaceAll('/', '\\'); | |
| 622 } | |
| 623 process = Process.start(command.executable, command.arguments); | 623 process = Process.start(command.executable, command.arguments); |
| 624 process.onExit = exitHandler; | 624 process.onExit = exitHandler; |
| 625 process.onError = (e) { | 625 process.onError = (e) { |
| 626 print("Error starting process:"); | 626 print("Error starting process:"); |
| 627 print(" Command: $command"); | 627 print(" Command: $command"); |
| 628 print(" Error: $e"); | 628 print(" Error: $e"); |
| 629 }; | 629 }; |
| 630 InputStream stdoutStream = process.stdout; | 630 InputStream stdoutStream = process.stdout; |
| 631 InputStream stderrStream = process.stderr; | 631 InputStream stderrStream = process.stderr; |
| 632 StringInputStream stdoutStringStream = new StringInputStream(stdoutStream); | 632 StringInputStream stdoutStringStream = new StringInputStream(stdoutStream); |
| (...skipping 553 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1186 // 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 |
| 1187 // 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 |
| 1188 // didn't get retried because there had already been one failure. | 1188 // didn't get retried because there had already been one failure. |
| 1189 bool allowRetry = _MAX_FAILED_NO_RETRY > _progress.numFailedTests; | 1189 bool allowRetry = _MAX_FAILED_NO_RETRY > _progress.numFailedTests; |
| 1190 new RunningProcess(test, allowRetry, this).start(); | 1190 new RunningProcess(test, allowRetry, this).start(); |
| 1191 } | 1191 } |
| 1192 _numProcesses++; | 1192 _numProcesses++; |
| 1193 } | 1193 } |
| 1194 } | 1194 } |
| 1195 } | 1195 } |
| OLD | NEW |