Index: examples/dart/example_tests.py |
diff --git a/examples/dart/example_tests.py b/examples/dart/example_tests.py |
new file mode 100755 |
index 0000000000000000000000000000000000000000..3f49e5e03e24bee7601c7ceb614117987c8f95f1 |
--- /dev/null |
+++ b/examples/dart/example_tests.py |
@@ -0,0 +1,42 @@ |
+#!/usr/bin/env python |
+# Copyright 2016 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. |
+ |
+"""Runs Dart example tests""" |
+ |
+import argparse |
+import os |
+import subprocess |
+import sys |
+ |
+SCRIPT_DIR = os.path.dirname(os.path.abspath(__file__)) |
+SRC_DIR = os.path.dirname(os.path.dirname(SCRIPT_DIR)) |
+ |
+DART_SDK = os.path.join(SRC_DIR, 'third_party', 'dart-sdk', 'dart-sdk', 'bin') |
+DART = os.path.join(DART_SDK, 'dart') |
+ |
+# Add paths to test scripts here relative to //examples/dart. |
+TESTS = [ |
+ os.path.join('hello_world', 'hello', 'test', 'hello_test.dart'), |
+ os.path.join('wget', 'test', 'wget_test.dart'), |
Cutch
2016/01/11 21:10:58
I'd prefer to just list the directory:
TESTS = [
zra
2016/01/11 22:11:18
Done.
|
+] |
+ |
+def main(build_dir, package_root): |
+ for test in TESTS: |
+ subprocess.check_call( |
+ [DART, '-p', package_root, '--checked', os.path.join(SCRIPT_DIR, test), |
+ '--mojo-shell', os.path.join(build_dir, 'mojo_shell'),]) |
+ |
+if __name__ == '__main__': |
+ parser = argparse.ArgumentParser(description="Run Dart example tests") |
+ parser.add_argument('-b', '--build-dir', |
+ dest='build_dir', |
+ metavar='<build-directory>', |
+ type=str, |
+ required=True, |
+ help='The build output directory. E.g. out/Debug') |
+ args = parser.parse_args() |
+ package_root = os.path.join( |
+ SRC_DIR, args.build_dir, 'gen', 'dart-pkg', 'packages') |
+ sys.exit(main(args.build_dir, package_root)) |