Add --no-presubmit option to prevent host tests being run in presubmit.

For some unknown reason the change to merge rust_test and rust_test_host
targets caused some crosvm tests to be run (and fail) in prebsubmit which
were not previously being run, so this is necessary to work around it.

Test: Ran cargo2android.py on various crosvm crates.
Change-Id: I9b94d270148d8ce5fa97f88f460d8c03eac3873c
This commit is contained in:
Andrew Walbran
2022-01-10 16:02:20 +00:00
parent 0e65bba93d
commit ca9f9f2266

View File

@@ -896,7 +896,10 @@ class Crate(object):
self.write(' auto_gen_config: true,')
if 'test' in self.crate_types and self.host_supported:
self.write(' test_options: {')
self.write(' unit_test: true,')
if self.runner.args.no_presubmit:
self.write(' unit_test: false,')
else:
self.write(' unit_test: true,')
self.write(' },')
def dump_android_externs(self):
@@ -1668,6 +1671,11 @@ def get_parser():
action='store_true',
default=False,
help='do not run cargo for the host; only for the device target')
parser.add_argument(
'--no-presubmit',
action='store_true',
default=False,
help='set unit_test to false for test targets, to avoid host tests running in presubmit')
parser.add_argument(
'--no-subdir',
action='store_true',