Stop generating separate rust_test_host.
With b/196306316 hopefully fixed, we should be able to use a single rust_test entry for both device and host tests. This modifies cargo2android.py so it generates these shared tests. Test: Run on crates with simple tests, those with defaults, host-only, and device-only tests. Change-Id: Icfe8d1fb26a61bc9ed65b8a7b116a4ebcd782ce4
This commit is contained in:
@@ -673,34 +673,20 @@ class Crate(object):
|
||||
# do not change self.stem or self.module_name
|
||||
self.dump_one_android_module(crate_type)
|
||||
return
|
||||
# Dump one test module per source file, and separate host and device tests.
|
||||
# Dump one test module per source file.
|
||||
# crate_type == 'test'
|
||||
self.srcs = [src for src in self.srcs if not self.runner.should_ignore_test(src)]
|
||||
if ((self.host_supported and self.device_supported and len(self.srcs) > 0) or
|
||||
len(self.srcs) > 1):
|
||||
if len(self.srcs) > 1:
|
||||
self.srcs = sorted(set(self.srcs))
|
||||
self.dump_defaults_module()
|
||||
saved_srcs = self.srcs
|
||||
for src in saved_srcs:
|
||||
self.srcs = [src]
|
||||
saved_device_supported = self.device_supported
|
||||
saved_host_supported = self.host_supported
|
||||
saved_main_src = self.main_src
|
||||
self.main_src = src
|
||||
if saved_host_supported:
|
||||
self.device_supported = False
|
||||
self.host_supported = True
|
||||
self.module_name = self.test_module_name()
|
||||
self.decide_one_module_type(crate_type)
|
||||
self.dump_one_android_module(crate_type)
|
||||
if saved_device_supported:
|
||||
self.device_supported = True
|
||||
self.host_supported = False
|
||||
self.module_name = self.test_module_name()
|
||||
self.decide_one_module_type(crate_type)
|
||||
self.dump_one_android_module(crate_type)
|
||||
self.host_supported = saved_host_supported
|
||||
self.device_supported = saved_device_supported
|
||||
self.module_name = self.test_module_name()
|
||||
self.decide_one_module_type(crate_type)
|
||||
self.dump_one_android_module(crate_type)
|
||||
self.main_src = saved_main_src
|
||||
self.srcs = saved_srcs
|
||||
|
||||
@@ -788,10 +774,7 @@ class Crate(object):
|
||||
"""Return a unique name for a test module."""
|
||||
# root_pkg+(_host|_device) + '_test_'+source_file_name
|
||||
suffix = self.main_src_basename_path()
|
||||
host_device = '_host'
|
||||
if self.device_supported:
|
||||
host_device = '_device'
|
||||
return self.root_pkg + host_device + '_test_' + suffix
|
||||
return self.root_pkg + '_test_' + suffix
|
||||
|
||||
def decide_module_type(self):
|
||||
# Use the first crate type for the default/first module.
|
||||
|
||||
@@ -40,19 +40,19 @@ from pathlib import Path
|
||||
# Some tests requires specific options. Consider fixing the upstream crate
|
||||
# before updating this dictionary.
|
||||
TEST_OPTIONS = {
|
||||
"ring_device_test_tests_digest_tests": [{"test-timeout": "600000"}],
|
||||
"ring_device_test_src_lib": [{"test-timeout": "100000"}],
|
||||
"ring_test_tests_digest_tests": [{"test-timeout": "600000"}],
|
||||
"ring_test_src_lib": [{"test-timeout": "100000"}],
|
||||
}
|
||||
|
||||
# Excluded tests. These tests will be ignored by this script.
|
||||
TEST_EXCLUDE = [
|
||||
"aidl_test_rust_client",
|
||||
"aidl_test_rust_service",
|
||||
"ash_device_test_src_lib",
|
||||
"ash_device_test_tests_constant_size_arrays",
|
||||
"ash_device_test_tests_display",
|
||||
"shared_library_device_test_src_lib",
|
||||
"vulkano_device_test_src_lib"
|
||||
"ash_test_src_lib",
|
||||
"ash_test_tests_constant_size_arrays",
|
||||
"ash_test_tests_display",
|
||||
"shared_library_test_src_lib",
|
||||
"vulkano_test_src_lib"
|
||||
]
|
||||
|
||||
# Excluded modules.
|
||||
|
||||
Reference in New Issue
Block a user