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

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

Issue 11369216: Added support for skipping redundant dart2js compilations. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 years, 1 month 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: tools/testing/dart/test_runner.dart
diff --git a/tools/testing/dart/test_runner.dart b/tools/testing/dart/test_runner.dart
index 482b7fdd6389b6c58d0c1f3883282fc7496af6b9..a88be1a71be33afe7113e5816282ad8c8d43b561 100644
--- a/tools/testing/dart/test_runner.dart
+++ b/tools/testing/dart/test_runner.dart
@@ -13,6 +13,7 @@
#import("dart:io");
#import("dart:isolate");
+#import("dart:uri");
#import("status_file_parser.dart");
#import("test_progress.dart");
#import("test_suite.dart");
@@ -46,6 +47,54 @@ class Command {
}
String toString() => commandLine;
+
+ bool get outputIsUpToDate => false;
+}
+
+class Dart2JsCommand extends Command {
+ String _jsOutFile;
ahe 2012/11/14 18:46:16 We try to avoid abbreviating. So this should be _
kustermann 2012/11/16 14:58:42 Done.
+ bool _neverSkipCompilation;
+ List<Uri> _bootstrapDeps;
ahe 2012/11/14 18:46:16 _bootstrapDependencies
kustermann 2012/11/16 14:58:42 Done.
+
+ Dart2JsCommand(String this._jsOutFile, bool this._neverSkipCompilation,
ricow1 2012/11/14 08:53:28 I know that not all of our code is actually strict
ahe 2012/11/14 18:46:16 Remove types from this.field parameters. They are
kustermann 2012/11/16 14:58:42 Done.
kustermann 2012/11/16 14:58:42 Done.
+ List<Uri> this._bootstrapDeps, String executable, List<String> arguments)
+ : super(executable, arguments);
+
+ bool get outputIsUpToDate {
+ if (_neverSkipCompilation) return false;
+
+ List<Uri> readDepsFile(String path) {
ricow1 2012/11/14 08:53:28 I think we should make this asynchronious
ahe 2012/11/14 18:46:16 Using the word "deps" file is fine in this case, b
kustermann 2012/11/16 14:58:42 Done.
+ var file = new File(path);
+ if (!file.existsSync()) {
+ return null;
+ }
+ var deps = new List<Uri>();
ahe 2012/11/14 18:46:16 But these are dependencies :-)
kustermann 2012/11/16 14:58:42 Done.
+ for (var line in file.readAsLinesSync()) {
+ line = line.trim();
+ if (line.length > 0) {
+ deps.add(new Uri(line));
+ }
+ }
+ return deps;
+ }
+
+ var deps = readDepsFile("$_jsOutFile.deps");
ahe 2012/11/14 18:46:16 dependencies
kustermann 2012/11/16 14:58:42 Done.
+ if (deps != null) {
+ deps.addAll(_bootstrapDeps);
+ var jsOutTimestamp = TestUtils.timestampCache.getTimeStamp(
ahe 2012/11/14 18:46:16 jsOutput...
kustermann 2012/11/16 14:58:42 Done.
+ new Uri("file://$_jsOutFile"));
ahe 2012/11/14 18:46:16 How do you ensure this is a valid file URI? See:
kustermann 2012/11/16 14:58:42 "StandardTestSuite.{makeCommands,_compileCommand}"
+ if (jsOutTimestamp != null) {
+ for (var dep in deps) {
+ var depTs = TestUtils.timestampCache.getTimeStamp(dep);
ahe 2012/11/14 18:46:16 In this case, abbreviation makes it really hard to
kustermann 2012/11/16 14:58:42 Done. But: Very often, longer names result in line
+ if (depTs == null || depTs > jsOutTimestamp) {
+ return false;
+ }
+ }
+ return true;
+ }
+ }
+ return false;
+ }
}
/**
@@ -706,6 +755,20 @@ class RunningProcess {
}
void runCommand(Command command, void exitHandler(int exitCode)) {
+ if (command.outputIsUpToDate) {
+ // NOTE: we need to have the same async + timeout handler behaviour as below
ricow1 2012/11/14 08:53:28 long line
kustermann 2012/11/16 14:58:42 Done.
+ // otherwise we risk breaking code.
ahe 2012/11/14 18:46:16 Only one space after //.
kustermann 2012/11/16 14:58:42 Done.
+ timeoutTimer = new Timer(1000 * testCase.timeout, timeoutHandler);
+ new Timer(0, (ignored) {
ahe 2012/11/14 18:46:16 You could avoid this if command.outputIsUpToDate r
kustermann 2012/11/16 14:58:42 Done.
+ stdout.add("Skipped dart2js compilation because the old output is still up to date!");
ricow1 2012/11/14 08:53:28 long line
kustermann 2012/11/16 14:58:42 Done.
+ if (processQueue != null) {
Bill Hesse 2012/11/14 09:37:34 We don't ever get to this point without a processQ
kustermann 2012/11/16 14:58:42 Actually the test tests/standalone/io/test_runner
+ processQueue.logSkippedCompilation();
Bill Hesse 2012/11/14 09:37:34 Other information gets to the progress indicator b
kustermann 2012/11/16 14:58:42 Done.
+ }
+ exitHandler(0);
+ });
+ return;
+ }
+
Future processFuture = Process.start(command.executable, command.arguments);
processFuture.then((Process p) {
process = p;
@@ -1079,6 +1142,10 @@ class ProcessQueue {
testSuite.forEachTest(_runTest, _testCache, _testListerDone);
}
+ void logSkippedCompilation() {
+ _progress.skippedCompilation();
+ }
+
void _testListerDone() {
_activeTestListers--;
_checkDone();

Powered by Google App Engine
This is Rietveld 408576698