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
diff --git a/scripts/cargo2android.py b/scripts/cargo2android.py
index 0804620..9aa7d12 100755
--- a/scripts/cargo2android.py
+++ b/scripts/cargo2android.py
@@ -896,7 +896,10 @@
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):
@@ -1669,6 +1672,11 @@
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',
default=False,