ANDROID: Add KUnit test config and packaging rules for tests.zip

Include KUnit modules and Tradefed test configuration inside
'tests.zip' alongside the kselftest tests. The zip can built via:
$ tools/bazel build //common:tests_zip_arm64

The KUnit tests can be executed on running device with matching kernel
via:
$ tradefed.sh run commandAndExit template/local_min --template:map \
    test=suite/test_mapping_suite --include-filter kunit \
    --tests-dir=<directory of zip contents>  --primary-abi-only

Example zip structure:
Archive:  bazel-bin/common/x86_64/tests.zip

testcases/kunit/kunit.config
testcases/kunit/x86_64/drivers/hid/hid-uclogic-test.ko
testcases/kunit/x86_64/drivers/iio/test/iio-test-format.ko
<truncate>
testcases/selftests/selftests.config
testcases/selftests/x86/futex_requeue
testcases/selftests/x86/futex_requeue_pi
<truncate>
testcases/selftests/x86_64/futex_requeue
testcases/selftests/x86_64/futex_requeue_pi
<truncate>

Bug: 311187098

Test build (x86_64): https://android-build.corp.google.com/builds/abtd/run/L50600030001493915
Test build (arm64): https://android-build.corp.google.com/builds/abtd/run/L76000030001501406

Change-Id: Ic53a000d9d797fc043a626d8892246d0faae2eab
Signed-off-by: Joe Fradley <joefradley@google.com>
This commit is contained in:
Joe Fradley
2023-12-06 07:40:39 -08:00
parent 339f191a41
commit af8ff008f4
3 changed files with 133 additions and 2 deletions
@@ -0,0 +1,32 @@
<configuration description="kunit">
<target_preparer class="com.android.tradefed.targetprep.RootTargetPreparer"/>
<target_preparer class="com.android.tradefed.targetprep.PushFilePreparer">
<option name="cleanup" value="true" />
<option name="push-file" key="kunit" value="/data/kunit" />
</target_preparer>
<!-- Modules that leave the OS in an unstable state have been temporarily commented out. -->
<test class="com.android.tradefed.testtype.binary.KUnitModuleTest" >
<option name="skip-binary-check" value="true" />
<!-- <option name='binary' key='drivers/base/regmap/regmap-kunit' value='/data/kunit/arm64/drivers/base/regmap/regmap-kunit.ko' /> -->
<!-- <option name='binary' key='drivers/base/regmap/regmap-ram' value='/data/kunit/arm64/drivers/base/regmap/regmap-ram.ko' /> -->
<!-- <option name='binary' key='drivers/base/regmap/regmap-raw-ram' value='/data/kunit/arm64/drivers/base/regmap/regmap-raw-ram.ko' /> -->
<option name='binary' key='drivers/hid/hid-uclogic-test' value='/data/kunit/arm64/drivers/hid/hid-uclogic-test.ko' />
<!-- <option name='binary' key='drivers/iio/test/iio-test-format' value='/data/kunit/arm64/drivers/iio/test/iio-test-format.ko' /> -->
<option name='binary' key='drivers/input/tests/input_test' value='/data/kunit/arm64/drivers/input/tests/input_test.ko' />
<option name='binary' key='drivers/rtc/lib_test' value='/data/kunit/arm64/drivers/rtc/lib_test.ko' />
<option name='binary' key='fs/ext4/ext4-inode-test' value='/data/kunit/arm64/fs/ext4/ext4-inode-test.ko' />
<option name='binary' key='fs/fat/fat_test' value='/data/kunit/arm64/fs/fat/fat_test.ko' />
<option name='binary' key='kernel/time/time_test' value='/data/kunit/arm64/kernel/time/time_test.ko' />
<option name='binary' key='lib/kunit/kunit-example-test' value='/data/kunit/arm64/lib/kunit/kunit-example-test.ko' />
<!-- <option name='binary' key='lib/kunit/kunit-test' value='/data/kunit/arm64/lib/kunit/kunit-test.ko' /> -->
<!-- <option name='binary' key='mm/kfence/kfence_test' value='/data/kunit/arm64/mm/kfence/kfence_test.ko' /> -->
<option name='binary' key='net/core/dev_addr_lists_test' value='/data/kunit/arm64/net/core/dev_addr_lists_test.ko' />
<!-- <option name='binary' key='sound/soc/soc-topology-test' value='/data/kunit/arm64/sound/soc/soc-topology-test.ko' /> -->
<option name='binary' key='sound/soc/soc-utils-test' value='/data/kunit/arm64/sound/soc/soc-utils-test.ko' />
<option name='binary' key='drivers/clk/clk-gate_test' value='/data/kunit/arm64/drivers/clk/clk-gate_test.ko' />
<option name='binary' key='drivers/clk/clk_test' value='/data/kunit/arm64/drivers/clk/clk_test.ko' />
</test>
</configuration>
@@ -0,0 +1,29 @@
<configuration description="kunit">
<target_preparer class="com.android.tradefed.targetprep.RootTargetPreparer"/>
<target_preparer class="com.android.tradefed.targetprep.PushFilePreparer">
<option name="cleanup" value="true" />
<option name="push-file" key="kunit" value="/data/kunit" />
</target_preparer>
<!-- Modules that leave the OS in an unstable state have been temporarily commented out. -->
<test class="com.android.tradefed.testtype.binary.KUnitModuleTest" >
<option name="skip-binary-check" value="true" />
<!-- <option name='binary' key='drivers/base/regmap/regmap-kunit' value='/data/kunit/x86_64/drivers/base/regmap/regmap-kunit.ko' /> -->
<!-- <option name='binary' key='drivers/base/regmap/regmap-ram' value='/data/kunit/x86_64/drivers/base/regmap/regmap-ram.ko' /> -->
<!-- <option name='binary' key='drivers/base/regmap/regmap-raw-ram' value='/data/kunit/x86_64/drivers/base/regmap/regmap-raw-ram.ko' /> -->
<option name='binary' key='drivers/hid/hid-uclogic-test' value='/data/kunit/x86_64/drivers/hid/hid-uclogic-test.ko' />
<!-- <option name='binary' key='drivers/iio/test/iio-test-format' value='/data/kunit/x86_64/drivers/iio/test/iio-test-format.ko' /> -->
<option name='binary' key='drivers/input/tests/input_test' value='/data/kunit/x86_64/drivers/input/tests/input_test.ko' />
<option name='binary' key='drivers/rtc/lib_test' value='/data/kunit/x86_64/drivers/rtc/lib_test.ko' />
<option name='binary' key='fs/ext4/ext4-inode-test' value='/data/kunit/x86_64/fs/ext4/ext4-inode-test.ko' />
<option name='binary' key='fs/fat/fat_test' value='/data/kunit/x86_64/fs/fat/fat_test.ko' />
<option name='binary' key='kernel/time/time_test' value='/data/kunit/x86_64/kernel/time/time_test.ko' />
<option name='binary' key='lib/kunit/kunit-example-test' value='/data/kunit/x86_64/lib/kunit/kunit-example-test.ko' />
<!-- <option name='binary' key='lib/kunit/kunit-test' value='/data/kunit/x86_64/lib/kunit/kunit-test.ko' /> -->
<!-- <option name='binary' key='mm/kfence/kfence_test' value='/data/kunit/x86_64/mm/kfence/kfence_test.ko' /> -->
<option name='binary' key='net/core/dev_addr_lists_test' value='/data/kunit/x86_64/net/core/dev_addr_lists_test.ko' />
<!-- <option name='binary' key='sound/soc/soc-topology-test' value='/data/kunit/x86_64/sound/soc/soc-topology-test.ko' /> -->
<option name='binary' key='sound/soc/soc-utils-test' value='/data/kunit/x86_64/sound/soc/soc-utils-test.ko' />
</test>
</configuration>