diff options
| author | Jonathan Basseri <misterikkit@google.com> | 2017-09-15 17:03:10 -0700 |
|---|---|---|
| committer | Jonathan Basseri <misterikkit@google.com> | 2017-09-15 19:03:26 -0700 |
| commit | f6051de6f47d1a668f4d369d190e310014f52058 (patch) | |
| tree | 6702278d899426a672b25f1fa554c1d61eb77da7 /testrunner | |
| parent | c968b0f53c28e56dfa21af19e052c7c4fe1ae959 (diff) | |
| download | android_development-f6051de6f47d1a668f4d369d190e310014f52058.tar.gz android_development-f6051de6f47d1a668f4d369d190e310014f52058.tar.bz2 android_development-f6051de6f47d1a668f4d369d190e310014f52058.zip | |
Support -c and -m for GTEST.
This takes the --test-class and --test-method options and builds a
--gtest_filter value to use when invoking native tests.
How it works:
ARGS to runtest ARG to GTEST
--test-class= --test-method= <none>
--test-class=Foo --test-method= --gtest_filter=Foo.*
--test-class= --test-method=Bar --gtest_filter=*.Bar
--test-class=Foo --test-method=Bar --gtest_filter=Foo.Bar
Advanced:
-m *Iptables* runs all test methods containing 'Iptables' in any class.
-c *ControllerTest runs all tests in any class ending with 'ControllerTest'.
Note that the '.' and '*' characters above are not shell globs. The '*'
are wildcards, and the '.' are literals.
Test: runtest -x system/netd/server/netd_unit_test.cpp -m '*Iptables*'
Test: runtest -x system/netd/server/netd_unit_test.cpp -c BandwidthControllerTest
Test: runtest -x system/netd/server/netd_unit_test.cpp -c BandwidthControllerTest -m '*Iptables*'
Change-Id: I967296da1bdcbc404f5ab91d24f9714eec7b475b
Diffstat (limited to 'testrunner')
| -rw-r--r-- | testrunner/test_defs/gtest.py | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/testrunner/test_defs/gtest.py b/testrunner/test_defs/gtest.py index cceead960..90d8e52ef 100644 --- a/testrunner/test_defs/gtest.py +++ b/testrunner/test_defs/gtest.py @@ -49,7 +49,19 @@ class GTestSuite(test_suite.AbstractTestSuite): options: command line options adb: adb interface """ - shell_cmd = adb.PreviewShellCommand(self.GetTargetExecPath()) + + test_class = "*" + test_method = "*" + if options.test_class is not None: + test_class = options.test_class.lstrip() + if options.test_method is not None: + test_method = options.test_method.lstrip() + filter_arg = "" + if test_class != "*" or test_method != "*": + filter_arg = "--gtest_filter=%s.%s" % (test_class, test_method) + + shell_cmd = adb.PreviewShellCommand( + " ".join((self.GetTargetExecPath(), filter_arg))) logger.Log(shell_cmd) if not options.preview: # gtest will log to test results to stdout, so no need to do any |
