Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(60)

Side by Side Diff: tools/testing/dart/test_runner.dart

Issue 11019012: Update the semantics of the 'special-command' flag given to the test script. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 8 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « tools/testing/dart/test_options.dart ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
87 this.completedHandler, 87 this.completedHandler,
88 this.expectedOutcomes, 88 this.expectedOutcomes,
89 {this.isNegative: false, 89 {this.isNegative: false,
90 this.info: null}) { 90 this.info: null}) {
91 if (!isNegative) { 91 if (!isNegative) {
92 this.isNegative = displayName.contains("negative_test"); 92 this.isNegative = displayName.contains("negative_test");
93 } 93 }
94 94
95 // Special command handling. If a special command is specified 95 // Special command handling. If a special command is specified
96 // we have to completely rewrite the command that we are using. 96 // we have to completely rewrite the command that we are using.
97 // We generate a new command-line that is the special command 97 // We generate a new command-line that is the special command where we
98 // where we replace '@' with the original command. 98 // replace '@' with the original command executable, and generate
99 // a command formed like the following
100 // Let PREFIX be what is before the @.
101 // Let SUFFIX be what is after the @.
102 // Let EXECUTABLE be the existing executable of the command.
103 // Let ARGUMENTS be the existing arguments to the existing executable.
104 // The new command will be:
105 // PREFIX EXECUTABLE SUFFIX ARGUMENTS
99 var specialCommand = configuration['special-command']; 106 var specialCommand = configuration['special-command'];
100 if (!specialCommand.isEmpty()) { 107 if (!specialCommand.isEmpty()) {
101 Expect.isTrue(specialCommand.contains('@'), 108 Expect.isTrue(specialCommand.contains('@'),
102 "special-command must contain a '@' char"); 109 "special-command must contain a '@' char");
103 var specialCommandSplit = specialCommand.split('@'); 110 var specialCommandSplit = specialCommand.split('@');
104 var prefix = specialCommandSplit[0].trim(); 111 var prefix = specialCommandSplit[0].trim();
105 var suffix = specialCommandSplit[1].trim(); 112 var suffix = specialCommandSplit[1].trim();
106 List<Command> newCommands = []; 113 List<Command> newCommands = [];
107 for (Command c in commands) { 114 for (Command c in commands) {
108 var newExecutablePath; 115 // If we don't have a new prefix we will use the existing executable.
116 var newExecutablePath = c.executable;;
109 var newArguments = []; 117 var newArguments = [];
110 118
111 if (prefix.length > 0) { 119 if (prefix.length > 0) {
112 var prefixSplit = prefix.split(' '); 120 var prefixSplit = prefix.split(' ');
113 newExecutablePath = prefixSplit[0]; 121 newExecutablePath = prefixSplit[0];
114 for (int i = 1; i < prefixSplit.length; i++) { 122 for (int i = 1; i < prefixSplit.length; i++) {
115 var current = prefixSplit[i]; 123 var current = prefixSplit[i];
116 if (!current.isEmpty()) newArguments.add(current); 124 if (!current.isEmpty()) newArguments.add(current);
117 } 125 }
118 newArguments.add(c.executable); 126 newArguments.add(c.executable);
119 } 127 }
120 newArguments.addAll(c.arguments); 128
129 // Add any suffixes to the arguments of the original executable.
121 var suffixSplit = suffix.split(' '); 130 var suffixSplit = suffix.split(' ');
122 suffixSplit.forEach((e) { 131 suffixSplit.forEach((e) {
123 if (!e.isEmpty()) newArguments.add(e); 132 if (!e.isEmpty()) newArguments.add(e);
124 }); 133 });
134
135 newArguments.addAll(c.arguments);
125 final newCommand = new Command(newExecutablePath, newArguments); 136 final newCommand = new Command(newExecutablePath, newArguments);
126 newCommands.add(newCommand); 137 newCommands.add(newCommand);
127 // If there are extra spaces inside the prefix or suffix, this fails. 138 // If there are extra spaces inside the prefix or suffix, this fails.
128 Expect.stringEquals('$prefix ${c.commandLine} $suffix'.trim(), 139 String expected =
129 newCommand.commandLine); 140 '$prefix ${c.executable} $suffix ${Strings.join(c.arguments, ' ')}';
141 Expect.stringEquals(expected.trim(), newCommand.commandLine);
130 } 142 }
131 commands = newCommands; 143 commands = newCommands;
132 } 144 }
133 } 145 }
134 146
135 int get timeout { 147 int get timeout {
136 if (expectedOutcomes.contains(SLOW)) { 148 if (expectedOutcomes.contains(SLOW)) {
137 return configuration['timeout'] * SLOW_TIMEOUT_MULTIPLIER; 149 return configuration['timeout'] * SLOW_TIMEOUT_MULTIPLIER;
138 } else { 150 } else {
139 return configuration['timeout']; 151 return configuration['timeout'];
(...skipping 1075 matching lines...) Expand 10 before | Expand all | Expand 10 after
1215 // the developer doesn't waste his or her time trying to fix a bunch of 1227 // the developer doesn't waste his or her time trying to fix a bunch of
1216 // tests that appear to be broken but were actually just flakes that 1228 // tests that appear to be broken but were actually just flakes that
1217 // didn't get retried because there had already been one failure. 1229 // didn't get retried because there had already been one failure.
1218 bool allowRetry = _MAX_FAILED_NO_RETRY > _progress.numFailedTests; 1230 bool allowRetry = _MAX_FAILED_NO_RETRY > _progress.numFailedTests;
1219 new RunningProcess(test, allowRetry, this).start(); 1231 new RunningProcess(test, allowRetry, this).start();
1220 } 1232 }
1221 _numProcesses++; 1233 _numProcesses++;
1222 } 1234 }
1223 } 1235 }
1224 } 1236 }
OLDNEW
« no previous file with comments | « tools/testing/dart/test_options.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698