Allow blocklisting tests.
This allows you to give cargo2android.py a list of test files to ignore.
Test: Use on a couple crates.
Change-Id: Id9422c496de6693029754f32d9805f1cb92d33cb
diff --git a/scripts/cargo2android.py b/scripts/cargo2android.py
index c6a35cd..c567b68 100755
--- a/scripts/cargo2android.py
+++ b/scripts/cargo2android.py
@@ -612,7 +612,9 @@
return
# Dump one test module per source file, and separate host and device tests.
# crate_type == 'test'
- if (self.host_supported and self.device_supported) or len(self.srcs) > 1:
+ self.srcs = [src for src in self.srcs if not src in self.runner.args.test_blocklist]
+ if ((self.host_supported and self.device_supported and len(self.srcs) > 0) or
+ len(self.srcs) > 1):
self.srcs = sorted(set(self.srcs))
self.dump_defaults_module()
saved_srcs = self.srcs
@@ -1609,6 +1611,12 @@
default=[],
help='Do not emit the given dependencies.')
parser.add_argument(
+ '--test-blocklist',
+ nargs='*',
+ default=[],
+ help=('Do not emit the given tests. ' +
+ 'Pass the path to the test file to exclude.'))
+ parser.add_argument(
'--no-test-mapping',
action='store_true',
default=False,