| 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())
|
|
|