diff options
| author | 2017-02-15 17:19:44 +0000 | |
|---|---|---|
| committer | 2017-02-15 17:25:31 +0000 | |
| commit | faf1250304950251c6ece6e9b1a93b44b2bacf2e (patch) | |
| tree | 5fc249926c5b98f4121938b4251978b94523d008 | |
| parent | 4b8c53d6ea1c6c206d90e8b5e120346e0ff46902 (diff) | |
Testrunner: Accept test_name by run-test number
The change allows the testrunner to accept test numbers for running
a particular test. It runs all the tests for which the prefix matches
with the passed test name.
For test name "001-H", it will run 001-HelloWorld
However, for test name "001", it will run 001-Main and 001-HelloWorld
If it doesn't find any test with matching prefix, it raises ValueError.
Test: Verified by running locally
Bug: 35260706
Change-Id: Ib132d6635b22ade1fd96728ba629fe7d580ba6cf
| -rwxr-xr-x | test/testrunner/testrunner.py | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/test/testrunner/testrunner.py b/test/testrunner/testrunner.py index ce14ff119b..92ecc9d56d 100755 --- a/test/testrunner/testrunner.py +++ b/test/testrunner/testrunner.py @@ -610,8 +610,12 @@ def parse_test_name(test_name): variants required to run the test. Again, it returns the test_name without the variant information like 001-HelloWorld. """ - if test_name in RUN_TEST_SET: - return {test_name} + test_set = set() + for test in RUN_TEST_SET: + if test.startswith(test_name): + test_set.add(test) + if test_set: + return test_set regex = '^test-art-' regex += '(' + '|'.join(VARIANT_TYPE_DICT['target']) + ')-' @@ -643,6 +647,7 @@ def parse_test_name(test_name): DEBUGGABLE_TYPES.add(match.group(11)) ADDRESS_SIZES.add(match.group(13)) return {match.group(12)} + raise ValueError(test_name + " is not a valid test") def parse_option(): @@ -786,10 +791,10 @@ def main(): sys.exit(0) except SystemExit: pass - except: + except Exception, e: print_analysis() + print_text(str(e)) sys.exit(1) - if __name__ == '__main__': main() |