Index: tools/testing/dart/test_suite.dart |
diff --git a/tools/testing/dart/test_suite.dart b/tools/testing/dart/test_suite.dart |
index 21a99a82c2a4462556dd8d0e0ec78537907c7993..56ed6bae16de935191796184221b97f38e703032 100644 |
--- a/tools/testing/dart/test_suite.dart |
+++ b/tools/testing/dart/test_suite.dart |
@@ -16,6 +16,7 @@ library test_suite; |
import "dart:async"; |
import "dart:io"; |
+import "dart:math"; |
import "drt_updater.dart"; |
import "html_test.dart" as htmlTest; |
import "path.dart"; |
@@ -2149,6 +2150,7 @@ class TestUtils { |
dartDirUri = uri; |
dartDir = new Path(uri.toFilePath()); |
} |
+ static Random rand = new Random.secure(); |
static Uri dartDirUri; |
static Path dartDir; |
static LastModifiedCache lastModifiedCache = new LastModifiedCache(); |
@@ -2157,6 +2159,13 @@ class TestUtils { |
new Path(Directory.current.path); |
/** |
+ * Generates a random number. |
+ */ |
+ static int getRandomNumber() { |
+ return rand.nextInt(0xffffffff); |
+ } |
+ |
+ /** |
* Creates a directory using a [relativePath] to an existing |
* [base] directory if that [relativePath] does not already exist. |
*/ |
@@ -2232,6 +2241,22 @@ class TestUtils { |
} |
} |
+ static deleteTempSnapshotDirectory(Map configuration) { |
+ if (configuration['compiler'] == 'dart2app') { |
+ var checked = configuration['checked'] ? '-checked' : ''; |
+ var minified = configuration['minified'] ? '-minified' : ''; |
+ var csp = configuration['csp'] ? '-csp' : ''; |
+ var sdk = configuration['use_sdk'] ? '-sdk' : ''; |
+ var packages = configuration['use_public_packages'] |
+ ? '-public_packages' : ''; |
+ var dirName = "${configuration['compiler']}" |
+ "$checked$minified$csp$packages$sdk"; |
+ String generatedPath = "${TestUtils.buildDir(configuration)}" |
+ "/generated_compilations/$dirName"; |
+ TestUtils.deleteDirectory(generatedPath); |
+ } |
+ } |
+ |
static Path debugLogfile() { |
return new Path(".debug.log"); |
} |