From 3f7f7e223628aff55244028641b8893360cc2026 Mon Sep 17 00:00:00 2001 From: Matthew Maurer Date: Tue, 14 Jun 2022 14:28:31 -0700 Subject: [PATCH 1/3] c2a: Do not assume test_mapping.json exists update_crate_tests would previously assume test_mapping.json existed when trying to generate a TEST_MAPPING update. This made updating mappings for the majority of existing crates fail. Bug: 233924440 Test: Regenerate all Rust TEST_MAPPINGs Change-Id: I4d9b906f4db233ee0223a3035c1b63bf1ca681f4 --- scripts/update_crate_tests.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/scripts/update_crate_tests.py b/scripts/update_crate_tests.py index 1795de22d..7bd9f0521 100755 --- a/scripts/update_crate_tests.py +++ b/scripts/update_crate_tests.py @@ -352,7 +352,10 @@ def main(): subprocess.check_output(['repo', 'start', 'tmp_auto_test_mapping', '.']) subprocess.check_output(['git', 'add', 'TEST_MAPPING']) - subprocess.check_output(['git', 'add', 'test_mapping_config.json']) + # test_mapping_config.json is not always present + subprocess.call(['git', 'add', 'test_mapping_config.json'], + stderr=subprocess.DEVNULL, + stdout=subprocess.DEVNULL) subprocess.check_output(['git', 'commit', '-m', 'Update TEST_MAPPING\n\nTest: None']) if args.push_change and (changed or untracked): From 037b445ed85aed70f5392887bda089d00d0c3b1e Mon Sep 17 00:00:00 2001 From: Matthew Maurer Date: Tue, 14 Jun 2022 14:30:15 -0700 Subject: [PATCH 2/3] c2a: Denylist additional Rust tests modules These modules are not suitable for direct execution on cuttlefish, but are still built as `rust_test` to get the harness. Bug: 233924440 Test: Regenerate all TEST_MAPPINGs, pass presubmit Change-Id: I4aebdb5e36cf3a80780483e0a7ebeb83e9735d29 --- scripts/update_crate_tests.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/scripts/update_crate_tests.py b/scripts/update_crate_tests.py index 7bd9f0521..ab1fbc500 100755 --- a/scripts/update_crate_tests.py +++ b/scripts/update_crate_tests.py @@ -82,6 +82,10 @@ TEST_EXCLUDE = [ # TODO: Remove when b/198197213 is closed. "diced_client_test", + + "CoverageRustSmokeTest", + "libtrusty-rs-tests", + "terminal-size_test_src_lib", ] # Excluded modules. From e1d07ba87258db14910a6471a98cfc9ef61b9662 Mon Sep 17 00:00:00 2001 From: Matthew Maurer Date: Tue, 14 Jun 2022 14:38:51 -0700 Subject: [PATCH 3/3] c2a: Only use postsubmit when configured Previous logic would place tests in both presubmit and postsubmit if the postsubmit_tests configuration was not specified. This is both unnecessary and wastes resources because presubmit tests are also run in postsubmit. Bug: 236006683 Test: Regenerate all TEST_MAPPINGs, manually check postsubmit removal Change-Id: Ie8ff0e351776711e07bf7646efd916d970254e9c --- scripts/update_crate_tests.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/scripts/update_crate_tests.py b/scripts/update_crate_tests.py index ab1fbc500..68e5106a4 100755 --- a/scripts/update_crate_tests.py +++ b/scripts/update_crate_tests.py @@ -298,6 +298,12 @@ class TestMapping(object): continue if test not in config['postsubmit_tests'] and 'postsubmit' in test_group: continue + else: + if 'postsubmit' in test_group: + # If postsubmit_tests is not configured, do not place + # anything in postsubmit - presubmit groups are + # automatically included in postsubmit in CI. + continue if test in TEST_OPTIONS: test_mapping[test_group].append({"name": test, "options": TEST_OPTIONS[test]}) else: