Home | History | Annotate | Download | only in templates
      1 @echo OFF
      2 setlocal ENABLEDELAYEDEXPANSION
      3 
      4 rem Process command line
      5 
      6 rem This script is designed to allow situations when the tests are installed in
      7 rem a different directory from the library.
      8 
      9 set OPENCV_DIR=%~1
     10 
     11 if "%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 
     18 if NOT EXIST "%OPENCV_DIR%" (
     19     echo>&2 error: "%OPENCV_DIR%" doesn't exist
     20 )
     21 
     22 rem Set up paths
     23 
     24 set PATH=%OPENCV_DIR%\@OPENCV_BIN_INSTALL_PATH@;%PATH%
     25 set OPENCV_TEST_PATH=%~dp0
     26 set OPENCV_TEST_DATA_PATH=%OPENCV_TEST_PATH%\..\testdata
     27 
     28 rem Run tests
     29 
     30 set SUMMARY_STATUS=0
     31 set FAILED_TESTS=
     32 set PASSED_TESTS=
     33 
     34 for %%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 
     57 rem Remove temporary test files
     58 
     59 del /F /Q "%TMP%\ocv*.tmp*"
     60 
     61 rem Report final status
     62 
     63 echo ===============================================================
     64 echo PASSED TESTS : %PASSED_TESTS%
     65 echo FAILED TESTS : %FAILED_TESTS%
     66 if %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 
     74 exit /B %SUMMARY_STATUS%
     75