1#!/bin/bash
2
3# Copy the tests across.
4adb sync
5
6if tty -s; then
7  green="\033[1;32m"
8  red="\033[1;31m"
9  plain="\033[0m"
10else
11  green=""
12  red=""
13  plain=""
14fi
15
16failures=0
17
18check_failure() {
19  if [ $? -eq 0 ]; then
20    echo -e "${green}[PASS]${plain}"
21  else
22    failures=$(($failures+1))
23    echo -e "${red}[FAIL]${plain}"
24  fi
25}
26
27# Run the 32-bit tests.
28if [ -e "$ANDROID_PRODUCT_OUT/data/nativetest/mathtest/mathtest" ]; then
29  adb shell /data/nativetest/mathtest/mathtest '$(ls /data/nativetest/mathtest/math/test/testcases/directed/* | grep -v exp10)'
30  check_failure
31fi
32
33# TODO: these tests are currently a bloodbath.
34#adb shell 'cp /data/nativetest/ulp/math/test/runulp.sh /data/nativetest/ulp/ && sh /data/nativetest/ulp/runulp.sh'
35#check_failure
36
37# Run the 64-bit tests.
38if [ -e "$ANDROID_PRODUCT_OUT/data/nativetest64/mathtest/mathtest" ]; then
39  adb shell /data/nativetest64/mathtest/mathtest '$(ls /data/nativetest/mathtest/math/test/testcases/directed/* | grep -v exp10)'
40  check_failure
41fi
42
43# TODO: these tests are currently a bloodbath.
44#adb shell 'cp /data/nativetest64/ulp/math/test/runulp.sh /data/nativetest64/ulp/ && sh /data/nativetest64/ulp/runulp.sh'
45#check_failure
46
47echo
48echo "_________________________________________________________________________"
49echo
50if [ $failures -ne 0 ]; then
51  echo -e "${red}FAILED${plain}: $failures"
52fi
53exit $failures
54