| 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 30 matching lines...) Expand all Loading... |
| 41 const List<String> EXCLUDED_ENVIRONMENT_VARIABLES = | 41 const List<String> EXCLUDED_ENVIRONMENT_VARIABLES = |
| 42 const ['http_proxy', 'https_proxy', 'no_proxy', | 42 const ['http_proxy', 'https_proxy', 'no_proxy', |
| 43 'HTTP_PROXY', 'HTTPS_PROXY', 'NO_PROXY']; | 43 'HTTP_PROXY', 'HTTPS_PROXY', 'NO_PROXY']; |
| 44 | 44 |
| 45 | 45 |
| 46 /** A command executed as a step in a test case. */ | 46 /** A command executed as a step in a test case. */ |
| 47 class Command { | 47 class Command { |
| 48 /** A descriptive name for this command. */ | 48 /** A descriptive name for this command. */ |
| 49 String displayName; | 49 String displayName; |
| 50 | 50 |
| 51 /** The actual command line that will be executed. */ | |
| 52 String commandLine; | |
| 53 | |
| 54 /** Number of times this command *can* be retried */ | 51 /** Number of times this command *can* be retried */ |
| 55 int get maxNumRetries => 2; | 52 int get maxNumRetries => 2; |
| 56 | 53 |
| 57 /** Reproduction command */ | 54 /** Reproduction command */ |
| 58 String get reproductionCommand => null; | 55 String get reproductionCommand => null; |
| 59 | 56 |
| 60 // We compute the Command.hashCode lazily and cache it here, since it might | 57 // We compute the Command.hashCode lazily and cache it here, since it might |
| 61 // be expensive to compute (and hashCode is called often). | 58 // be expensive to compute (and hashCode is called often). |
| 62 int _cachedHashCode; | 59 int _cachedHashCode; |
| 63 | 60 |
| 64 Command._(this.displayName); | 61 Command._(this.displayName); |
| 65 | 62 |
| 66 int get hashCode { | 63 int get hashCode { |
| 67 if (_cachedHashCode == null) { | 64 if (_cachedHashCode == null) { |
| 68 var builder = new HashCodeBuilder(); | 65 var builder = new HashCodeBuilder(); |
| 69 _buildHashCode(builder); | 66 _buildHashCode(builder); |
| 70 _cachedHashCode = builder.value; | 67 _cachedHashCode = builder.value; |
| 71 } | 68 } |
| 72 return _cachedHashCode; | 69 return _cachedHashCode; |
| 73 } | 70 } |
| 74 | 71 |
| 75 operator ==(other) { | 72 operator ==(other) => identical(this, other) || |
| 76 if (other is Command) { | 73 (runtimeType == other.runtimeType && _equal(other)); |
| 77 return identical(this, other) || _equal(other as Command); | 74 |
| 78 } | 75 void _buildHashCode(HashCodeBuilder builder) { |
| 79 return false; | 76 builder.addJson(displayName); |
| 80 } | 77 } |
| 81 | 78 |
| 82 void _buildHashCode(HashCodeBuilder builder) { | 79 bool _equal(Command other) => |
| 83 builder.add(commandLine); | 80 hashCode == other.hashCode && |
| 84 builder.add(displayName); | 81 displayName == other.displayName; |
| 85 } | |
| 86 | |
| 87 bool _equal(Command other) { | |
| 88 return hashCode == other.hashCode && | |
| 89 commandLine == other.commandLine && | |
| 90 displayName == other.displayName; | |
| 91 } | |
| 92 | 82 |
| 93 String toString() => reproductionCommand; | 83 String toString() => reproductionCommand; |
| 94 | 84 |
| 95 Future<bool> get outputIsUpToDate => new Future.value(false); | 85 Future<bool> get outputIsUpToDate => new Future.value(false); |
| 96 } | 86 } |
| 97 | 87 |
| 98 class ProcessCommand extends Command { | 88 class ProcessCommand extends Command { |
| 99 /** Path to the executable of this command. */ | 89 /** Path to the executable of this command. */ |
| 100 String executable; | 90 String executable; |
| 101 | 91 |
| (...skipping 14 matching lines...) Expand all Loading... |
| 116 if (io.Platform.operatingSystem == 'windows') { | 106 if (io.Platform.operatingSystem == 'windows') { |
| 117 // Windows can't handle the first command if it is a .bat file or the like | 107 // Windows can't handle the first command if it is a .bat file or the like |
| 118 // with the slashes going the other direction. | 108 // with the slashes going the other direction. |
| 119 // NOTE: Issue 1306 | 109 // NOTE: Issue 1306 |
| 120 executable = executable.replaceAll('/', '\\'); | 110 executable = executable.replaceAll('/', '\\'); |
| 121 } | 111 } |
| 122 } | 112 } |
| 123 | 113 |
| 124 void _buildHashCode(HashCodeBuilder builder) { | 114 void _buildHashCode(HashCodeBuilder builder) { |
| 125 super._buildHashCode(builder); | 115 super._buildHashCode(builder); |
| 126 builder.add(executable); | 116 builder.addJson(executable); |
| 127 builder.add(workingDirectory); | 117 builder.addJson(workingDirectory); |
| 128 for (var object in arguments) builder.add(object); | 118 builder.addJson(arguments); |
| 129 if (environmentOverrides != null) { | 119 builder.addJson(environmentOverrides); |
| 130 for (var key in environmentOverrides.keys) { | |
| 131 builder.add(key); | |
| 132 builder.add(environmentOverrides[key]); | |
| 133 } | |
| 134 } | |
| 135 } | 120 } |
| 136 | 121 |
| 137 bool _equal(Command other) { | 122 bool _equal(ProcessCommand other) => |
| 138 if (other is ProcessCommand) { | 123 super._equal(other) && |
| 139 if (!super._equal(other)) return false; | 124 executable == other.executable && |
| 140 | 125 deepJsonCompare(arguments, other.arguments) && |
| 141 if (hashCode != other.hashCode || | 126 workingDirectory == other.workingDirectory && |
| 142 executable != other.executable || | 127 deepJsonCompare(environmentOverrides, other.environmentOverrides); |
| 143 arguments.length != other.arguments.length) { | |
| 144 return false; | |
| 145 } | |
| 146 | |
| 147 if (!deepJsonCompare(arguments, other.arguments)) return false; | |
| 148 if (workingDirectory != other.workingDirectory) return false; | |
| 149 if (!deepJsonCompare(environmentOverrides, other.environmentOverrides)) { | |
| 150 return false; | |
| 151 } | |
| 152 | |
| 153 return true; | |
| 154 } | |
| 155 return false; | |
| 156 } | |
| 157 | 128 |
| 158 String get reproductionCommand { | 129 String get reproductionCommand { |
| 159 var command = ([executable]..addAll(arguments)) | 130 var command = ([executable]..addAll(arguments)) |
| 160 .map(escapeCommandLineArgument).join(' '); | 131 .map(escapeCommandLineArgument).join(' '); |
| 161 if (workingDirectory != null) { | 132 if (workingDirectory != null) { |
| 162 command = "$command (working directory: $workingDirectory)"; | 133 command = "$command (working directory: $workingDirectory)"; |
| 163 } | 134 } |
| 164 return command; | 135 return command; |
| 165 } | 136 } |
| 166 | 137 |
| 167 Future<bool> get outputIsUpToDate => new Future.value(false); | 138 Future<bool> get outputIsUpToDate => new Future.value(false); |
| 168 } | 139 } |
| 169 | 140 |
| 170 class CompilationCommand extends ProcessCommand { | 141 class CompilationCommand extends ProcessCommand { |
| 171 String _outputFile; | 142 final String _outputFile; |
| 172 bool _neverSkipCompilation; | 143 final bool _neverSkipCompilation; |
| 173 List<Uri> _bootstrapDependencies; | 144 final List<Uri> _bootstrapDependencies; |
| 174 | 145 |
| 175 CompilationCommand._(String displayName, | 146 CompilationCommand._(String displayName, |
| 176 this._outputFile, | 147 this._outputFile, |
| 177 this._neverSkipCompilation, | 148 this._neverSkipCompilation, |
| 178 List<Uri> bootstrapDependencies, | 149 this._bootstrapDependencies, |
| 179 String executable, | 150 String executable, |
| 180 List<String> arguments, | 151 List<String> arguments, |
| 181 Map<String, String> environmentOverrides) | 152 Map<String, String> environmentOverrides) |
| 182 : super._(displayName, executable, arguments, environmentOverrides) { | 153 : super._(displayName, executable, arguments, environmentOverrides); |
| 183 // We sort here, so we can do a fast hashCode/operator== | |
| 184 _bootstrapDependencies = new List.from(bootstrapDependencies); | |
| 185 _bootstrapDependencies.sort(); | |
| 186 } | |
| 187 | 154 |
| 188 Future<bool> get outputIsUpToDate { | 155 Future<bool> get outputIsUpToDate { |
| 189 if (_neverSkipCompilation) return new Future.value(false); | 156 if (_neverSkipCompilation) return new Future.value(false); |
| 190 | 157 |
| 191 Future<List<Uri>> readDepsFile(String path) { | 158 Future<List<Uri>> readDepsFile(String path) { |
| 192 var file = new io.File(new Path(path).toNativePath()); | 159 var file = new io.File(new Path(path).toNativePath()); |
| 193 if (!file.existsSync()) { | 160 if (!file.existsSync()) { |
| 194 return new Future.value(null); | 161 return new Future.value(null); |
| 195 } | 162 } |
| 196 return file.readAsLines().then((List<String> lines) { | 163 return file.readAsLines().then((List<String> lines) { |
| (...skipping 24 matching lines...) Expand all Loading... |
| 221 } | 188 } |
| 222 return true; | 189 return true; |
| 223 } | 190 } |
| 224 } | 191 } |
| 225 return false; | 192 return false; |
| 226 }); | 193 }); |
| 227 } | 194 } |
| 228 | 195 |
| 229 void _buildHashCode(HashCodeBuilder builder) { | 196 void _buildHashCode(HashCodeBuilder builder) { |
| 230 super._buildHashCode(builder); | 197 super._buildHashCode(builder); |
| 231 builder.add(_outputFile); | 198 builder.addJson(_outputFile); |
| 232 builder.add(_neverSkipCompilation); | 199 builder.addJson(_neverSkipCompilation); |
| 233 for (var uri in _bootstrapDependencies) builder.add(uri); | 200 builder.addJson(_bootstrapDependencies); |
| 234 } | 201 } |
| 235 | 202 |
| 236 bool _equal(Command other) { | 203 bool _equal(CompilationCommand other) => |
| 237 if (other is CompilationCommand && | 204 super._equal(other) && |
| 238 super._equal(other) && | 205 _outputFile == other._outputFile && |
| 239 _outputFile == other._outputFile && | 206 _neverSkipCompilation == other._neverSkipCompilation && |
| 240 _neverSkipCompilation == other._neverSkipCompilation && | 207 deepJsonCompare(_bootstrapDependencies, other._bootstrapDependencies); |
| 241 _bootstrapDependencies.length == other._bootstrapDependencies.length) { | 208 } |
| 242 for (var i = 0; i < _bootstrapDependencies.length; i++) { | 209 |
| 243 if (_bootstrapDependencies[i] != other._bootstrapDependencies[i]) { | 210 /// This is just a Pair(String, Map) class with hashCode and operator == |
| 244 return false; | 211 class AddFlagsKey { |
| 245 } | 212 final String flags; |
| 246 } | 213 final Map env; |
| 247 return true; | 214 AddFlagsKey(this.flags, this.env); |
| 248 } | 215 // Just use object identity for environment map |
| 249 return false; | 216 bool operator ==(other) => |
| 250 } | 217 other is AddFlagsKey && flags == other.flags && env == other.env; |
| 218 int get hashCode => flags.hashCode ^ env.hashCode; |
| 251 } | 219 } |
| 252 | 220 |
| 253 class ContentShellCommand extends ProcessCommand { | 221 class ContentShellCommand extends ProcessCommand { |
| 254 ContentShellCommand._(String executable, | 222 ContentShellCommand._(String executable, |
| 255 String htmlFile, | 223 String htmlFile, |
| 256 List<String> options, | 224 List<String> options, |
| 257 List<String> dartFlags, | 225 List<String> dartFlags, |
| 258 Map<String, String> environmentOverrides) | 226 Map<String, String> environmentOverrides) |
| 259 : super._("content_shell", | 227 : super._("content_shell", |
| 260 executable, | 228 executable, |
| 261 _getArguments(options, htmlFile), | 229 _getArguments(options, htmlFile), |
| 262 _getEnvironment(environmentOverrides, dartFlags)); | 230 _getEnvironment(environmentOverrides, dartFlags)); |
| 263 | 231 |
| 264 static Map _getEnvironment(Map<String, String> env, List<String> dartFlags) { | 232 // Cache the modified environments in a map from the old environment and |
| 233 // the string of Dart flags to the new environment. Avoid creating new |
| 234 // environment object for each command object. |
| 235 static Map<AddFlagsKey, Map> environments = |
| 236 new Map<AddFlagsKey, Map>(); |
| 237 |
| 238 static Map _getEnvironment(Map env, List<String> dartFlags) { |
| 265 var needDartFlags = dartFlags != null && dartFlags.length > 0; | 239 var needDartFlags = dartFlags != null && dartFlags.length > 0; |
| 266 | |
| 267 if (needDartFlags) { | 240 if (needDartFlags) { |
| 268 if (env != null) { | 241 if (env == null) { |
| 269 env = new Map<String, String>.from(env); | 242 env = const { }; |
| 270 } else { | |
| 271 env = new Map<String, String>(); | |
| 272 } | 243 } |
| 273 env['DART_FLAGS'] = dartFlags.join(" "); | 244 var flags = dartFlags.join(' '); |
| 274 env['DART_FORWARDING_PRINT'] = '1'; | 245 return environments.putIfAbsent(new AddFlagsKey(flags, env), |
| 246 () => new Map.from(env) |
| 247 ..addAll({'DART_FLAGS': flags, 'DART_FORWARDING_PRINT': '1'})); |
| 275 } | 248 } |
| 276 | |
| 277 return env; | 249 return env; |
| 278 } | 250 } |
| 279 | 251 |
| 280 static List<String> _getArguments(List<String> options, String htmlFile) { | 252 static List<String> _getArguments(List<String> options, String htmlFile) { |
| 281 var arguments = new List.from(options); | 253 var arguments = new List.from(options); |
| 282 arguments.add(htmlFile); | 254 arguments.add(htmlFile); |
| 283 return arguments; | 255 return arguments; |
| 284 } | 256 } |
| 285 | 257 |
| 286 bool _equal(Command other) { | |
| 287 return other is ContentShellCommand && super._equal(other); | |
| 288 } | |
| 289 | |
| 290 int get maxNumRetries => 3; | 258 int get maxNumRetries => 3; |
| 291 } | 259 } |
| 292 | 260 |
| 293 class BrowserTestCommand extends Command { | 261 class BrowserTestCommand extends Command { |
| 294 final String browser; | 262 final String browser; |
| 295 final String url; | 263 final String url; |
| 296 final Map configuration; | 264 final Map configuration; |
| 297 | 265 |
| 298 BrowserTestCommand._(String _browser, | 266 BrowserTestCommand._(String _browser, |
| 299 this.url, | 267 this.url, |
| 300 this.configuration) | 268 this.configuration) |
| 301 : super._(_browser), browser = _browser; | 269 : super._(_browser), browser = _browser; |
| 302 | 270 |
| 303 void _buildHashCode(HashCodeBuilder builder) { | 271 void _buildHashCode(HashCodeBuilder builder) { |
| 304 super._buildHashCode(builder); | 272 super._buildHashCode(builder); |
| 305 builder.add(browser); | 273 builder.addJson(browser); |
| 306 builder.add(url); | 274 builder.addJson(url); |
| 307 builder.add(configuration); | 275 builder.add(configuration); |
| 308 } | 276 } |
| 309 | 277 |
| 310 bool _equal(Command other) { | 278 bool _equal(BrowserTestCommand other) => |
| 311 return | 279 super._equal(other) && |
| 312 other is BrowserTestCommand && | 280 browser == other.browser && |
| 313 super._equal(other) && | 281 url == other.url && |
| 314 browser == other.browser && | 282 identical(configuration, other.configuration); |
| 315 url == other.url && | |
| 316 identical(configuration, other.configuration); | |
| 317 } | |
| 318 | 283 |
| 319 String get reproductionCommand { | 284 String get reproductionCommand { |
| 320 var parts = [TestUtils.dartTestExecutable.toString(), | 285 var parts = [TestUtils.dartTestExecutable.toString(), |
| 321 'tools/testing/dart/launch_browser.dart', | 286 'tools/testing/dart/launch_browser.dart', |
| 322 browser, | 287 browser, |
| 323 url]; | 288 url]; |
| 324 return parts.map(escapeCommandLineArgument).join(' '); | 289 return parts.map(escapeCommandLineArgument).join(' '); |
| 325 } | 290 } |
| 326 } | 291 } |
| 327 | 292 |
| 328 class AnalysisCommand extends ProcessCommand { | 293 class AnalysisCommand extends ProcessCommand { |
| 329 final String flavor; | 294 final String flavor; |
| 330 | 295 |
| 331 AnalysisCommand._(this.flavor, | 296 AnalysisCommand._(this.flavor, |
| 332 String displayName, | 297 String displayName, |
| 333 String executable, | 298 String executable, |
| 334 List<String> arguments, | 299 List<String> arguments, |
| 335 Map<String, String> environmentOverrides) | 300 Map<String, String> environmentOverrides) |
| 336 : super._(displayName, executable, arguments, environmentOverrides); | 301 : super._(displayName, executable, arguments, environmentOverrides); |
| 337 | 302 |
| 338 void _buildHashCode(HashCodeBuilder builder) { | 303 void _buildHashCode(HashCodeBuilder builder) { |
| 339 super._buildHashCode(builder); | 304 super._buildHashCode(builder); |
| 340 builder.add(flavor); | 305 builder.addJson(flavor); |
| 341 } | 306 } |
| 342 | 307 |
| 343 bool _equal(Command other) { | 308 bool _equal(AnalysisCommand other) => |
| 344 return | 309 super._equal(other) && |
| 345 other is AnalysisCommand && | 310 flavor == other.flavor; |
| 346 super._equal(other) && | |
| 347 flavor == other.flavor; | |
| 348 } | |
| 349 } | 311 } |
| 350 | 312 |
| 351 class VmCommand extends ProcessCommand { | 313 class VmCommand extends ProcessCommand { |
| 352 VmCommand._(String executable, | 314 VmCommand._(String executable, |
| 353 List<String> arguments, | 315 List<String> arguments, |
| 354 Map<String,String> environmentOverrides) | 316 Map<String,String> environmentOverrides) |
| 355 : super._("vm", executable, arguments, environmentOverrides); | 317 : super._("vm", executable, arguments, environmentOverrides); |
| 356 } | 318 } |
| 357 | 319 |
| 358 class JSCommandlineCommand extends ProcessCommand { | 320 class JSCommandlineCommand extends ProcessCommand { |
| (...skipping 15 matching lines...) Expand all Loading... |
| 374 String pubspecYamlDirectory, | 336 String pubspecYamlDirectory, |
| 375 String pubCacheDirectory) | 337 String pubCacheDirectory) |
| 376 : super._('pub_$pubCommand', | 338 : super._('pub_$pubCommand', |
| 377 new io.File(pubExecutable).absolute.path, | 339 new io.File(pubExecutable).absolute.path, |
| 378 [pubCommand], | 340 [pubCommand], |
| 379 {'PUB_CACHE' : pubCacheDirectory}, | 341 {'PUB_CACHE' : pubCacheDirectory}, |
| 380 pubspecYamlDirectory), command = pubCommand; | 342 pubspecYamlDirectory), command = pubCommand; |
| 381 | 343 |
| 382 void _buildHashCode(HashCodeBuilder builder) { | 344 void _buildHashCode(HashCodeBuilder builder) { |
| 383 super._buildHashCode(builder); | 345 super._buildHashCode(builder); |
| 384 builder.add(command); | 346 builder.addJson(command); |
| 385 } | 347 } |
| 386 | 348 |
| 387 bool _equal(Command other) { | 349 bool _equal(PubCommand other) => |
| 388 return | 350 super._equal(other) && |
| 389 other is PubCommand && | 351 command == other.command; |
| 390 super._equal(other) && | |
| 391 command == other.command; | |
| 392 } | |
| 393 } | 352 } |
| 394 | 353 |
| 395 /* [ScriptCommand]s are executed by dart code. */ | 354 /* [ScriptCommand]s are executed by dart code. */ |
| 396 abstract class ScriptCommand extends Command { | 355 abstract class ScriptCommand extends Command { |
| 397 ScriptCommand._(String displayName) : super._(displayName); | 356 ScriptCommand._(String displayName) : super._(displayName); |
| 398 | 357 |
| 399 Future<ScriptCommandOutputImpl> run(); | 358 Future<ScriptCommandOutputImpl> run(); |
| 400 } | 359 } |
| 401 | 360 |
| 402 class CleanDirectoryCopyCommand extends ScriptCommand { | 361 class CleanDirectoryCopyCommand extends ScriptCommand { |
| (...skipping 26 matching lines...) Expand all Loading... |
| 429 return new ScriptCommandOutputImpl( | 388 return new ScriptCommandOutputImpl( |
| 430 this, Expectation.PASS, "", watch.elapsed); | 389 this, Expectation.PASS, "", watch.elapsed); |
| 431 }).catchError((error) { | 390 }).catchError((error) { |
| 432 return new ScriptCommandOutputImpl( | 391 return new ScriptCommandOutputImpl( |
| 433 this, Expectation.FAIL, "An error occured: $error.", watch.elapsed); | 392 this, Expectation.FAIL, "An error occured: $error.", watch.elapsed); |
| 434 }); | 393 }); |
| 435 } | 394 } |
| 436 | 395 |
| 437 void _buildHashCode(HashCodeBuilder builder) { | 396 void _buildHashCode(HashCodeBuilder builder) { |
| 438 super._buildHashCode(builder); | 397 super._buildHashCode(builder); |
| 439 builder.add(_sourceDirectory); | 398 builder.addJson(_sourceDirectory); |
| 440 builder.add(_destinationDirectory); | 399 builder.addJson(_destinationDirectory); |
| 441 } | 400 } |
| 442 | 401 |
| 443 bool _equal(Command other) { | 402 bool _equal(CleanDirectoryCopyCommand other) => |
| 444 return | 403 super._equal(other) && |
| 445 other is CleanDirectoryCopyCommand && | 404 _sourceDirectory == other._sourceDirectory && |
| 446 super._equal(other) && | 405 _destinationDirectory == other._destinationDirectory; |
| 447 _sourceDirectory == other._sourceDirectory && | |
| 448 _destinationDirectory == other._destinationDirectory; | |
| 449 } | |
| 450 } | 406 } |
| 451 | 407 |
| 452 class ModifyPubspecYamlCommand extends ScriptCommand { | 408 class ModifyPubspecYamlCommand extends ScriptCommand { |
| 453 String _pubspecYamlFile; | 409 String _pubspecYamlFile; |
| 454 String _destinationFile; | 410 String _destinationFile; |
| 455 Map<String, Map> _dependencyOverrides; | 411 Map<String, Map> _dependencyOverrides; |
| 456 | 412 |
| 457 ModifyPubspecYamlCommand._(this._pubspecYamlFile, | 413 ModifyPubspecYamlCommand._(this._pubspecYamlFile, |
| 458 this._destinationFile, | 414 this._destinationFile, |
| 459 this._dependencyOverrides) | 415 this._dependencyOverrides) |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 503 return new ScriptCommandOutputImpl( | 459 return new ScriptCommandOutputImpl( |
| 504 this, Expectation.PASS, "", watch.elapsed); | 460 this, Expectation.PASS, "", watch.elapsed); |
| 505 }).catchError((error) { | 461 }).catchError((error) { |
| 506 return new ScriptCommandOutputImpl( | 462 return new ScriptCommandOutputImpl( |
| 507 this, Expectation.FAIL, "An error occured: $error.", watch.elapsed); | 463 this, Expectation.FAIL, "An error occured: $error.", watch.elapsed); |
| 508 }); | 464 }); |
| 509 } | 465 } |
| 510 | 466 |
| 511 void _buildHashCode(HashCodeBuilder builder) { | 467 void _buildHashCode(HashCodeBuilder builder) { |
| 512 super._buildHashCode(builder); | 468 super._buildHashCode(builder); |
| 513 builder.add(_pubspecYamlFile); | 469 builder.addJson(_pubspecYamlFile); |
| 514 builder.add(_destinationFile); | 470 builder.addJson(_destinationFile); |
| 515 builder.addJson(_dependencyOverrides); | 471 builder.addJson(_dependencyOverrides); |
| 516 } | 472 } |
| 517 | 473 |
| 518 bool _equal(Command other) { | 474 bool _equal(ModifyPubspecYamlCommand other) => |
| 519 return | 475 super._equal(other) && |
| 520 other is ModifyPubspecYamlCommand && | 476 _pubspecYamlFile == other._pubspecYamlFile && |
| 521 super._equal(other) && | 477 _destinationFile == other._destinationFile && |
| 522 _pubspecYamlFile == other._pubspecYamlFile && | 478 deepJsonCompare(_dependencyOverrides, other._dependencyOverrides); |
| 523 _destinationFile == other._destinationFile && | |
| 524 deepJsonCompare(_dependencyOverrides, other._dependencyOverrides); | |
| 525 } | |
| 526 } | 479 } |
| 527 | 480 |
| 528 /* | 481 /* |
| 529 * [MakeSymlinkCommand] makes a symbolic link to another directory. | 482 * [MakeSymlinkCommand] makes a symbolic link to another directory. |
| 530 */ | 483 */ |
| 531 class MakeSymlinkCommand extends ScriptCommand { | 484 class MakeSymlinkCommand extends ScriptCommand { |
| 532 String _link; | 485 String _link; |
| 533 String _target; | 486 String _target; |
| 534 | 487 |
| 535 MakeSymlinkCommand._(this._link, this._target) : super._('make_symlink'); | 488 MakeSymlinkCommand._(this._link, this._target) : super._('make_symlink'); |
| (...skipping 17 matching lines...) Expand all Loading... |
| 553 return new ScriptCommandOutputImpl( | 506 return new ScriptCommandOutputImpl( |
| 554 this, Expectation.PASS, "", watch.elapsed); | 507 this, Expectation.PASS, "", watch.elapsed); |
| 555 }).catchError((error) { | 508 }).catchError((error) { |
| 556 return new ScriptCommandOutputImpl( | 509 return new ScriptCommandOutputImpl( |
| 557 this, Expectation.FAIL, "An error occured: $error.", watch.elapsed); | 510 this, Expectation.FAIL, "An error occured: $error.", watch.elapsed); |
| 558 }); | 511 }); |
| 559 } | 512 } |
| 560 | 513 |
| 561 void _buildHashCode(HashCodeBuilder builder) { | 514 void _buildHashCode(HashCodeBuilder builder) { |
| 562 super._buildHashCode(builder); | 515 super._buildHashCode(builder); |
| 563 builder.add(_link); | 516 builder.addJson(_link); |
| 564 builder.add(_target); | 517 builder.addJson(_target); |
| 565 } | 518 } |
| 566 | 519 |
| 567 bool _equal(Command other) { | 520 bool _equal(MakeSymlinkCommand other) => |
| 568 return | 521 super._equal(other) && |
| 569 other is MakeSymlinkCommand && | 522 _link == other._link && |
| 570 super._equal(other) && | 523 _target == other._target; |
| 571 _link == other._link && | |
| 572 _target == other._target; | |
| 573 } | |
| 574 } | 524 } |
| 575 | 525 |
| 576 class CommandBuilder { | 526 class CommandBuilder { |
| 577 static final CommandBuilder instance = new CommandBuilder._(); | 527 static final CommandBuilder instance = new CommandBuilder._(); |
| 578 | 528 |
| 579 bool _cleared = false; | 529 bool _cleared = false; |
| 580 final _cachedCommands = new Map<Command, Command>(); | 530 final _cachedCommands = new Map<Command, Command>(); |
| 581 | 531 |
| 582 CommandBuilder._(); | 532 CommandBuilder._(); |
| 583 | 533 |
| (...skipping 2367 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2951 } | 2901 } |
| 2952 } | 2902 } |
| 2953 | 2903 |
| 2954 void eventAllTestsDone() { | 2904 void eventAllTestsDone() { |
| 2955 for (var listener in _eventListener) { | 2905 for (var listener in _eventListener) { |
| 2956 listener.allDone(); | 2906 listener.allDone(); |
| 2957 } | 2907 } |
| 2958 _allDone(); | 2908 _allDone(); |
| 2959 } | 2909 } |
| 2960 } | 2910 } |
| OLD | NEW |