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

Unified Diff: examples/dart/example_tests.py

Issue 1571823002: Dart: Adds tests of a couple Dart examples. (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 4 years, 11 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
« no previous file with comments | « no previous file | examples/dart/hello_world/hello/lib/main.dart » ('j') | mojo/tools/get_test_list.py » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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))
« no previous file with comments | « no previous file | examples/dart/hello_world/hello/lib/main.dart » ('j') | mojo/tools/get_test_list.py » ('J')

Powered by Google App Engine
This is Rietveld 408576698