runtests.bat 2.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  1. @echo off
  2. REM Runs wxWidgets CppUnit tests
  3. REM This script is used to return the correct return value to the caller
  4. REM which is required by Buildbot to recognize failures.
  5. REM Note that in DOS error level is not the return code of the previous
  6. REM command; it is for (some!) built-in DOS commands like FIND but
  7. REM in general it's not. Thus to get the return code of the test utility
  8. REM we need some hack; see the guide:
  9. REM http://www.infionline.net/~wtnewton/batch/batguide.html
  10. REM for general info about DOS batch files.
  11. REM Author: Francesco Montorsi
  12. rem set the path for running the tests if they use DLL build of wx
  13. for /d %%x in ("..\lib\*_dll") do @set PATH=%%x;%PATH%
  14. set failure=0
  15. for /d %%x in (*) do @(
  16. if exist %%x\test.exe (
  17. echo.
  18. echo ========================================================================
  19. echo Running non-GUI unit test
  20. echo ========================================================================
  21. echo.
  22. %%x\test.exe -t >tmp
  23. REM show the output of the test in the buildbot log:
  24. type tmp
  25. REM hack to understand if the tests succeeded or not
  26. REM (failure=1 is set if "OK" does not appear in the test output)
  27. type tmp | find "OK" >NUL
  28. if ERRORLEVEL 1 set failure=1
  29. REM separe the output of the test we just executed from the next one
  30. echo.
  31. echo ========================================================================
  32. echo Non-GUI test done
  33. echo ========================================================================
  34. echo.
  35. )
  36. if exist %%x\test_gui.exe (
  37. echo.
  38. echo ========================================================================
  39. echo Running GUI unit test
  40. echo ========================================================================
  41. echo.
  42. %%x\test_gui.exe -t >tmp
  43. REM show the output of the test in the buildbot log:
  44. type tmp
  45. REM hack to understand if the tests succeeded or not
  46. REM (failure=1 is set if "OK" does not appear in the test output)
  47. type tmp | find "OK" >NUL
  48. if ERRORLEVEL 1 set failure=1
  49. echo.
  50. echo ========================================================================
  51. echo GUI test done
  52. echo ========================================================================
  53. echo.
  54. )
  55. )
  56. REM exit with code 1 if any of the test failed
  57. del tmp
  58. if %failure% EQU 1 (
  59. echo.
  60. echo One or more test failed
  61. echo.
  62. exit 1
  63. )
  64. REM remove the failure env var:
  65. set failure=
  66. REM exit with code 0 (all tests passed successfully)
  67. exit 0