summaryrefslogtreecommitdiff
path: root/mojo/public/tools/bindings/pylib/mojom/generate/run_tests.py
diff options
context:
space:
mode:
authorHidehiko Abe <hidehiko@google.com>2018-04-23 20:01:13 -0700
committerandroid-build-merger <android-build-merger@google.com>2018-04-23 20:01:13 -0700
commited7128dca79cff94e99465e3c1bc31d91d83c76d (patch)
treebd2d04362f66c36d4279f7a9735ba21ea3a2a021 /mojo/public/tools/bindings/pylib/mojom/generate/run_tests.py
parentd6187ab7d79d95d101c2ecb83aa98c05bcdcccd1 (diff)
parent0ab20ac2283987e63b0e7c1318db2a5cf7c668d2 (diff)
downloadlibchrome-ed7128dca79cff94e99465e3c1bc31d91d83c76d.tar.gz
Migrate libmojo repository into libchrome, part 2. am: b268b43ac6
am: 0ab20ac228 Change-Id: I1b1afe0c902f1d122b100f5bf56d1df4a94eb090
Diffstat (limited to 'mojo/public/tools/bindings/pylib/mojom/generate/run_tests.py')
-rwxr-xr-xmojo/public/tools/bindings/pylib/mojom/generate/run_tests.py35
1 files changed, 35 insertions, 0 deletions
diff --git a/mojo/public/tools/bindings/pylib/mojom/generate/run_tests.py b/mojo/public/tools/bindings/pylib/mojom/generate/run_tests.py
new file mode 100755
index 0000000000..41f11a2b71
--- /dev/null
+++ b/mojo/public/tools/bindings/pylib/mojom/generate/run_tests.py
@@ -0,0 +1,35 @@
+#!/usr/bin/env python
+# Copyright 2013 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.
+
+""" Test runner for Mojom """
+
+import subprocess
+import sys
+
+def TestMojom(testname, args):
+ print '\nRunning unit tests for %s.' % testname
+ try:
+ args = [sys.executable, testname] + args
+ subprocess.check_call(args, stdout=sys.stdout)
+ print 'Succeeded'
+ return 0
+ except subprocess.CalledProcessError as err:
+ print 'Failed with %s.' % str(err)
+ return 1
+
+
+def main(args):
+ errors = 0
+ errors += TestMojom('data_tests.py', ['--test'])
+ errors += TestMojom('module_tests.py', ['--test'])
+ errors += TestMojom('pack_tests.py', ['--test'])
+
+ if errors:
+ print '\nFailed tests.'
+ return min(errors, 127) # Make sure the return value doesn't "wrap".
+
+
+if __name__ == '__main__':
+ sys.exit(main(sys.argv[1:]))