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
diff --git a/scripts/update_crate_tests.py b/scripts/update_crate_tests.py
index 1795de2..7bd9f05 100755
--- a/scripts/update_crate_tests.py
+++ b/scripts/update_crate_tests.py
@@ -352,7 +352,10 @@
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):