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

Unified Diff: dart/tools/testing/dart/multitest.dart

Issue 52113003: Only generate multitests if content changed, enables us to dart2js compilations for multitests (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 7 years, 2 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: dart/tools/testing/dart/multitest.dart
diff --git a/dart/tools/testing/dart/multitest.dart b/dart/tools/testing/dart/multitest.dart
index 197e850f5bca934edc90b1aa650807c42a4cdeef..e61f21bee42234e9b97fdca943ad02bdd1df735c 100644
--- a/dart/tools/testing/dart/multitest.dart
+++ b/dart/tools/testing/dart/multitest.dart
@@ -192,6 +192,19 @@ Set<String> _findAllRelativeImports(Path topLibrary) {
Future doMultitest(Path filePath, String outputDir, Path suiteDir,
CreateTest doTest) {
+ void writeFile(String filepath, String content) {
+ final File file = new File(filepath);
+
+ if (file.existsSync()) {
+ var oldContent = file.readAsStringSync();
+ if (oldContent == content) {
+ // Don't write to the file if the content is the same
+ return;
+ }
+ }
+ file.writeAsStringSync(content);
+ }
+
// Each new test is a single String value in the Map tests.
Map<String, String> tests = new Map<String, String>();
Map<String, Set<String>> outcomes = new Map<String, Set<String>>();
@@ -222,12 +235,7 @@ Future doMultitest(Path filePath, String outputDir, Path suiteDir,
for (String key in tests.keys) {
final Path multitestFilename =
targetDir.append('${baseFilename}_$key.dart');
- final File file = new File(multitestFilename.toNativePath());
-
- file.createSync();
- RandomAccessFile openedFile = file.openSync(mode: FileMode.WRITE);
- openedFile.writeStringSync(tests[key]);
- openedFile.closeSync();
+ writeFile(multitestFilename.toNativePath(), tests[key]);
Set<String> outcome = outcomes[key];
bool hasStaticWarning = outcome.contains('static type warning');
bool hasRuntimeErrors = outcome.contains('runtime error');
« 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