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

Unified Diff: tests/standalone/io/skipping_dart2js_compilations_test.dart

Issue 256743009: Cache output of dart2js compilations that went wrong on disk. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 6 years, 7 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
Index: tests/standalone/io/skipping_dart2js_compilations_test.dart
===================================================================
--- tests/standalone/io/skipping_dart2js_compilations_test.dart (revision 36157)
+++ tests/standalone/io/skipping_dart2js_compilations_test.dart (working copy)
@@ -17,6 +17,7 @@
import 'package:expect/expect.dart';
import 'package:path/path.dart';
import 'dart:async';
+import 'dart:convert';
import 'dart:io';
import '../../../tools/testing/dart/test_suite.dart' as suite;
import '../../../tools/testing/dart/test_runner.dart' as runner;
@@ -34,11 +35,13 @@
File testJsDeps;
File testDart;
File testSnapshot;
+ File testCachedOutput;
FileUtils({bool createJs,
bool createJsDeps,
bool createDart,
- bool createSnapshot}) {
+ bool createSnapshot,
+ bool createCachedOutput}) {
tempDir = Directory.systemTemp
.createTempSync('dart_skipping_dart2js_compilations');
if (createJs) {
@@ -59,6 +62,17 @@
.append("test.dart");
_writeToFile(testJsDeps, "file://$path");
}
+ if (createCachedOutput) {
+ testCachedOutput = _createFile(testCachedOutputPath);
+ var content = JSON.encode({
+ 'stdout': '',
+ 'stderr': '',
+ 'exitCode': 0,
+ 'timedOut': false
+ });
+ _writeToFile(testCachedOutput, content);
+ }
+
}
void cleanup() {
@@ -66,12 +80,19 @@
if (testJsDeps != null) testJsDeps.deleteSync();
if (testDart != null) testDart.deleteSync();
if (testSnapshot != null) testSnapshot.deleteSync();
+ if (testCachedOutput != null) testCachedOutput.deleteSync();
- // if the script did run, it created this file, so we need to delete it
+ // If the script did run, it created this file, so we need to delete it
+ // We also need to delete the cached output which will always be there if
+ // we ran.
File file = new File(scriptOutputPath.toNativePath());
if (file.existsSync()) {
file.deleteSync();
}
+ File cacheFile = new File(testCachedOutputPath.toNativePath());
+ if (cacheFile.existsSync()) {
+ cacheFile.deleteSync();
+ }
tempDir.deleteSync();
}
@@ -96,6 +117,11 @@
.append('test.js.deps'));
}
+ Path get testCachedOutputPath {
+ return suite.TestUtils.absolutePath(new Path(tempDir.path)
+ .append('test.js.cached_output'));
+ }
+
Path get testSnapshotFilePath {
return suite.TestUtils.absolutePath(new Path(tempDir.path)
.append('test_dart2js.snapshot'));
@@ -134,6 +160,8 @@
void processCompletedTest(runner.CommandOutput output) {
Expect.isTrue(output.exitCode == 0);
+ if (output.stderr.length > 0)
+ print(output.stderr);
Expect.isTrue(output.stderr.length == 0);
if (_shouldHaveRun) {
Expect.isTrue(output.stdout.length == 0);
@@ -142,6 +170,8 @@
} else {
Expect.isFalse(new File(fileUtils.scriptOutputPath.toNativePath())
.existsSync());
+ Expect.isTrue(new File(fileUtils.testCachedOutputPath.toNativePath())
+ .existsSync());
}
}
}
@@ -167,31 +197,38 @@
var fs_noTestJs = new FileUtils(createJs: false,
createJsDeps: true,
createDart: true,
- createSnapshot: true);
+ createSnapshot: true,
+ createCachedOutput: false);
var fs_noTestJsDeps = new FileUtils(createJs: true,
createJsDeps: false,
createDart: true,
- createSnapshot: true);
+ createSnapshot: true,
+ createCachedOutput: true);
var fs_noTestDart = new FileUtils(createJs: true,
createJsDeps: true,
createDart: false,
- createSnapshot: true);
+ createSnapshot: true,
+ createCachedOutput: true);
var fs_noTestSnapshot = new FileUtils(createJs: true,
createJsDeps: true,
createDart: true,
- createSnapshot: false);
+ createSnapshot: false,
+ createCachedOutput: true);
var fs_notUpToDate_snapshot = new FileUtils(createJs: true,
createJsDeps: true,
createDart: true,
- createSnapshot: true);
+ createSnapshot: true,
+ createCachedOutput: true);
var fs_notUpToDate_dart = new FileUtils(createJs: true,
createJsDeps: true,
createDart: true,
- createSnapshot: true);
+ createSnapshot: true,
+ createCachedOutput: true);
var fs_upToDate = new FileUtils(createJs: true,
createJsDeps: true,
createDart: true,
- createSnapshot: true);
+ createSnapshot: true,
+ createCachedOutput: true);
void cleanup() {
fs_noTestJs.cleanup();
fs_noTestJsDeps.cleanup();
@@ -212,6 +249,7 @@
var command = makeCompilationCommand(name, fileUtils);
var process = new runner.RunningProcess(command, 60);
return process.run().then((runner.CommandOutput output) {
+ print(name);
completedHandler.processCompletedTest(output);
});
}
« no previous file with comments | « sdk/lib/_internal/compiler/implementation/source_file_provider.dart ('k') | tools/testing/dart/multitest.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698