I am wondering how I can add an arbitrary file into a VTS test module for android? My test binary would need to access that file when running on the target device.
Looking at many cc_test tests in the android repo, I can find many tests, but the PushFilePreparer of them is only copying one item - the compiled binary.
I tried including a file in by module dir and making a PushFilePreparer rule for it, but the file cannot be found. -> Local source file 'data.dat' does not exist [...].
Is there some prebuilt line I need to add in the Android.bp file? (The file shall only be used for testing).
The test's xml file (I tried adding the line for data.dat):
<?xml version="1.0" encoding="utf-8"?>
<configuration description="Runs TestNothing test.">
<option name="test-suite-tag" value="ap" />
<option name="test-suite-tag" value="ap-native" />
<target_preparer class="com.android.tradefed.targetprep.RootTargetPreparer">
</target_preparer>
<target_preparer class="com.android.tradefed.targetprep.PushFilePreparer">
<option name="cleanup" value="true" />
<option name="push" value="Test00->/data/local/tmp/Test00" />
<option name="push" value="data.dat->/data/local/tmp/data.dat" />
</target_preparer>
<test class="com.android.tradefed.testtype.GTest" >
<option name="native-test-device-path" value="/data/local/tmp" />
<option name="module-name" value="Test00" />
<option name="native-test-timeout" value="6000" />
</test>
</configuration>
The Android.bp build file:
cc_test {
name: "Test00",
defaults: ["VtsHalTargetTestDefaults"],
cflags: ["-DARG=1"],
srcs: [
"TestNothing0.cpp",
],
static_libs: [
"libgmock",
],
test_suites: ["general-tests", "vts"],
test_config: "TestNothing0.xml",