Do not generate TEST_MAPPINGs for host tests

Instead of generating TEST_MAPPING entries for host tests, we add a
test_options section to its Android.bp entry.

Fixes: 176097100
Test: Manually run cargo2android on a few crates and verify the output
Change-Id: Ia57a53dad6910410c7e7aab6d592fba79720f998
This commit is contained in:
Joel Galenson
2021-01-12 11:31:53 -08:00
parent 89e83dc8ec
commit e261a15598

View File

@@ -651,7 +651,8 @@ class Crate(object):
self.module_name = self.test_module_name() self.module_name = self.test_module_name()
self.decide_one_module_type(crate_type) self.decide_one_module_type(crate_type)
self.dump_one_android_module(crate_type) self.dump_one_android_module(crate_type)
self.runner.add_test(self.outf_name, self.module_name, True) # We do not add host tests, as these are handled in the Android.bp file.
# self.runner.add_test(self.outf_name, self.module_name, True)
if saved_device_supported: if saved_device_supported:
self.device_supported = True self.device_supported = True
self.host_supported = False self.host_supported = False
@@ -822,6 +823,10 @@ class Crate(object):
# self.write(' relative_install_path: "' + self.root_pkg + '_tests",') # self.write(' relative_install_path: "' + self.root_pkg + '_tests",')
self.write(' test_suites: ["general-tests"],') self.write(' test_suites: ["general-tests"],')
self.write(' auto_gen_config: true,') 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,')
self.write(' },')
def dump_android_externs(self): def dump_android_externs(self):
"""Dump the dependent rlibs and dylibs property.""" """Dump the dependent rlibs and dylibs property."""