Version 2.0.0-dev.0.1
Cherry-pick commit 913d828db0fd5ac7113f4a28ff696566ab3bb3d3 into dev
diff --git a/runtime/bin/main_options.cc b/runtime/bin/main_options.cc
index 141b055..75194d7 100644
--- a/runtime/bin/main_options.cc
+++ b/runtime/bin/main_options.cc
@@ -425,6 +425,11 @@
return -1;
}
+ // If --snapshot is given without --snapshot-kind, default to script snapshot.
+ if ((snapshot_filename_ != NULL) && (gen_snapshot_kind_ == kNone)) {
+ gen_snapshot_kind_ = kScript;
+ }
+
return 0;
}
diff --git a/tests/standalone/script_snapshot_not_executed_test.dart b/tests/standalone/script_snapshot_not_executed_test.dart
new file mode 100644
index 0000000..f002270
--- /dev/null
+++ b/tests/standalone/script_snapshot_not_executed_test.dart
@@ -0,0 +1,51 @@
+// Copyright (c) 2017, 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";
+
+void main(List<String> args) {
+ if (args.contains("--child")) {
+ print("Hello, pre-scanned world!");
+ } else {
+ runSnapshot(generateSnapshot());
+ }
+}
+
+generateSnapshot() {
+ var tempDir = Directory.systemTemp.createTempSync("script-snapshot");
+ var snapshotPath = tempDir.uri.resolve("hello.snapshot").toFilePath();
+
+ var exec = Platform.resolvedExecutable;
+ var args = new List();
+ args.addAll(Platform.executableArguments);
+ args.add("--snapshot=$snapshotPath");
+ args.add(Platform.script.toFilePath());
+ args.add("--child");
+ var result = Process.runSync(exec, args);
+ if (result.exitCode != 0) {
+ throw "Bad exit code: ${result.exitCode}";
+ }
+ if (result.stdout.contains("Hello, pre-scanned world!")) {
+ print(result.stdout);
+ throw "Should not have run the script.";
+ }
+
+ return snapshotPath;
+}
+
+runSnapshot(var snapshotPath) {
+ var exec = Platform.resolvedExecutable;
+ var args = new List();
+ args.addAll(Platform.executableArguments);
+ args.add(snapshotPath);
+ args.add("--child");
+ var result = Process.runSync(exec, args);
+ if (result.exitCode != 0) {
+ throw "Bad exit code: ${result.exitCode}";
+ }
+ if (!result.stdout.contains("Hello, pre-scanned world!")) {
+ print(result.stdout);
+ throw "Failed to run the snapshot.";
+ }
+}
diff --git a/tests/standalone/standalone.status b/tests/standalone/standalone.status
index 9a2f581..7d0480e 100644
--- a/tests/standalone/standalone.status
+++ b/tests/standalone/standalone.status
@@ -101,6 +101,9 @@
[ $runtime != vm || $arch == arm || $arch == arm64 || ($system == windows && $mode == debug) ]
fragmentation_test: Skip # VM test uses too much memory for small systems.
+[ $runtime != vm || $compiler != none ]
+script_snapshot_not_executed_test: SkipByDesign # Only makes sense running from source.
+
[ $arch == simarm || $arch == simarmv6 || $arch == simarmv5te ]
out_of_memory_test: Skip # passes on Mac, crashes on Linux
oom_error_stacktrace_test: Skip # Fails on Linux
diff --git a/tools/VERSION b/tools/VERSION
index a71463f..26cef60 100644
--- a/tools/VERSION
+++ b/tools/VERSION
@@ -28,4 +28,4 @@
MINOR 0
PATCH 0
PRERELEASE 0
-PRERELEASE_PATCH 0
+PRERELEASE_PATCH 1