runtests.cmd 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521
  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. :: runtests.cmd
  8. ::
  9. :: Runs checkin tests using the ch.exe on the path, in 2 variants:
  10. ::
  11. :: -maxInterpretCount:1 -maxSimpleJitRunCount:1 -bgjit-
  12. :: <dynapogo>
  13. ::
  14. :: Logs are placed into:
  15. ::
  16. :: logs\interpreted
  17. :: logs\dynapogo
  18. ::
  19. :: User specified variants:
  20. :: logs\forcedeferparse
  21. :: logs\nodeferparse
  22. :: logs\forceundodefer
  23. :: logs\bytecodeserialized (serialized to byte codes)
  24. :: logs\forceserialized (force bytecode serialization internally)
  25. ::
  26. :: ============================================================================
  27. @echo off
  28. setlocal
  29. goto :main
  30. :: ============================================================================
  31. :: Print usage
  32. :: ============================================================================
  33. :printUsage
  34. echo runtests.cmd -x86^|-x64^|-arm -debug^|-test [options]
  35. echo.
  36. echo Required switches:
  37. echo.
  38. echo Specify architecture of ChakraCore:
  39. echo.
  40. echo -x86 Build arch of binaries is x86
  41. echo -x64 Build arch of binaries is x64
  42. echo -arm Build arch of binaries is ARM
  43. echo.
  44. echo Specify type of ChakraCore:
  45. echo.
  46. echo -debug Build type of binaries is debug
  47. echo -test Build type of binaries is test
  48. echo -codecoverage Build type of binaries is codecoverage
  49. echo.
  50. echo Shorthand combinations can be used, e.g. -x64debug
  51. echo.
  52. echo Note: release build type currently unsupported by ch.exe
  53. echo.
  54. echo Options:
  55. echo.
  56. echo -dirs dirname Run only the specified directory
  57. :: TODO Add more usage help
  58. goto :eof
  59. :: ============================================================================
  60. :: Print how to get help
  61. :: ============================================================================
  62. :printGetHelp
  63. echo For help use runtests.cmd -?
  64. goto :eof
  65. :: ============================================================================
  66. :: Main script
  67. :: ============================================================================
  68. :main
  69. if not exist %cd%\rlexedirs.xml (
  70. echo Error: rlexedirs.xml not found in current directory.
  71. echo runtests.cmd must be run from a test root directory containing rlexedirs.xml.
  72. exit /b 1
  73. )
  74. call :initVars
  75. call :parseArgs %*
  76. if not "%fShowUsage%" == "" (
  77. call :printUsage
  78. goto :eof
  79. )
  80. call :validateArgs
  81. if not "%fShowGetHelp%" == "" (
  82. call :printGetHelp
  83. goto :eof
  84. )
  85. call :configureVars
  86. set _logsRoot=%cd%\logs
  87. call :doSilent del /s /q profile.dpl.*
  88. for %%i in (%_Variants%) do (
  89. set _TESTCONFIG=%%i
  90. call :RunOneVariant
  91. )
  92. call :cleanUp
  93. for %%i in (%_Variants%) do (
  94. echo.
  95. echo ######## Logs for %%i variant ########
  96. if exist %_logsRoot%\%_BuildArch%_%_BuildType%\%%i\rl.log (
  97. type %_logsRoot%\%_BuildArch%_%_BuildType%\%%i\rl.log
  98. ) else (
  99. echo ERROR: Log file '%_logsRoot%\%_BuildArch%_%_BuildType%\%%i\rl.log' does not exist
  100. )
  101. )
  102. exit /b %_HadFailures%
  103. :: ============================================================================
  104. :: Parse the user arguments into environment variables
  105. :: ============================================================================
  106. :parseArgs
  107. :NextArgument
  108. if "%1" == "-?" set fShowUsage=1& goto :ArgOk
  109. if "%1" == "/?" set fShowUsage=1& goto :ArgOk
  110. if /i "%1" == "-x86" set _BuildArch=x86& goto :ArgOk
  111. if /i "%1" == "-x64" set _BuildArch=x64& goto :ArgOk
  112. if /i "%1" == "-arm" set _BuildArch=arm& goto :ArgOk
  113. if /i "%1" == "-debug" set _BuildType=debug& goto :ArgOk
  114. if /i "%1" == "-test" set _BuildType=test& goto :ArgOk
  115. if /i "%1" == "-codecoverage" set _BuildType=codecoverage& goto :ArgOk
  116. if /i "%1" == "-x86debug" set _BuildArch=x86&set _BuildType=debug& goto :ArgOk
  117. if /i "%1" == "-x64debug" set _BuildArch=x64&set _BuildType=debug& goto :ArgOk
  118. if /i "%1" == "-armdebug" set _BuildArch=arm&set _BuildType=debug& goto :ArgOk
  119. if /i "%1" == "-x86test" set _BuildArch=x86&set _BuildType=test& goto :ArgOk
  120. if /i "%1" == "-x64test" set _BuildArch=x64&set _BuildType=test& goto :ArgOk
  121. if /i "%1" == "-armtest" set _BuildArch=arm&set _BuildType=test& goto :ArgOk
  122. if /i "%1" == "-x86codecoverage" set _BuildArch=x86&set _BuildType=codecoverage& goto :ArgOk
  123. if /i "%1" == "-x64codecoverage" set _BuildArch=x64&set _BuildType=codecoverage& goto :ArgOk
  124. if /i "%1" == "-armcodecoverage" set _BuildArch=arm&set _BuildType=codecoverage& goto :ArgOk
  125. if /i "%1" == "-binary" set _Binary=-binary:%2& goto :ArgOkShift2
  126. if /i "%1" == "-bindir" set _BinDir=%~f2& goto :ArgOkShift2
  127. if /i "%1" == "-dirs" set _DIRS=-dirs:%~2& goto :ArgOkShift2
  128. if /i "%1" == "-win7" set TARGET_OS=win7& goto :ArgOk
  129. if /i "%1" == "-win8" set TARGET_OS=win8& goto :ArgOk
  130. if /i "%1" == "-winBlue" set TARGET_OS=winBlue& goto :ArgOk
  131. if /i "%1" == "-win10" set TARGET_OS=win10& goto :ArgOk
  132. if /i "%1" == "-nottags" set _NOTTAGS=%_NOTTAGS% -nottags:%~2& goto :ArgOkShift2
  133. if /i "%1" == "-tags" set _TAGS=%_TAGS% -tags:%~2& goto :ArgOkShift2
  134. if /i "%1" == "-dirtags" set _DIRTAGS=%_DIRTAGS% -dirtags:%~2& goto :ArgOkShift2
  135. if /i "%1" == "-dirnottags" set _DIRNOTTAGS=%_DIRNOTTAGS% -dirnottags:%~2& goto :ArgOkShift2
  136. if /i "%1" == "-includeSlow" set _includeSlow=1& goto :ArgOk
  137. if /i "%1" == "-onlySlow" set _onlySlow=1& goto :ArgOk
  138. if /i "%1" == "-quiet" set _quiet=-quiet& goto :ArgOk
  139. :: TODO Consider removing -drt and exclude_drt in some reasonable manner
  140. if /i "%1" == "-drt" set _drt=1& set _NOTTAGS=%_NOTTAGS% -nottags:exclude_drt& goto :ArgOk
  141. if /i "%1" == "-rebase" set _rebase=-rebase& goto :ArgOk
  142. if /i "%1" == "-rundebug" set _RUNDEBUG=1& goto :ArgOk
  143. :: TODO Figure out best way to specify build arch for tests that are excluded to specific archs
  144. if /i "%1" == "-platform" set _buildArch=%2& goto :ArgOkShift2
  145. :: TODO Figure out best way to specify build type for tests that are excluded to specific type (chk, fre, etc)
  146. if /i "%1" == "-buildType" set _buildType=%2& goto :ArgOkShift2
  147. if /i "%1" == "-binaryRoot" set _binaryRoot=%~f2& goto :ArgOkShift2
  148. if /i "%1" == "-variants" set _Variants=%~2& goto :ArgOkShift2
  149. if /i "%1" == "-cleanupall" set _CleanUpAll=1& goto :ArgOk
  150. ::Extra ch.exe command line flags
  151. if /i "%1" == "-ExtraHostFlags" set _ExtraHostFlags=%~2& goto :ArgOkShift2
  152. if /i "%1" == "-DumpOnCrash" set _DumpOnCrash=1& goto :ArgOk
  153. if /i "%1" == "-CrashOnException" set _CrashOnException=1& goto :ArgOk
  154. if /i "%1" == "-extraVariants" (
  155. :: Extra variants are specified by the user but not run by default.
  156. if "%_ExtraVariants%" == "" (
  157. set _ExtraVariants=%~2
  158. ) else (
  159. set _ExtraVariants=%_ExtraVariants%,%~2
  160. )
  161. goto :ArgOkShift2
  162. )
  163. :: Defined here are shorthand versions for specifying
  164. :: extra variants when running.
  165. if /i "%1" == "-parser" (
  166. if "%_ExtraVariants%" == "" (
  167. set _ExtraVariants=forcedeferparse,nodeferparse,forceundodefer
  168. ) else (
  169. set _ExtraVariants=%_ExtraVariants%,forcedeferparse,nodeferparse,forceundodefer
  170. )
  171. goto :ArgOk
  172. )
  173. if /i "%1" == "-serialization" (
  174. if "%_ExtraVariants%" == "" (
  175. set _ExtraVariants=bytecodeserialized,forceserialized
  176. ) else (
  177. set _ExtraVariants=%_ExtraVariants%,bytecodeserialized,forceserialized
  178. )
  179. goto :ArgOk
  180. )
  181. if /i "%1" == "-disablejit" (
  182. set _DisableJit=1
  183. set _Variants=disable_jit
  184. goto :ArgOk
  185. )
  186. if /i "%1" == "-nightly" (
  187. set _nightly=1
  188. if "%_ExtraVariants%" == "" (
  189. set _ExtraVariants=mediumlayout,largelayout,forceserialized
  190. ) else (
  191. set _ExtraVariants=%_ExtraVariants%,mediumlayout,largelayout,forceserialized
  192. )
  193. goto :ArgOk
  194. )
  195. if not "%1" == "" echo Unknown argument: %1 & set fShowGetHelp=1
  196. goto :eof
  197. :ArgOkShift2
  198. shift
  199. :ArgOk
  200. shift
  201. goto :NextArgument
  202. :: ============================================================================
  203. :: Initialize batch script variables to defaults
  204. :: ============================================================================
  205. :initVars
  206. set _HadFailures=0
  207. set _RootDir=%~dp0..
  208. set _BinDir=%_RootDir%\Build\VcBuild\Bin
  209. set _BuildArch=
  210. set _BuildType=
  211. set _Binary=-binary:ch.exe
  212. set _Variants=
  213. set _TAGS=
  214. set _NOTTAGS=
  215. set _DIRNOTTAGS=
  216. set _DIRTAGS=
  217. set _drt=
  218. set _rebase=
  219. set _ExtraVariants=
  220. set _dynamicprofilecache=-dynamicprofilecache:profile.dpl
  221. set _dynamicprofileinput=-dynamicprofileinput:profile.dpl
  222. set _includeSlow=
  223. set _onlySlow=
  224. set _CleanUpAll=
  225. set _nightly=
  226. set TARGET_OS=win10
  227. set _quiet=
  228. set _ExtraHostFlags=
  229. set _DumpOnCrash=
  230. set _CrashOnException=
  231. goto :eof
  232. :: ============================================================================
  233. :: Validate that required arguments were specified
  234. :: ============================================================================
  235. :validateArgs
  236. if "%_BuildArch%" == "" (
  237. echo Error missing required build architecture or build type switch
  238. set fShowGetHelp=1
  239. goto :eof
  240. )
  241. if "%_BuildType%" == "" (
  242. echo Error missing required build architecture or build type switch
  243. set fShowGetHelp=1
  244. )
  245. if not exist %_binDir%\%_BuildArch%_%_BuildType%\%_Binary:~8% (
  246. echo Error missing binary %_binDir%\%_BuildArch%_%_BuildType%\%_Binary:~8%
  247. set fShowGetHelp=1
  248. )
  249. goto :eof
  250. :: ============================================================================
  251. :: Configure the script variables and environment based on parsed arguments
  252. :: ============================================================================
  253. :configureVars
  254. echo Adding to PATH: %_binDir%\%_BuildArch%_%_BuildType%
  255. set path=%_binDir%\%_BuildArch%_%_BuildType%;%path%
  256. :: If the user didn't specify explicit variants then do the defaults
  257. if "%_Variants%"=="" set _Variants=interpreted,dynapogo
  258. :: If the user specified extra variants to run (i.e. in addition to the defaults), include them.
  259. if not "%_ExtraVariants%" == "" set _Variants=%_Variants%,%_ExtraVariants%
  260. if not "%_nightly%" == "1" (
  261. set _NOTTAGS=%_NOTTAGS% -nottags:nightly
  262. ) else (
  263. set _NOTTAGS=%_NOTTAGS% -nottags:exclude_nightly
  264. )
  265. if "%_includeSlow%%_onlySlow%" == "" (
  266. set _NOTTAGS=%_NOTTAGS% -nottags:Slow
  267. )
  268. if "%_onlySlow%" == "1" (
  269. set _TAGS=%_TAGS% -tags:Slow
  270. )
  271. if not "%NUM_RL_THREADS%" == "" (
  272. set _RL_THREAD_FLAGS=-threads:%NUM_RL_THREADS%
  273. )
  274. if "%_DIRS%" == "" (
  275. set _DIRS=-all
  276. )
  277. set _BuildArchMapped=%_BuildArch%
  278. set _BuildTypeMapped=%_BuildType%
  279. :: Map new build arch and type names to old names until rl test tags are
  280. :: updated to the new names
  281. if "%_BuildArchMapped%" == "x64" set _BuildArchMapped=amd64
  282. if "%_BuildTypeMapped%" == "debug" set _BuildTypeMapped=chk
  283. if "%_BuildTypeMapped%" == "test" set _BuildTypeMapped=fre
  284. if "%_BuildTypeMapped%" == "codecoverage" set _BuildTypeMapped=fre
  285. if "%Disable_JIT%" == "1" (
  286. set _dynamicprofilecache=
  287. set _dynamicprofileinput=
  288. )
  289. goto :eof
  290. :: ============================================================================
  291. :: Run one variant
  292. :: ============================================================================
  293. :RunOneVariant
  294. if "%_BuildType%" == "test" (
  295. rem bytecode layout switches not available in test build
  296. if "%_TESTCONFIG%"=="largelayout" (
  297. if not exist %_logsRoot%\%_BuildArch%_%_BuildType%\%_TESTCONFIG% (
  298. mkdir %_logsRoot%\%_BuildArch%_%_BuildType%\%_TESTCONFIG%
  299. )
  300. echo. > %_logsRoot%\%_BuildArch%_%_BuildType%\%_TESTCONFIG%\rl.log
  301. goto :eof
  302. )
  303. if "%_TESTCONFIG%"=="mediumlayout" (
  304. if not exist %_logsRoot%\%_BuildArch%_%_BuildType%\%_TESTCONFIG% (
  305. mkdir %_logsRoot%\%_BuildArch%_%_BuildType%\%_TESTCONFIG%
  306. )
  307. echo. > %_logsRoot%\%_BuildArch%_%_BuildType%\%_TESTCONFIG%\rl.log
  308. goto :eof
  309. )
  310. )
  311. set _OLD_CC_FLAGS=%EXTRA_CC_FLAGS%
  312. set EXTRA_RL_FLAGS=-appendtestnametoextraccflags
  313. set _exclude_serialized=
  314. if "%_BuildType%" == "debug" (
  315. rem Enabling storing dumps on user directory.
  316. set _DumpOnCrash=1
  317. )
  318. set EXTRA_CC_FLAGS=%EXTRA_CC_FLAGS% %_ExtraHostFlags%
  319. if not "%_DumpOnCrash%" == "" (
  320. set EXTRA_CC_FLAGS=%EXTRA_CC_FLAGS% -DumpOnCrash
  321. )
  322. if not "%_CrashOnException%" == "" (
  323. set EXTRA_CC_FLAGS=%EXTRA_CC_FLAGS% -CrashOnException
  324. )
  325. if "%_Binary%" == "-binary:ch.exe" (
  326. set EXTRA_CC_FLAGS=%EXTRA_CC_FLAGS% -WERExceptionSupport -ExtendedErrorStackForTestHost -BaselineMode
  327. )
  328. if "%_TESTCONFIG%"=="interpreted" (
  329. set EXTRA_CC_FLAGS=%EXTRA_CC_FLAGS% -maxInterpretCount:1 -maxSimpleJitRunCount:1 -bgjit- %_dynamicprofilecache%
  330. )
  331. if "%_TESTCONFIG%"=="nonative" (
  332. set EXTRA_CC_FLAGS=%EXTRA_CC_FLAGS% -nonative
  333. set EXTRA_RL_FLAGS=-nottags:exclude_interpreted -nottags:fails_interpreted
  334. )
  335. :: DisableJit is different from NoNative in that NoNative can be used
  336. :: with builds which include backend code, whereas DisableJit doesn't have
  337. :: backend code linked in, and also disables other features that incidentally
  338. :: depends on the backend like dynamic profile, asmjs, simdjs, background parsing etc.
  339. :: TODO: Re-enable interpreter mode asmjs and simdjs
  340. if "%_TESTCONFIG%"=="disable_jit" (
  341. set EXTRA_CC_FLAGS=%EXTRA_CC_FLAGS% -nonative
  342. set EXTRA_RL_FLAGS=-nottags:exclude_interpreted -nottags:fails_interpreted -nottags:require_backend
  343. )
  344. if "%_TESTCONFIG%"=="dynapogo" (
  345. set EXTRA_CC_FLAGS=%EXTRA_CC_FLAGS% -forceNative -off:simpleJit -bgJitDelay:0 %_dynamicprofileinput%
  346. )
  347. :: Variants after here are user supplied variants (not run by default).
  348. if "%_TESTCONFIG%"=="forcedeferparse" (
  349. set EXTRA_CC_FLAGS=%EXTRA_CC_FLAGS% -forceDeferParse %_dynamicprofilecache%
  350. set _exclude_forcedeferparse=-nottags:exclude_forcedeferparse
  351. )
  352. if "%_TESTCONFIG%"=="nodeferparse" (
  353. set EXTRA_CC_FLAGS=%EXTRA_CC_FLAGS% -noDeferParse %_dynamicprofilecache%
  354. set _exclude_nodeferparse=-nottags:exclude_nodeferparse
  355. )
  356. if "%_TESTCONFIG%"=="forceundodefer" (
  357. set EXTRA_CC_FLAGS=%EXTRA_CC_FLAGS% -forceUndoDefer %_dynamicprofilecache%
  358. set _exclude_forceundodefer=-nottags:exclude_forceundodefer
  359. )
  360. if "%_TESTCONFIG%"=="bytecodeserialized" (
  361. set EXTRA_CC_FLAGS=%EXTRA_CC_FLAGS% -recreatebytecodefile -serialized:%TEMP%\ByteCode
  362. set _exclude_serialized=-nottags:exclude_serialized
  363. )
  364. if "%_TESTCONFIG%"=="forceserialized" (
  365. set EXTRA_CC_FLAGS=%EXTRA_CC_FLAGS% -forceserialized
  366. set EXTRA_RL_FLAGS=-nottags:exclude_forceserialized
  367. set _exclude_serialized=-nottags:exclude_serialized
  368. )
  369. if "%_TESTCONFIG%"=="mediumlayout" (
  370. set EXTRA_CC_FLAGS=%EXTRA_CC_FLAGS% -MediumByteCodeLayout -forceserialized
  371. set EXTRA_RL_FLAGS=-nottags:exclude_bytecodelayout -nottags:exclude_forceserialized
  372. set _exclude_serialized=-nottags:exclude_serialized
  373. )
  374. if "%_TESTCONFIG%"=="largelayout" (
  375. set EXTRA_CC_FLAGS=%EXTRA_CC_FLAGS% -LargeByteCodeLayout -forceserialized
  376. set EXTRA_RL_FLAGS=-nottags:exclude_bytecodelayout -nottags:exclude_forceserialized
  377. set _exclude_serialized=-nottags:exclude_serialized
  378. )
  379. echo.
  380. echo ############# Starting %_TESTCONFIG% variant #############
  381. call :doSilent del /q %_logsRoot%\%_BuildArch%_%_BuildType%\%_TESTCONFIG%\rl*
  382. call :doSilent md %_logsRoot%\%_BuildArch%_%_BuildType%\%_TESTCONFIG%
  383. set _rlArgs=%_Binary%
  384. set _rlArgs=%_rlArgs% -target:%_BuildArchMapped%
  385. set _rlArgs=%_rlArgs% -nottags:fail
  386. set _rlArgs=%_rlArgs% %_RL_THREAD_FLAGS%
  387. set _rlArgs=%_rlArgs% %_DIRS%
  388. set _rlArgs=%_rlArgs% -verbose
  389. set _rlArgs=%_rlArgs% %_TAGS%
  390. set _rlArgs=%_rlArgs% %_NOTTAGS%
  391. set _rlArgs=%_rlArgs% %_DIRTAGS%
  392. set _rlArgs=%_rlArgs% %_DIRNOTTAGS%
  393. set _rlArgs=%_rlArgs% -nottags:fails_%_TESTCONFIG%
  394. set _rlArgs=%_rlArgs% -nottags:exclude_%_TESTCONFIG%
  395. set _rlArgs=%_rlArgs% -nottags:exclude_%TARGET_OS%
  396. set _rlArgs=%_rlArgs% -nottags:exclude_%_BuildArchMapped%
  397. set _rlArgs=%_rlArgs% -nottags:exclude_%_BuildTypeMapped%
  398. set _rlArgs=%_rlArgs% %_exclude_serialized%
  399. set _rlArgs=%_rlArgs% %_exclude_forcedeferparse%
  400. set _rlArgs=%_rlArgs% %_exclude_nodeferparse%
  401. set _rlArgs=%_rlArgs% %_exclude_forceundodefer%
  402. set _rlArgs=%_rlArgs% %_ExcludeApolloTests%
  403. set _rlArgs=%_rlArgs% %_quiet%
  404. set _rlArgs=%_rlArgs% -exe
  405. set _rlArgs=%_rlArgs% %EXTRA_RL_FLAGS%
  406. set _rlArgs=%_rlArgs% %_rebase%
  407. set REGRESS=%CD%
  408. call :do rl %_rlArgs%
  409. if %ERRORLEVEL% NEQ 0 set _HadFailures=1
  410. call :do move /Y %_logsRoot%\*.log %_logsRoot%\%_BuildArch%_%_BuildType%\%_TESTCONFIG%
  411. if %ERRORLEVEL% NEQ 0 set _HadFailures=1
  412. set EXTRA_CC_FLAGS=%_OLD_CC_FLAGS%
  413. goto :eof
  414. :: ============================================================================
  415. :: Clean up left over files
  416. :: ============================================================================
  417. :cleanUp
  418. call :doSilent del /s *.bc
  419. call :doSilent del /s *.out
  420. call :doSilent del /s *.dpl
  421. call :doSilent del /s profile.dpl.*
  422. call :doSilent del /s testout*
  423. if "%_CleanUpAll%" == "1" (
  424. call :doSilent del /s *.rebase
  425. )
  426. goto :eof
  427. :: ============================================================================
  428. :: Echo a command line before executing it
  429. :: ============================================================================
  430. :do
  431. echo ^>^> %*
  432. cmd /s /c "%*"
  433. if %ERRORLEVEL% NEQ 0 exit /b %ERRORLEVEL%
  434. goto :eof
  435. :: ============================================================================
  436. :: Echo a command line before executing it and redirect the command's output
  437. :: to nul
  438. :: ============================================================================
  439. :doSilent
  440. echo ^>^> %* ^> nul 2^>^&1
  441. cmd /s /c "%* > nul 2>&1"
  442. goto :eof