opencv_run_all_tests_windows.cmd.in 1.7 KB

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