Kaynağa Gözat

Some script fixes

Doug Ilijev 8 yıl önce
ebeveyn
işleme
7fb23bd6cf
2 değiştirilmiş dosya ile 14 ekleme ve 8 silme
  1. 13 6
      test/jenkins.testone.cmd
  2. 1 2
      test/runnativetests.cmd

+ 13 - 6
test/jenkins.testone.cmd

@@ -30,6 +30,7 @@ setlocal
 
 set _RootDir=%~dp0..
 set _HadFailures=0
+set _error=0
 
 :: ============================================================================
 :: Main script
@@ -88,7 +89,7 @@ set _HadFailures=0
 
   call :do %_TestDir%\runtests.cmd -%1 -quiet -cleanupall -nottags exclude_jenkins %_ExtraTestArgs% -binDir %_BinDir%
 
-  if "%ERRORLEVEL%" NEQ "0" (
+  if "%_error%" NEQ "0" (
     echo -- jenkins.testone.cmd ^>^> runtests.cmd failed
     set _HadFailures=3
   )
@@ -101,13 +102,15 @@ set _HadFailures=0
 :runNativeTests
 
   echo -- jenkins.testone.cmd ^>^> Running native tests... (this can take some time)
+  :: ensure the _LogDir exists
+  mkdir %_LogDir%
   set _LogFile=%_LogDir%\nativetests.log
   call :do %_TestDir%\runnativetests.cmd -%1 -binDir %_BinDir% > %_LogFile% 2>&1
   echo -- jenkins.testone.cmd ^>^> Running native tests... DONE!
 
-  if "%ERRORLEVEL%" NEQ "0" (
-    echo -- jenkins.testone.cmd ^>^> runnativetests.cmd failed (printing %_LogFile% below)
-    powershell "if (Test-Path %_LogFile%) { Get-Content  %_LogFile% }"
+  if "%_error%" NEQ "0" (
+    echo -- jenkins.testone.cmd ^>^> runnativetests.cmd failed; printing %_LogFile%
+    powershell "if (Test-Path %_LogFile%) { Get-Content %_LogFile% }"
     set _HadFailures=4
   )
 
@@ -122,6 +125,8 @@ set _HadFailures=0
   findstr /sp failed rl.results.log > summary.log
   findstr /sip failed nativetests.log >> summary.log
   rem Echo to stderr so that VSO includes the output in the build summary
+
+  echo -- jenkins.testone.cmd ^>^> Printing summary...
   type summary.log 1>&2
   popd
 
@@ -130,8 +135,9 @@ set _HadFailures=0
 :: ============================================================================
 :do
 
-  echo -- jenkins.testone.cmd ^>^> %*
+  echo -- jenkins.testone.cmd ^>^> :do %*
   cmd /s /c "%*"
+  set _error=%ERRORLEVEL%
 
   goto :eof
 
@@ -141,7 +147,8 @@ set _HadFailures=0
 :: ============================================================================
 :doSilent
 
-  echo -- jenkins.testone.cmd ^>^> %* ^> nul 2^>^&1
+  echo -- jenkins.testone.cmd ^>^> :doSilent %* ^> nul 2^>^&1
   cmd /s /c "%* > nul 2>&1"
+  set _error=%ERRORLEVEL%
 
   goto :eof

+ 1 - 2
test/runnativetests.cmd

@@ -52,7 +52,6 @@ goto :main
 :: ============================================================================
 :main
 
-
   call :initVars
   call :parseArgs %*
 
@@ -185,7 +184,6 @@ goto :main
   pushd %_TestTempDir%
   echo -- runnativetests.cmd ^>^> Calling %cd%\nativetests.exe with additional args: %_NativeTestArgs%
   call :do nativetests.exe %_NativeTestArgs%
-  set _error=%ERRORLEVEL%
   if "%_error%" NEQ "0" (
     set _HadFailures=1
   )
@@ -212,6 +210,7 @@ goto :main
 
   echo ^>^> %*
   cmd /s /c "%*"
+  set _error=%ERRORLEVEL%
 
   goto :eof