From ca9f9f22669663fe3f3d893b689b930ce820b502 Mon Sep 17 00:00:00 2001 From: Andrew Walbran Date: Mon, 10 Jan 2022 16:02:20 +0000 Subject: [PATCH] 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 --- scripts/cargo2android.py | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/scripts/cargo2android.py b/scripts/cargo2android.py index 0804620cb..9aa7d12c3 100755 --- a/scripts/cargo2android.py +++ b/scripts/cargo2android.py @@ -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',