e60cbdfd9e
This CL:
* adds a test that runs the VM with old dills (compilations of dart2js
with old checkouts) with the --compile_all argument (1).
* adds a number of old dills (for binary version 25, 27, 28, 29)
(by mistake binary version 26 sort of didn't really happen)
* adds a PRESUBMIT check in kernel that verifies that we have an
"old dill" for the current binary version, so one don't bump the
version without creating a new dill.
(1): It uses --compile_all to force the VM to "read and understand"
everything in the dill file. The hope being that we try out
all/most language constructs and thus verifies that they can be
read by the VM.
Old "old dill" files should be removed once the VM stops supporting that
version. That is a manual process, but a test should complain that the VM
cannot read the old "old dill"(s) once/if that happens.
This should (help) detect errors such as the one recently where a merge
error caused a single "if >= 28" (that should have been "if >= 29" and
thus stopped the VM from reading dills from version 28) to slip through
and require a lot of debugging a few days later.
Change-Id: Id79e16c7ad896c0ccc4e181465b05b67822ac31a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/113698
Commit-Queue: Jens Johansen <jensj@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
63 lines
2.0 KiB
Dart
63 lines
2.0 KiB
Dart
// Copyright (c) 2019, the Dart project authors. Please see the AUTHORS file
|
|
// for details. All rights reserved. Use of this source code is governed by a
|
|
// BSD-style license that can be found in the LICENSE file.
|
|
|
|
import 'dart:io';
|
|
|
|
final String repoDir = _computeRepoDir();
|
|
|
|
String get dartVm => Platform.executable;
|
|
|
|
main(List<String> args) async {
|
|
Stopwatch stopwatch = new Stopwatch()..start();
|
|
List<Future> futures = new List<Future>();
|
|
futures.add(run("pkg/front_end/test/old_dill_test.dart", ["--checkDill"]));
|
|
await Future.wait(futures);
|
|
print("\n-----------------------\n");
|
|
print("Done with exitcode $exitCode in ${stopwatch.elapsedMilliseconds} ms");
|
|
}
|
|
|
|
Future<void> run(String script, List<String> scriptArguments,
|
|
{bool filter: true}) async {
|
|
List<String> arguments = [];
|
|
arguments.add("$script");
|
|
arguments.addAll(scriptArguments);
|
|
|
|
Stopwatch stopwatch = new Stopwatch()..start();
|
|
ProcessResult result =
|
|
await Process.run(dartVm, arguments, workingDirectory: repoDir);
|
|
String runWhat = "${dartVm} ${arguments.join(' ')}";
|
|
if (result.exitCode != 0) {
|
|
exitCode = result.exitCode;
|
|
print("-----");
|
|
print("Running: $runWhat: "
|
|
"Failed with exit code ${result.exitCode} "
|
|
"in ${stopwatch.elapsedMilliseconds} ms.");
|
|
String stdout = result.stdout.toString();
|
|
if (filter) {
|
|
List<String> lines = stdout.split("\n");
|
|
int lastIgnored = -1;
|
|
for (int i = 0; i < lines.length; i++) {
|
|
if (lines[i].startsWith("[ ")) lastIgnored = i;
|
|
}
|
|
lines.removeRange(0, lastIgnored + 1);
|
|
stdout = lines.join("\n");
|
|
}
|
|
stdout = stdout.trim();
|
|
if (stdout.isNotEmpty) {
|
|
print(stdout);
|
|
print("-----");
|
|
}
|
|
} else {
|
|
print("Running: $runWhat: Done in ${stopwatch.elapsedMilliseconds} ms.");
|
|
}
|
|
}
|
|
|
|
String _computeRepoDir() {
|
|
ProcessResult result = Process.runSync(
|
|
'git', ['rev-parse', '--show-toplevel'],
|
|
runInShell: true,
|
|
workingDirectory: new File.fromUri(Platform.script).parent.path);
|
|
return (result.stdout as String).trim();
|
|
}
|