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

Unified Diff: mojo/dart/dart_snapshotter/test/dart_snapshotter_test.py

Issue 1273743005: Dart: Adds a program to create snapshots of Mojo apps. (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 5 years, 4 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: 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..146fdedf28fea4cbd089717edac085dddd98f75d
--- /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', '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):
+ return 1
+
+if __name__ == '__main__':
+ sys.exit(main())

Powered by Google App Engine
This is Rietveld 408576698