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

Side by Side Diff: tools/test.dart

Issue 14244009: Support for removing left over temporary directories from dart processes (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 8 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 | « no previous file | 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 #!/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
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') {
239 testConfigurations(configurations); 239 Directory getTempDir() {
240 // dir will be located in the system temporary directory.
241 var dir = new Directory('').createTempSync();
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) {
262 DebugLogger.error(error);
263 }
264 }
265 }
266 }, onDone: completer.complete());
267 } else {
268 completer.complete();
240 } 269 }
270 return completer.future;
241 } 271 }
242 272
273 void main() {
274 deleteTemporaryDartDirectories().then((_) {
275 var optionsParser = new TestOptionsParser();
276 var configurations = optionsParser.parse(new Options().arguments);
277 if (configurations != null && configurations.length > 0) {
278 testConfigurations(configurations);
279 }
280 });
281 }
282
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698