summaryrefslogtreecommitdiff
path: root/perf2cfg
diff options
context:
space:
mode:
authorMartin Stjernholm <mast@google.com>2020-09-07 17:35:03 +0100
committerMartin Stjernholm <mast@google.com>2020-09-07 20:24:50 +0100
commitc9310f88972578ae14b7f140470c0660eb1ff511 (patch)
tree31c3aafdf30192ee5506efa3b85c42f2baa07b7c /perf2cfg
parent0eb7c66f6e47f21983b3c5a8a46f95e9ec9a13aa (diff)
downloadextras-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.bp1
-rw-r--r--perf2cfg/TEST_MAPPING8
-rwxr-xr-xperf2cfg/perf2cfg_test.py11
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)