mirror of
https://github.com/opencv/opencv.git
synced 2025-01-13 00:01:27 +08:00
opencv_run_all_tests.sh implemented for Android SDK.
(cherry picked from commit d02c291160
)
This commit is contained in:
parent
f1ef3a4865
commit
116311b7b4
@ -576,16 +576,24 @@ include(cmake/OpenCVGenConfig.cmake)
|
|||||||
include(cmake/OpenCVGenInfoPlist.cmake)
|
include(cmake/OpenCVGenInfoPlist.cmake)
|
||||||
|
|
||||||
# Generate environment setup file
|
# Generate environment setup file
|
||||||
if(INSTALL_TESTS AND OPENCV_TEST_DATA_PATH AND UNIX AND NOT ANDROID)
|
if(INSTALL_TESTS AND OPENCV_TEST_DATA_PATH AND UNIX)
|
||||||
configure_file("${CMAKE_CURRENT_SOURCE_DIR}/cmake/templates/opencv_testing.sh.in"
|
if(ANDROID)
|
||||||
"${CMAKE_BINARY_DIR}/unix-install/opencv_testing.sh" @ONLY)
|
get_filename_component(TEST_PATH ${OPENCV_TEST_INSTALL_PATH} DIRECTORY)
|
||||||
install(FILES "${CMAKE_BINARY_DIR}/unix-install/opencv_testing.sh"
|
configure_file("${CMAKE_CURRENT_SOURCE_DIR}/cmake/templates/opencv_run_all_tests_android.sh.in"
|
||||||
DESTINATION /etc/profile.d/ COMPONENT tests)
|
"${CMAKE_BINARY_DIR}/unix-install/opencv_run_all_tests.sh" @ONLY)
|
||||||
configure_file("${CMAKE_CURRENT_SOURCE_DIR}/cmake/templates/opencv_run_all_tests.sh.in"
|
install(PROGRAMS "${CMAKE_BINARY_DIR}/unix-install/opencv_run_all_tests.sh"
|
||||||
"${CMAKE_BINARY_DIR}/unix-install/opencv_run_all_tests.sh" @ONLY)
|
DESTINATION ${CMAKE_INSTALL_PREFIX} COMPONENT tests)
|
||||||
install(FILES "${CMAKE_BINARY_DIR}/unix-install/opencv_run_all_tests.sh"
|
else()
|
||||||
PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ OWNER_EXECUTE GROUP_EXECUTE WORLD_EXECUTE
|
configure_file("${CMAKE_CURRENT_SOURCE_DIR}/cmake/templates/opencv_testing.sh.in"
|
||||||
DESTINATION ${OPENCV_TEST_INSTALL_PATH} COMPONENT tests)
|
"${CMAKE_BINARY_DIR}/unix-install/opencv_testing.sh" @ONLY)
|
||||||
|
install(FILES "${CMAKE_BINARY_DIR}/unix-install/opencv_testing.sh"
|
||||||
|
DESTINATION /etc/profile.d/ COMPONENT tests)
|
||||||
|
configure_file("${CMAKE_CURRENT_SOURCE_DIR}/cmake/templates/opencv_run_all_tests_unix.sh.in"
|
||||||
|
"${CMAKE_BINARY_DIR}/unix-install/opencv_run_all_tests.sh" @ONLY)
|
||||||
|
install(PROGRAMS "${CMAKE_BINARY_DIR}/unix-install/opencv_run_all_tests.sh"
|
||||||
|
DESTINATION ${OPENCV_TEST_INSTALL_PATH} COMPONENT tests)
|
||||||
|
|
||||||
|
endif()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
# ----------------------------------------------------------------------------
|
# ----------------------------------------------------------------------------
|
||||||
|
51
cmake/templates/opencv_run_all_tests_android.sh.in
Normal file
51
cmake/templates/opencv_run_all_tests_android.sh.in
Normal file
@ -0,0 +1,51 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
BASE_DIR=`dirname $0`
|
||||||
|
OPENCV_TEST_PATH=$BASE_DIR/@TEST_PATH@
|
||||||
|
OPENCV_TEST_DATA_PATH=$BASE_DIR/sdk/etc/testdata/
|
||||||
|
|
||||||
|
if [ $# -ne 1 ]; then
|
||||||
|
echo "Device architecture is not preset in command line"
|
||||||
|
echo "Tests are available for architectures: `ls -m ${OPENCV_TEST_PATH}`"
|
||||||
|
echo "Usage: $0 <target_device_arch>"
|
||||||
|
return 1
|
||||||
|
else
|
||||||
|
TARGET_ARCH=$1
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ -z `which adb` ]; then
|
||||||
|
echo "adb command was not found in PATH"
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
adb push $OPENCV_TEST_DATA_PATH /sdcard/opencv_testdata
|
||||||
|
|
||||||
|
adb shell "mkdir -p /data/local/tmp/opencv_test"
|
||||||
|
SUMMARY_STATUS=0
|
||||||
|
for t in "$OPENCV_TEST_PATH/$TARGET_ARCH/"opencv_test_* "$OPENCV_TEST_PATH/$TARGET_ARCH/"opencv_perf_*;
|
||||||
|
do
|
||||||
|
test_name=`basename "$t"`
|
||||||
|
report="$test_name-`date --rfc-3339=date`.xml"
|
||||||
|
adb push $t /data/local/tmp/opencv_test/
|
||||||
|
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"
|
||||||
|
adb pull "/data/local/tmp/opencv_test/$report" $report
|
||||||
|
TEST_STATUS=0
|
||||||
|
if [ -e $report ]; then
|
||||||
|
if [ `grep -c "<fail" $report` -ne 0 ]; then
|
||||||
|
TEST_STATUS=2
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
TEST_STATUS=3
|
||||||
|
fi
|
||||||
|
if [ $TEST_STATUS -ne 0 ]; then
|
||||||
|
SUMMARY_STATUS=$TEST_STATUS
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
|
if [ $SUMMARY_STATUS -eq 0 ]; then
|
||||||
|
echo "All OpenCV tests finished successfully"
|
||||||
|
else
|
||||||
|
echo "OpenCV tests finished with status $SUMMARY_STATUS"
|
||||||
|
fi
|
||||||
|
|
||||||
|
return $SUMMARY_STATUS
|
Loading…
Reference in New Issue
Block a user