1base=/system
2export CLASSPATH=$base/framework/hidl_test_java.jar:$base/framework/android.hardware.tests.baz-V1.0-java.jar:$base/framework/android.hidl.base-V1.0-java.jar
3export TREBLE_TESTING_OVERRIDE=true
4
5e=0
6for SIZE in 64 32; do
7    native=/data/nativetest${SIZE/32}/hidl_test_java_native/hidl_test_java_native
8
9    if [ -f $native ]; then
10        echo "Testing $SIZE bit native client/server"
11
12        # Test native server with Java client
13        $native -s &
14        sleep 1
15        NATIVE_PID=$!
16        app_process $base/bin com.android.commands.hidl_test_java.HidlTestJava -c \
17            && echo "Java client => native server PASSED" \
18            || (echo "Java client => native server FAILED" && false) || e=1
19
20        kill $NATIVE_PID 2>/dev/null
21
22        # Test Java server with native client
23        app_process $base/bin com.android.commands.hidl_test_java.HidlTestJava -s &
24        NATIVE_PID=$!
25        sleep 1
26        $native -c \
27            && echo "native client => Java server PASSED" \
28            || (echo "native client => Java server FAILED" && false) || e=1
29
30        kill $NATIVE_PID 2>/dev/null
31    else
32        echo "FAILED: Not running $native because it doesn't exist."
33        e=1
34    fi
35done
36
37echo
38echo "Summary: $e"
39[ $e -eq 0 ] && echo "All tests PASSED." || echo "Test(s) FAILED."
40
41exit $e