1export CLASSPATH=/data/framework/hidl_test_java_java.jar
2
3r=0 # at least one test ran
4e=0 # error
5for SIZE in 64 32; do
6    native=/data/nativetest${SIZE/32}/hidl_test_java_native/hidl_test_java_native
7
8    if [ -f $native ]; then
9        r=1
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 /data/framework 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 /data/framework 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    fi
33done
34
35
36echo
37echo "Summary: $e"
38
39if [ $r = 0 ]; then
40    echo "NO TESTS RAN"
41    e=1
42fi
43
44[ $e -eq 0 ] && echo "All tests PASSED." || echo "Test(s) FAILED."
45
46exit $e
47