1 # Native Tests 2 3 As mentioned earlier, native tests are typically used for exercising HAL or 4 interacting directly with lower level system services, and to leverage 5 continuous testing service, native tests should be built with 6 [gtest](https://github.com/google/googletests) framework. 7 8 Here are some general instructions: 9 10 1. See sample native test module setup at: `libs/hwui/unit_tests` 11 1. Test module makefile should use `BUILD_NATIVE_TEST` build rule so that 12 gtest dependencies are included automatically 13 1. Write a [test config](../test-config.md) 14 1. Build the test module with `mmm` or `mma` (depends on if it's an 15 incremental or full build), e.g.: 16 17 ```shell 18 make hwui_unit_tests -j 19 ``` 20 1. Automatic installation and run with the TradeFederation test harness: 21 22 ``` 23 make tradefed-all -j 24 tradefed.sh run template/local_min --template:map test=hwui_unit_tests 25 ``` 26 1. Manually Install and Run: 27 1. Push the generated test binary onto device: 28 29 ```shell 30 adb push ${OUT}/data/nativetest/hwui_unit_tests/hwui_unit_tests \ 31 /data/nativetest/hwui_unit_tests/hwui_unit_tests 32 ``` 33 1. Execute the test by invoking test binary on device: 34 35 ```shell 36 adb shell /data/nativetest/hwui_unit_tests/hwui_unit_tests 37 ``` 38 39 This launches the native test. You can also add `--help` parameter to your test 40 binary to find out more about the different ways to customize test execution. 41 You can also check out the gtest advanced guide for more parameters usage: 42 43 * https://github.com/google/googletest/blob/master/googletest/docs/AdvancedGuide.md 44