opencv_run_all_tests_android.sh.in 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. #!/bin/sh
  2. BASE_DIR=`dirname $0`
  3. OPENCV_TEST_PATH=$BASE_DIR/@TEST_PATH@
  4. OPENCV_TEST_DATA_PATH=$BASE_DIR/sdk/etc/testdata/
  5. if [ $# -ne 1 ]; then
  6. echo "Device architecture is not preset in command line"
  7. echo "Tests are available for architectures: `ls -m ${OPENCV_TEST_PATH}`"
  8. echo "Usage: $0 <target_device_arch>"
  9. return 1
  10. else
  11. TARGET_ARCH=$1
  12. fi
  13. if [ -z `which adb` ]; then
  14. echo "adb command was not found in PATH"
  15. return 1
  16. fi
  17. adb push $OPENCV_TEST_DATA_PATH /sdcard/opencv_testdata
  18. adb shell "mkdir -p /data/local/tmp/opencv_test"
  19. SUMMARY_STATUS=0
  20. for t in "$OPENCV_TEST_PATH/$TARGET_ARCH/"opencv_test_* "$OPENCV_TEST_PATH/$TARGET_ARCH/"opencv_perf_*;
  21. do
  22. test_name=`basename "$t"`
  23. report="$test_name-`date --rfc-3339=date`.xml"
  24. adb push $t /data/local/tmp/opencv_test/
  25. adb shell "export OPENCV_TEST_DATA_PATH=/sdcard/opencv_testdata && /data/local/tmp/opencv_test/$test_name --perf_min_samples=1 --perf_force_samples=1 --gtest_output=xml:/data/local/tmp/opencv_test/$report"
  26. adb pull "/data/local/tmp/opencv_test/$report" $report
  27. TEST_STATUS=0
  28. if [ -e $report ]; then
  29. if [ `grep -c "<fail" $report` -ne 0 ]; then
  30. TEST_STATUS=2
  31. fi
  32. else
  33. TEST_STATUS=3
  34. fi
  35. if [ $TEST_STATUS -ne 0 ]; then
  36. SUMMARY_STATUS=$TEST_STATUS
  37. fi
  38. done
  39. if [ $SUMMARY_STATUS -eq 0 ]; then
  40. echo "All OpenCV tests finished successfully"
  41. else
  42. echo "OpenCV tests finished with status $SUMMARY_STATUS"
  43. fi
  44. return $SUMMARY_STATUS