jenkins.testall.cmd 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113
  1. ::-------------------------------------------------------------------------------------------------------
  2. :: Copyright (C) Microsoft. All rights reserved.
  3. :: Licensed under the MIT license. See LICENSE.txt file in the project root for full license information.
  4. ::-------------------------------------------------------------------------------------------------------
  5. :: ============================================================================
  6. ::
  7. :: jenkins.testall.cmd
  8. ::
  9. :: Runs tests for Jenkins continuous integration. This script is called from
  10. :: the Jenkins CI build and it runs all tests for x86 and x64, debug and test
  11. :: build configs.
  12. ::
  13. :: Do not use this script to run all tests on your dev box.
  14. :: - It will delete all your existing test logs
  15. :: - It does not run the various flavors of the tests in parallel (though
  16. :: this is not currently possible anyway because rl stages logs in a
  17. :: common directory)
  18. :: - It does nothing to provide useful output when there are failures, e.g.
  19. :: they can be buried under thousands of lines of output from further
  20. :: tests run.
  21. :: - It cannot be cancelled without risk of polluting your command prompt
  22. :: environment with environment variables that will make further calls to
  23. :: runtests.cmd behave unexpectedly.
  24. ::
  25. :: ============================================================================
  26. @echo off
  27. setlocal
  28. set _RootDir=%~dp0..
  29. set _BinDir=%_RootDir%\Build\VcBuild\bin
  30. set _HadFailures=0
  31. :: ============================================================================
  32. :: Main script
  33. :: ============================================================================
  34. :main
  35. if not "%JENKINS_BUILD%" == "True" (
  36. echo This script should be run under a Jenkins Build environment
  37. exit /b 2
  38. )
  39. pushd %_RootDir%\test
  40. set _TestDir=%CD%
  41. call jenkins.parsetestargs.cmd %*
  42. call :doSilent rd /s/q %_TestDir%\logs
  43. call :runTests x86debug
  44. call :runTests x86test
  45. call :runTests x64debug
  46. call :runTests x64test
  47. call :summarizeLogs
  48. echo.
  49. if "%_HadFailures%" == "1" (
  50. echo -- jenkins.testall.cmd ^>^> Tests failed! 1>&2
  51. ) else (
  52. echo -- jenkins.testall.cmd ^>^> Tests passed!
  53. )
  54. popd
  55. exit /b %_HadFailures%
  56. goto :eof
  57. :: ============================================================================
  58. :: Run one test suite against one build config and record if there were errors
  59. :: ============================================================================
  60. :runTests
  61. call :do %_TestDir%\runtests.cmd -%1 -quiet -cleanupall -nottags exclude_jenkins %_ExtraTestArgs% -binDir %_BinDir%
  62. if ERRORLEVEL 1 set _HadFailures=1
  63. goto :eof
  64. :: ============================================================================
  65. :: Summarize the logs into a listing of only the failures
  66. :: ============================================================================
  67. :summarizeLogs
  68. pushd %_TestDir%\logs
  69. findstr /sp failed rl.results.log > summary.log
  70. rem Echo to stderr so that VSO includes the output in the build summary
  71. type summary.log 1>&2
  72. popd
  73. :: ============================================================================
  74. :: Echo a command line before executing it
  75. :: ============================================================================
  76. :do
  77. echo -- jenkins.testall.cmd ^>^> %*
  78. cmd /s /c "%*"
  79. goto :eof
  80. :: ============================================================================
  81. :: Echo a command line before executing it and redirect the command's output
  82. :: to nul
  83. :: ============================================================================
  84. :doSilent
  85. echo -- jenkins.testall.cmd ^>^> %* ^> nul 2^>^&1
  86. cmd /s /c "%* > nul 2>&1"
  87. goto :eof