Index: mojo/dart/dart_snapshotter/test/dart_snapshotter_test.py |
diff --git a/mojo/dart/dart_snapshotter/test/dart_snapshotter_test.py b/mojo/dart/dart_snapshotter/test/dart_snapshotter_test.py |
new file mode 100755 |
index 0000000000000000000000000000000000000000..90f8d6af811d8ecc79bf824cd35857f8b6f6ec09 |
--- /dev/null |
+++ b/mojo/dart/dart_snapshotter/test/dart_snapshotter_test.py |
@@ -0,0 +1,40 @@ |
+#!/usr/bin/env python |
+# Copyright 2015 The Chromium Authors. All rights reserved. |
+# Use of this source code is governed by a BSD-style license that can be |
+# found in the LICENSE file. |
+ |
+import argparse |
+import os |
+import subprocess |
+import sys |
+import tempfile |
+ |
+def main(): |
+ parser = argparse.ArgumentParser(description='Tests Dart snapshotting') |
+ parser.add_argument("--build-dir", |
+ dest="build_dir", |
+ metavar="<build-directory>", |
+ type=str, |
+ required=True, |
+ help="The directory containing the Mojo build.") |
+ args = parser.parse_args() |
+ dart_snapshotter = os.path.join(args.build_dir, 'dart_snapshotter') |
+ package_root = os.path.join(args.build_dir, 'gen', 'dart-pkg', 'packages') |
+ main_dart = os.path.join( |
+ args.build_dir, 'gen', 'dart-pkg', 'mojo_dart_hello', 'main.dart') |
+ snapshot = tempfile.mktemp() |
+ |
+ if not os.path.isfile(dart_snapshotter): |
+ print "file not found: " + dart_snapshotter |
+ return 1 |
+ subprocess.check_call([ |
+ dart_snapshotter, |
+ main_dart, |
+ '--package-root=%s' % package_root, |
+ '--snapshot=%s' % snapshot, |
+ ]) |
+ if not os.path.isfile(snapshot): |
Cutch
2015/08/11 14:18:06
Is there at least a magic number at the front of t
zra
2015/08/11 17:03:21
Done. Not sure how robust it is, but this test wil
|
+ return 1 |
+ |
+if __name__ == '__main__': |
+ sys.exit(main()) |