Browse code

Merge pull request #39854 from thaJeztah/hack_windows_explicit_exit

hack/ci/windows.ps1: explicitly set exit code to result of tests

Brian Goff authored on 2019/09/13 03:34:44
Showing 1 changed files
... ...
@@ -15,6 +15,11 @@ if ($env:BUILD_TAG -match "-LoW") { $env:LCOW_MODE=1 }
15 15
 if ($env:BUILD_TAG -match "-WoW") { $env:LCOW_MODE="" }
16 16
 
17 17
 
18
+Write-Host -ForegroundColor Red "DEBUG: print all environment variables to check how Jenkins runs this script"
19
+$allArgs = [Environment]::GetCommandLineArgs()
20
+Write-Host -ForegroundColor Red $allArgs
21
+Write-Host -ForegroundColor Red "----------------------------------------------------------------------------"
22
+
18 23
 # -------------------------------------------------------------------------------------------
19 24
 # When executed, we rely on four variables being set in the environment:
20 25
 #
... ...
@@ -979,6 +984,9 @@ Catch [Exception] {
979 979
     Throw $_
980 980
 }
981 981
 Finally {
982
+    # Preserve the LastExitCode of the tests
983
+    $tmpLastExitCode = $LastExitCode
984
+
982 985
     $ErrorActionPreference="SilentlyContinue"
983 986
     $global:ProgressPreference=$origProgressPreference
984 987
     Write-Host  -ForegroundColor Green "INFO: Tidying up at end of run"
... ...
@@ -1016,4 +1024,6 @@ Finally {
1016 1016
 
1017 1017
     $Dur=New-TimeSpan -Start $StartTime -End $(Get-Date)
1018 1018
     Write-Host -ForegroundColor $FinallyColour "`nINFO: executeCI.ps1 exiting at $(date). Duration $dur`n"
1019
+
1020
+    exit $tmpLastExitCode
1019 1021
 }