AutoGen: Support NativeTest with vendor namespace.

Set the TEST_ROOT to /data/local/tmp/tests/vendor if LOCAL_VENDOR_MODULE or
LOCAL_USE_VNDK be set, if not, set to /data/local/tmp.

Bug: 138450837
Test: atest binderVendorDoubleLoadTest
Change-Id: I66437816227458a4f5672146b0c9e465c843aa50
This commit is contained in:
yangbill 2020-08-13 16:14:30 +08:00
parent c73b31bf2a
commit 85146e5e82
2 changed files with 15 additions and 3 deletions

View File

@ -22,6 +22,17 @@
# autogen_test_config_file: Path to the test config file generated. # autogen_test_config_file: Path to the test config file generated.
autogen_test_config_file := $(dir $(LOCAL_BUILT_MODULE))$(LOCAL_MODULE).config autogen_test_config_file := $(dir $(LOCAL_BUILT_MODULE))$(LOCAL_MODULE).config
# TODO: (b/167308193) Switch to /data/local/tests/unrestricted as the default install base.
autogen_test_install_base := /data/local/tmp
# Automatically setup test root for native test.
ifeq (true,$(is_native))
ifeq (true,$(LOCAL_VENDOR_MODULE))
autogen_test_install_base = /data/local/tests/vendor
endif
ifeq (true,$(LOCAL_USE_VNDK))
autogen_test_install_base = /data/local/tests/vendor
endif
endif
ifeq (true,$(is_native)) ifeq (true,$(is_native))
ifeq ($(LOCAL_NATIVE_BENCHMARK),true) ifeq ($(LOCAL_NATIVE_BENCHMARK),true)
autogen_test_config_template := $(NATIVE_BENCHMARK_TEST_CONFIG_TEMPLATE) autogen_test_config_template := $(NATIVE_BENCHMARK_TEST_CONFIG_TEMPLATE)
@ -33,10 +44,11 @@ else
endif endif
endif endif
# Auto generating test config file for native test # Auto generating test config file for native test
$(autogen_test_config_file): PRIVATE_TEST_INSTALL_BASE := $(autogen_test_install_base)
$(autogen_test_config_file): PRIVATE_MODULE_NAME := $(LOCAL_MODULE) $(autogen_test_config_file): PRIVATE_MODULE_NAME := $(LOCAL_MODULE)
$(autogen_test_config_file) : $(autogen_test_config_template) $(autogen_test_config_file) : $(autogen_test_config_template)
@echo "Auto generating test config $(notdir $@)" @echo "Auto generating test config $(notdir $@)"
$(hide) sed 's&{MODULE}&$(PRIVATE_MODULE_NAME)&g;s&{EXTRA_CONFIGS}&&g' $< > $@ $(hide) sed 's&{MODULE}&$(PRIVATE_MODULE_NAME)&g;s&{TEST_INSTALL_BASE}&$(PRIVATE_TEST_INSTALL_BASE)&g;s&{EXTRA_CONFIGS}&&g' $< > $@
my_auto_generate_config := true my_auto_generate_config := true
else else
# Auto generating test config file for instrumentation test # Auto generating test config file for instrumentation test

View File

@ -22,11 +22,11 @@
<target_preparer class="com.android.tradefed.targetprep.PushFilePreparer"> <target_preparer class="com.android.tradefed.targetprep.PushFilePreparer">
<option name="cleanup" value="true" /> <option name="cleanup" value="true" />
<option name="push" value="{MODULE}->/data/local/tmp/{MODULE}" /> <option name="push" value="{MODULE}->{TEST_INSTALL_BASE}/{MODULE}" />
</target_preparer> </target_preparer>
<test class="com.android.tradefed.testtype.GTest" > <test class="com.android.tradefed.testtype.GTest" >
<option name="native-test-device-path" value="/data/local/tmp" /> <option name="native-test-device-path" value="{TEST_INSTALL_BASE}" />
<option name="module-name" value="{MODULE}" /> <option name="module-name" value="{MODULE}" />
</test> </test>
</configuration> </configuration>