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
This commit is contained in:
Matthew Maurer
2022-06-14 14:28:31 -07:00
parent 1a4e4daf49
commit 3f7f7e2236

View File

@@ -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):