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