1@echo OFF 2setlocal ENABLEDELAYEDEXPANSION 3 4rem Process command line 5 6rem This script is designed to allow situations when the tests are installed in 7rem a different directory from the library. 8 9set OPENCV_DIR=%~1 10 11if "%OPENCV_DIR%" == "" ( 12 echo>&2 This script runs the OpenCV tests on Windows. 13 echo>&2 14 echo>&2 usage: %0 ^<OpenCV install directory^> 15 exit /B 1 16) 17 18if NOT EXIST "%OPENCV_DIR%" ( 19 echo>&2 error: "%OPENCV_DIR%" doesn't exist 20) 21 22rem Set up paths 23 24set PATH=%OPENCV_DIR%\@OPENCV_BIN_INSTALL_PATH@;%PATH% 25set OPENCV_TEST_PATH=%~dp0 26set OPENCV_TEST_DATA_PATH=%OPENCV_TEST_PATH%\..\testdata 27 28rem Run tests 29 30set SUMMARY_STATUS=0 31set FAILED_TESTS= 32set PASSED_TESTS= 33 34for %%t IN ("%OPENCV_TEST_PATH%\opencv_test_*.exe" "%OPENCV_TEST_PATH%\opencv_perf_*.exe") DO ( 35 set test_name=%%~nt 36 set report=!test_name!.xml 37 38 set cmd="%%t" --perf_min_samples=1 --perf_force_samples=1 "--gtest_output=xml:!report!" 39 40 echo [!test_name!] RUN : !cmd! 41 !cmd! 42 set ret=!errorlevel! 43 echo [!test_name!] RETURN_CODE : !ret! 44 45 if !ret! EQU 0 ( 46 echo [!test_name!] OK 47 set PASSED_TESTS=!PASSED_TESTS! !test_name! 48 ) ELSE ( 49 echo [!test_name!] FAILED 50 set SUMMARY_STATUS=1 51 set FAILED_TESTS=!FAILED_TESTS! !test_name! 52 ) 53 54 echo. 55) 56 57rem Remove temporary test files 58 59del /F /Q "%TMP%\ocv*.tmp*" 60 61rem Report final status 62 63echo =============================================================== 64echo PASSED TESTS : %PASSED_TESTS% 65echo FAILED TESTS : %FAILED_TESTS% 66if %SUMMARY_STATUS% EQU 0 ( 67 echo STATUS : OK 68 echo STATUS : All OpenCV tests finished successfully 69) ELSE ( 70 echo STATUS : FAIL 71 echo STATUS : OpenCV tests finished with status %SUMMARY_STATUS% 72) 73 74exit /B %SUMMARY_STATUS% 75