xref: /aosp_15_r20/external/oboe/tests/README.md (revision 05767d913155b055644481607e6fa1e35e2fe72c)
1*05767d91SRobert Wu# Oboe Unit Tests
2*05767d91SRobert Wu
3*05767d91SRobert WuThis directory contains the Oboe unit tests. They are run using the bash script `run_tests.sh`.
4*05767d91SRobert Wu
5*05767d91SRobert WuThe basic operation is:
6*05767d91SRobert Wu
7*05767d91SRobert Wu1. Connect an Android device or start the Android emulator
8*05767d91SRobert Wu2. Open a terminal window and execute `run_tests.sh`
9*05767d91SRobert Wu
10*05767d91SRobert Wu## Prerequisites/caveats
11*05767d91SRobert Wu
12*05767d91SRobert Wu1. Java JDK installed.
13*05767d91SRobert Wu2. On Mac, you must agree to the XCode license. The script will prompt you.
14*05767d91SRobert Wu3. You must have compiled and executed one of the Oboe examples or OboeTester. That ensures that the NDK and cmake is installed.
15*05767d91SRobert Wu4. You must define `ANDROID_NDK` as an environment variable and make sure `cmake` is on your path.
16*05767d91SRobert Wu
17*05767d91SRobert WuTo test this on Mac or Linux enter:
18*05767d91SRobert Wu
19*05767d91SRobert Wu    echo $ANDROID_HOME
20*05767d91SRobert Wu    echo $ANDROID_NDK
21*05767d91SRobert Wu    cmake --version
22*05767d91SRobert Wu
23*05767d91SRobert WuThey may already be set. If not, then this may work on Mac OS:
24*05767d91SRobert Wu
25*05767d91SRobert Wu    export ANDROID_HOME=$HOME/Library/Android/sdk
26*05767d91SRobert Wu
27*05767d91SRobert Wuor this may work on Linux:
28*05767d91SRobert Wu
29*05767d91SRobert Wu    export ANDROID_HOME=$HOME/Android/Sdk
30*05767d91SRobert Wu
31*05767d91SRobert WuNow we need to determine the latest installed version of the NDK. Enter:
32*05767d91SRobert Wu
33*05767d91SRobert Wu    ls $ANDROID_HOME/ndk
34*05767d91SRobert Wu
35*05767d91SRobert WuMake note of the folder name. Mine was "21.3.6528147" so I entered:
36*05767d91SRobert Wu
37*05767d91SRobert Wu    export ANDROID_NDK=$ANDROID_HOME/ndk/21.3.6528147/
38*05767d91SRobert Wu
39*05767d91SRobert WuIf you need to add `cmake` to your path then you can find it by entering:
40*05767d91SRobert Wu
41*05767d91SRobert Wu    ls $ANDROID_HOME/cmake
42*05767d91SRobert Wu
43*05767d91SRobert WuMake note of the folder name. Mine was "3.10.2.4988404" so I entered:
44*05767d91SRobert Wu
45*05767d91SRobert Wu    export PATH=$PATH:$ANDROID_HOME/cmake/3.10.2.4988404/bin
46*05767d91SRobert Wu    cmake --version
47*05767d91SRobert Wu
48*05767d91SRobert Wu## Running the Tests
49*05767d91SRobert Wu
50*05767d91SRobert WuTo run the tests, enter:
51*05767d91SRobert Wu
52*05767d91SRobert Wu    cd tests
53*05767d91SRobert Wu    ./run_tests.sh
54*05767d91SRobert Wu
55*05767d91SRobert WuYou may need to enter \<control-c\> to exit the script.
56*05767d91SRobert Wu
57*05767d91SRobert WuIf you get this error:
58*05767d91SRobert Wu
59*05767d91SRobert Wu    com.android.builder.testing.api.DeviceException: com.android.ddmlib.InstallException:
60*05767d91SRobert Wu        INSTALL_FAILED_UPDATE_INCOMPATIBLE: Package com.google.oboe.tests.unittestrunner
61*05767d91SRobert Wu        signatures do not match previously installed version; ignoring!
62*05767d91SRobert Wu
63*05767d91SRobert Wuthen uninstall the app "UnitTestRunner" from the Android device.
64*05767d91SRobert Wu
65*05767d91SRobert WuSee `run_tests.sh` for more documentation
66