Chromium Code Reviews| 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 214 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 225 } | 225 } |
| 226 | 226 |
| 227 // Start all the HTTP servers required before starting the process queue. | 227 // Start all the HTTP servers required before starting the process queue. |
| 228 if (serverFutures.isEmpty) { | 228 if (serverFutures.isEmpty) { |
| 229 startProcessQueue(); | 229 startProcessQueue(); |
| 230 } else { | 230 } else { |
| 231 Future.wait(serverFutures).then((_) => startProcessQueue()); | 231 Future.wait(serverFutures).then((_) => startProcessQueue()); |
| 232 } | 232 } |
| 233 } | 233 } |
| 234 | 234 |
| 235 void main() { | 235 Future deleteTemporaryDartDirectories() { |
| 236 var optionsParser = new TestOptionsParser(); | 236 var completer = new Completer(); |
| 237 var configurations = optionsParser.parse(new Options().arguments); | 237 var environment = Platform.environment; |
| 238 if (configurations != null && configurations.length > 0) { | 238 if (environment['DART_TESTING_DELETE_TEMPORARY_DIRECTORIES'] == '1') { |
|
ahe
2013/04/17 15:08:13
if (environment['DART_TESTING_DELETE_TEMPORARY_DIR
kustermann
2013/04/18 09:24:08
Unfortunatly, I saw that comment too late. I commi
| |
| 239 testConfigurations(configurations); | 239 Directory getTempDir() { |
| 240 // dir will be located in the system temporary directory. | |
| 241 var dir = new Directory('').createTempSync(); | |
|
ahe
2013/04/17 15:08:13
I don't understand why it is OK to use synchronous
kustermann
2013/04/18 09:24:08
I don't understand why we have to use async API he
ahe
2013/04/18 09:26:44
Why are you using async API then? Why does delete
| |
| 242 var path = new Path(dir.path).directoryPath; | |
| 243 dir.deleteSync(); | |
| 244 return new Directory.fromPath(path); | |
| 245 } | |
| 246 | |
| 247 // These are the patterns of temporary directory names created by | |
| 248 // 'Directory.createTempSync()' on linux/macos and windows. | |
| 249 var regExp; | |
| 250 if (['macos', 'linux'].contains(Platform.operatingSystem)) { | |
| 251 regExp = new RegExp(r'^temp_dir1_......$'); | |
| 252 } else { | |
| 253 regExp = new RegExp(r'tempdir-........-....-....-....-............$'); | |
| 254 } | |
| 255 | |
| 256 getTempDir().list().listen((directoryEntry) { | |
| 257 if (directoryEntry is Directory) { | |
| 258 if (regExp.hasMatch(new Path(directoryEntry.path).filename)) { | |
| 259 try { | |
| 260 directoryEntry.deleteSync(recursive: true); | |
| 261 } catch (error) {} | |
|
ricow1
2013/04/15 13:35:47
maybe print this to our debug log?
kustermann
2013/04/17 14:04:49
I can do it, but then people will get these messag
ahe
2013/04/17 15:08:13
Never ever catch all exceptions and ignore them :-
kustermann
2013/04/18 09:24:08
I added a DebugLogger.error() statment now.
| |
| 262 } | |
| 263 } | |
| 264 }, onDone: completer.complete(null)); | |
|
ricow1
2013/04/15 13:35:47
don't give argument to complete
kustermann
2013/04/17 14:04:49
Done.
| |
| 265 } else { | |
| 266 completer.complete(null); | |
|
ricow1
2013/04/15 13:35:47
no need to return null here
kustermann
2013/04/17 14:04:49
Done.
| |
| 240 } | 267 } |
| 268 return completer.future; | |
| 241 } | 269 } |
| 242 | 270 |
| 271 void main() { | |
| 272 deleteTemporaryDartDirectories().then((_) { | |
|
ricow1
2013/04/15 13:35:47
remove argument in closure
kustermann
2013/04/17 14:04:49
Future.then takes a closure with exactly one argum
ricow1
2013/04/18 07:07:59
Yes that is true
| |
| 273 var optionsParser = new TestOptionsParser(); | |
| 274 var configurations = optionsParser.parse(new Options().arguments); | |
| 275 if (configurations != null && configurations.length > 0) { | |
| 276 testConfigurations(configurations); | |
| 277 } | |
| 278 }); | |
| 279 } | |
| 280 | |
| OLD | NEW |