As mentioned earlier, native tests are typically used for exercising HAL or interacting directly with lower level system services, and to leverage continuous testing service, native tests should be built with gtest framework.
Here are some general instructions:
See sample native test module setup at: libs/hwui/unit_tests
Test module makefile should use BUILD_NATIVE_TEST
build rule so that gtest dependencies are included automatically
Write a test config
Build the test module with mmm
or mma
(depends on if it's an incremental or full build), e.g.:
make hwui_unit_tests -j
Automatic installation and run with the TradeFederation test harness:
make tradefed-all -j tradefed.sh run template/local_min --template:map test=hwui_unit_tests
Manually Install and Run:
Push the generated test binary onto device:
adb push ${OUT}/data/nativetest/hwui_unit_tests/hwui_unit_tests \ /data/nativetest/hwui_unit_tests/hwui_unit_tests
Execute the test by invoking test binary on device:
adb shell /data/nativetest/hwui_unit_tests/hwui_unit_tests
This launches the native test. You can also add `--help` parameter to your test binary to find out more about the different ways to customize test execution. You can also check out the gtest advanced guide for more parameters usage: * https://github.com/google/googletest/blob/master/googletest/docs/AdvancedGuide.md