| 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 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 100 /** The actual command line that will be executed. */ | 100 /** The actual command line that will be executed. */ |
| 101 String commandLine; | 101 String commandLine; |
| 102 | 102 |
| 103 Command(this.executable, this.arguments, [this.environment = null]) { | 103 Command(this.executable, this.arguments, [this.environment = null]) { |
| 104 if (io.Platform.operatingSystem == 'windows') { | 104 if (io.Platform.operatingSystem == 'windows') { |
| 105 // Windows can't handle the first command if it is a .bat file or the like | 105 // Windows can't handle the first command if it is a .bat file or the like |
| 106 // with the slashes going the other direction. | 106 // with the slashes going the other direction. |
| 107 // TODO(efortuna): Remove this when fixed (Issue 1306). | 107 // TODO(efortuna): Remove this when fixed (Issue 1306). |
| 108 executable = executable.replaceAll('/', '\\'); | 108 executable = executable.replaceAll('/', '\\'); |
| 109 } | 109 } |
| 110 commandLine = "$executable ${arguments.join(' ')}"; | 110 var quotedArguments = []; |
| 111 arguments.forEach((argument) => quotedArguments.add('"$argument"')); |
| 112 commandLine = "$executable ${quotedArguments.join(' ')}"; |
| 111 } | 113 } |
| 112 | 114 |
| 113 String toString() => commandLine; | 115 String toString() => commandLine; |
| 114 | 116 |
| 115 Future<bool> get outputIsUpToDate => new Future.immediate(false); | 117 Future<bool> get outputIsUpToDate => new Future.immediate(false); |
| 116 io.Path get expectedOutputFile => null; | 118 io.Path get expectedOutputFile => null; |
| 117 bool get isPixelTest => false; | 119 bool get isPixelTest => false; |
| 118 } | 120 } |
| 119 | 121 |
| 120 class CompilationCommand extends Command { | 122 class CompilationCommand extends Command { |
| (...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 296 | 298 |
| 297 // Add any suffixes to the arguments of the original executable. | 299 // Add any suffixes to the arguments of the original executable. |
| 298 var suffixSplit = suffix.split(' '); | 300 var suffixSplit = suffix.split(' '); |
| 299 suffixSplit.forEach((e) { | 301 suffixSplit.forEach((e) { |
| 300 if (!e.isEmpty) newArguments.add(e); | 302 if (!e.isEmpty) newArguments.add(e); |
| 301 }); | 303 }); |
| 302 | 304 |
| 303 newArguments.addAll(c.arguments); | 305 newArguments.addAll(c.arguments); |
| 304 final newCommand = new Command(newExecutablePath, newArguments); | 306 final newCommand = new Command(newExecutablePath, newArguments); |
| 305 newCommands.add(newCommand); | 307 newCommands.add(newCommand); |
| 306 // If there are extra spaces inside the prefix or suffix, this fails. | |
| 307 String expected = | |
| 308 '$prefix ${c.executable} $suffix ${c.arguments.join(' ')}'; | |
| 309 Expect.stringEquals(expected.trim(), newCommand.commandLine); | |
| 310 } | 308 } |
| 311 commands = newCommands; | 309 commands = newCommands; |
| 312 } | 310 } |
| 313 } | 311 } |
| 314 | 312 |
| 315 CommandOutput get lastCommandOutput { | 313 CommandOutput get lastCommandOutput { |
| 316 if (commandOutputs.length == 0) { | 314 if (commandOutputs.length == 0) { |
| 317 throw new Exception("CommandOutputs is empty, maybe no command was run? (" | 315 throw new Exception("CommandOutputs is empty, maybe no command was run? (" |
| 318 "displayName: '$displayName', " | 316 "displayName: '$displayName', " |
| 319 "configurationString: '$configurationString')"); | 317 "configurationString: '$configurationString')"); |
| (...skipping 1279 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1599 if (_verbose && test.commandOutputs.length == 0) { | 1597 if (_verbose && test.commandOutputs.length == 0) { |
| 1600 int i = 1; | 1598 int i = 1; |
| 1601 if (test is BrowserTestCase) { | 1599 if (test is BrowserTestCase) { |
| 1602 // Additional command for rerunning the steps locally after the fact. | 1600 // Additional command for rerunning the steps locally after the fact. |
| 1603 var command = | 1601 var command = |
| 1604 test.configuration["_servers_"].httpServerCommandline(); | 1602 test.configuration["_servers_"].httpServerCommandline(); |
| 1605 print('$i. $command'); | 1603 print('$i. $command'); |
| 1606 i++; | 1604 i++; |
| 1607 } | 1605 } |
| 1608 for (Command command in test.commands) { | 1606 for (Command command in test.commands) { |
| 1609 print('$i. ${command.commandLine}'); | 1607 print('$i. $command'); |
| 1610 i++; | 1608 i++; |
| 1611 } | 1609 } |
| 1612 } | 1610 } |
| 1613 | 1611 |
| 1614 var isLastCommand = | 1612 var isLastCommand = |
| 1615 ((test.commands.length-1) == test.commandOutputs.length); | 1613 ((test.commands.length-1) == test.commandOutputs.length); |
| 1616 var isBrowserCommand = isLastCommand && (test is BrowserTestCase); | 1614 var isBrowserCommand = isLastCommand && (test is BrowserTestCase); |
| 1617 if (isBrowserCommand && _numBrowserProcesses == _maxBrowserProcesses) { | 1615 if (isBrowserCommand && _numBrowserProcesses == _maxBrowserProcesses) { |
| 1618 // If there is no free browser runner, put it back into the queue. | 1616 // If there is no free browser runner, put it back into the queue. |
| 1619 _tests.add(test); | 1617 _tests.add(test); |
| (...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1748 completer.complete(testCase); | 1746 completer.complete(testCase); |
| 1749 } | 1747 } |
| 1750 }); | 1748 }); |
| 1751 } | 1749 } |
| 1752 runCommand(); | 1750 runCommand(); |
| 1753 | 1751 |
| 1754 return completer.future; | 1752 return completer.future; |
| 1755 } | 1753 } |
| 1756 } | 1754 } |
| 1757 | 1755 |
| OLD | NEW |