diff options
author | Martin Stjernholm <mast@google.com> | 2020-09-07 17:35:03 +0100 |
---|---|---|
committer | Martin Stjernholm <mast@google.com> | 2020-09-07 20:24:50 +0100 |
commit | c9310f88972578ae14b7f140470c0660eb1ff511 (patch) | |
tree | 31c3aafdf30192ee5506efa3b85c42f2baa07b7c /perf2cfg | |
parent | 0eb7c66f6e47f21983b3c5a8a46f95e9ec9a13aa (diff) | |
download | extras-c9310f88972578ae14b7f140470c0660eb1ff511.tar.gz |
Fix perf2cfg unit tests and enable presubmit testing.
Test: atest --host perf2cfg_test
Test: As above but with an error planted in tests/test_parse.py,
check that the test fails.
Test: Plant an error in test_parse.py and check that TH fails.
Test: cd system/extras/perf2cfg && atest
Test: m perf2cfg && perf2cfg -h
Change-Id: I9c0e569069e50dc7d879b5cf17d4a19212c7e922
Diffstat (limited to 'perf2cfg')
-rw-r--r-- | perf2cfg/Android.bp | 1 | ||||
-rw-r--r-- | perf2cfg/TEST_MAPPING | 8 | ||||
-rwxr-xr-x | perf2cfg/perf2cfg_test.py | 11 |
3 files changed, 18 insertions, 2 deletions
diff --git a/perf2cfg/Android.bp b/perf2cfg/Android.bp index 46e55034..4611f7ec 100644 --- a/perf2cfg/Android.bp +++ b/perf2cfg/Android.bp @@ -34,6 +34,7 @@ python_binary_host { python_test_host { name: "perf2cfg_test", + test_suites: ["general-tests"], srcs: [ "perf2cfg_test.py", "tests/*.py", diff --git a/perf2cfg/TEST_MAPPING b/perf2cfg/TEST_MAPPING new file mode 100644 index 00000000..673a293a --- /dev/null +++ b/perf2cfg/TEST_MAPPING @@ -0,0 +1,8 @@ +{ + "presubmit": [ + { + "name": "perf2cfg_test", + "host": true + } + ] +} diff --git a/perf2cfg/perf2cfg_test.py b/perf2cfg/perf2cfg_test.py index d99559b7..90d757f4 100755 --- a/perf2cfg/perf2cfg_test.py +++ b/perf2cfg/perf2cfg_test.py @@ -14,7 +14,14 @@ # limitations under the License. import unittest +import os.path + +def load_tests(loader, standard_tests, _pattern): + this_dir = os.path.dirname(__file__) + perf2cfg_tests = loader.discover(start_dir=os.path.join(this_dir, 'tests'), + pattern='test*.py') + standard_tests.addTests(perf2cfg_tests) + return standard_tests if __name__ == '__main__': - # Setting module to None enables test discovery - unittest.main(module=None, verbosity=2) + unittest.main(verbosity=2) |