| OLD | NEW |
| 1 #!/usr/bin/env dart | 1 #!/usr/bin/env dart |
| 2 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 2 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file |
| 3 // for details. All rights reserved. Use of this source code is governed by a | 3 // for details. All rights reserved. Use of this source code is governed by a |
| 4 // BSD-style license that can be found in the LICENSE file. | 4 // BSD-style license that can be found in the LICENSE file. |
| 5 | 5 |
| 6 /** | 6 /** |
| 7 * This file is the entrypoint of the dart test suite. This suite is used | 7 * This file is the entrypoint of the dart test suite. This suite is used |
| 8 * to test: | 8 * to test: |
| 9 * | 9 * |
| 10 * 1. the dart vm | 10 * 1. the dart vm |
| (...skipping 244 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 255 startProcessQueue(); | 255 startProcessQueue(); |
| 256 } else { | 256 } else { |
| 257 Future.wait(serverFutures).then((_) => startProcessQueue()); | 257 Future.wait(serverFutures).then((_) => startProcessQueue()); |
| 258 } | 258 } |
| 259 } | 259 } |
| 260 | 260 |
| 261 Future deleteTemporaryDartDirectories() { | 261 Future deleteTemporaryDartDirectories() { |
| 262 var completer = new Completer(); | 262 var completer = new Completer(); |
| 263 var environment = Platform.environment; | 263 var environment = Platform.environment; |
| 264 if (environment['DART_TESTING_DELETE_TEMPORARY_DIRECTORIES'] == '1') { | 264 if (environment['DART_TESTING_DELETE_TEMPORARY_DIRECTORIES'] == '1') { |
| 265 Directory getTempDir() { | 265 LeftOverTempDirPrinter.getLeftOverTemporaryDirectories().listen( |
| 266 // dir will be located in the system temporary directory. | 266 (Directory tempDirectory) { |
| 267 var dir = new Directory('').createTempSync(); | |
| 268 var path = new Path(dir.path).directoryPath; | |
| 269 dir.deleteSync(); | |
| 270 return new Directory(path.toNativePath()); | |
| 271 } | |
| 272 | |
| 273 // These are the patterns of temporary directory names created by | |
| 274 // 'Directory.createTempSync()' on linux/macos and windows. | |
| 275 var regExp; | |
| 276 if (['macos', 'linux'].contains(Platform.operatingSystem)) { | |
| 277 regExp = new RegExp(r'^temp_dir1_......$'); | |
| 278 } else { | |
| 279 regExp = new RegExp(r'tempdir-........-....-....-....-............$'); | |
| 280 } | |
| 281 | |
| 282 getTempDir().list().listen((directoryEntry) { | |
| 283 if (directoryEntry is Directory) { | |
| 284 if (regExp.hasMatch(new Path(directoryEntry.path).filename)) { | |
| 285 try { | 267 try { |
| 286 directoryEntry.deleteSync(recursive: true); | 268 tempDirectory.deleteSync(recursive: true); |
| 287 } catch (error) { | 269 } catch (error) { |
| 288 DebugLogger.error(error); | 270 DebugLogger.error(error); |
| 289 } | 271 } |
| 290 } | 272 }, onDone: completer.complete); |
| 291 } | |
| 292 }, onDone: completer.complete); | |
| 293 } else { | 273 } else { |
| 294 completer.complete(); | 274 completer.complete(); |
| 295 } | 275 } |
| 296 return completer.future; | 276 return completer.future; |
| 297 } | 277 } |
| 298 | 278 |
| 299 void main() { | 279 void main() { |
| 300 deleteTemporaryDartDirectories().then((_) { | 280 deleteTemporaryDartDirectories().then((_) { |
| 301 var optionsParser = new TestOptionsParser(); | 281 var optionsParser = new TestOptionsParser(); |
| 302 var configurations = optionsParser.parse(new Options().arguments); | 282 var configurations = optionsParser.parse(new Options().arguments); |
| 303 if (configurations != null && configurations.length > 0) { | 283 if (configurations != null && configurations.length > 0) { |
| 304 testConfigurations(configurations); | 284 testConfigurations(configurations); |
| 305 } | 285 } |
| 306 }); | 286 }); |
| 307 } | 287 } |
| 308 | 288 |
| OLD | NEW |