From 24758f89e2a452dad6ea191dbd636f7b9e35797a Mon Sep 17 00:00:00 2001 From: Matthew Maurer Date: Fri, 10 Dec 2021 18:51:22 +0000 Subject: [PATCH] cargo2android: Add tests to both test groups "presubmit" will continue to handle x86_64 virtual device and host tests "presubmit-rust" will run the test on a pool of physical arm64 devices Bug: 204332926 Test: regenerated a few TEST_MAPPING files Change-Id: Idd5cad5107a96031f67305b63875034b2e5a5c60 --- scripts/update_crate_tests.py | 32 +++++++++++++++++++------------- 1 file changed, 19 insertions(+), 13 deletions(-) diff --git a/scripts/update_crate_tests.py b/scripts/update_crate_tests.py index 6d2bc79ae..a7245e4bc 100755 --- a/scripts/update_crate_tests.py +++ b/scripts/update_crate_tests.py @@ -45,6 +45,13 @@ TEST_OPTIONS = { "ring_device_test_src_lib": [{"test-timeout": "100000"}], } +# Groups to add tests to. "presubmit" runs x86_64 device tests+host tests, and +# "presubmit-rust" runs arm64 device tests on physical devices. +TEST_GROUPS = [ + "presubmit", + "presubmit-rust" +] + # Excluded tests. These tests will be ignored by this script. TEST_EXCLUDE = [ "aidl_test_rust_client", @@ -250,22 +257,21 @@ class TestMapping(object): def tests_dirs_to_mapping(self, tests, dirs): """Translate the test list into a dictionary.""" - test_mapping = {"presubmit": [], "imports": []} - for test in tests: - if test in TEST_EXCLUDE: - continue - if test in TEST_OPTIONS: - test_mapping["presubmit"].append({"name": test, "options": TEST_OPTIONS[test]}) - else: - test_mapping["presubmit"].append({"name": test}) + test_mapping = {"imports": []} + for test_group in TEST_GROUPS: + test_mapping[test_group] = [] + for test in tests: + if test in TEST_EXCLUDE: + continue + if test in TEST_OPTIONS: + test_mapping[test_group].append({"name": test, "options": TEST_OPTIONS[test]}) + else: + test_mapping[test_group].append({"name": test}) + test_mapping[test_group] = sorted(test_mapping[test_group], key=lambda t: t["name"]) for dir in dirs: test_mapping["imports"].append({"path": dir}) - test_mapping["presubmit"] = sorted(test_mapping["presubmit"], key=lambda t: t["name"]) test_mapping["imports"] = sorted(test_mapping["imports"], key=lambda t: t["path"]) - if not test_mapping["presubmit"]: - del test_mapping["presubmit"] - if not test_mapping["imports"]: - del test_mapping["imports"] + test_mapping = {section: entry for (section, entry) in test_mapping.items() if entry} return test_mapping def write_test_mapping(self, test_mapping):