14 binary="$(basename "$0")"
15 echo "Usage: ${binary} --help"
16 echo " ${binary} [-i <iterations>] [-s <specific device>] [--all] [<test name>[.<filter>] ...] [--<arg> ...]"
18 echo "Unknown long arguments are passed to the test."
20 echo "Known test names:"
22 for name in "${known_tests[@]}"
42 echo "error: number of iterations expected" 1>&2
52 echo "error: no device specified" 1>&2
60 tests+=( "${known_tests[@]}" )
74 if [ "${#tests[@]}" -eq 0 ]; then
75 tests+=( "${known_tests[@]}" )
79 if [ -n "${device}" ]; then
80 adb+=( "-s" "${device}" )
84 for spec in "${tests[@]}"
87 binary="/data/nativetest/${name}/${name}"
89 push_command=( "${adb[@]}" push {"${ANDROID_PRODUCT_OUT}",}"${binary}" )
90 test_command=( "${adb[@]}" shell "${binary}" )
91 if [ "${name}" != "${spec}" ]; then
93 test_command+=( "--gtest_filter=${filter}" )
95 test_command+=( "${test_args[@]}" )
97 echo "--- ${name} ---"
102 for i in $(seq 1 ${iterations})
104 "${test_command[@]}" || failed_count=$(( $failed_count + 1 ))
107 if [ $failed_count != 0 ]; then
108 failed_tests+=( "${name} ${failed_count}/${iterations}" )
112 if [ "${#failed_tests[@]}" -ne 0 ]; then
113 for failed_test in "${failed_tests[@]}"
115 echo "!!! FAILED TEST: ${failed_test} !!!"