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        $native -c \
26            && echo "native client => Java server PASSED" \
27            || (echo "native client => Java server FAILED" && false) || e=1
28
29        kill $NATIVE_PID 2>/dev/null
30    else
31        echo "FAILED: Not running $native because it doesn't exist."
32        e=1
33    fi
34done
35
36echo
37echo "Summary: $e"
38[ $e -eq 0 ] && echo "All tests PASSED." || echo "Test(s) FAILED."
39
40exit $e
41