Browse code

Windows CI: Dump possible panic log

Signed-off-by: John Howard <jhoward@microsoft.com>

John Howard authored on 2019/02/06 02:17:40
Showing 1 changed files
... ...
@@ -105,7 +105,7 @@ if ($env:BUILD_TAG -match "-WoW") { $env:LCOW_MODE="" }
105 105
 # -------------------------------------------------------------------------------------------
106 106
 
107 107
 
108
-$SCRIPT_VER="28-Aug-2018 09:33 PDT" 
108
+$SCRIPT_VER="05-Feb-2019 09:03 PDT" 
109 109
 $FinallyColour="Cyan"
110 110
 
111 111
 #$env:DOCKER_DUT_DEBUG="yes" # Comment out to not be in debug mode
... ...
@@ -625,7 +625,6 @@ Try {
625 625
 
626 626
         $tries--
627 627
         if ($tries -le 0) {
628
-            $DumpDaemonLog=1
629 628
             Throw "ERROR: Failed to get a response from the daemon under test"
630 629
         }
631 630
         Write-Host -NoNewline "."
... ...
@@ -641,7 +640,6 @@ Try {
641 641
     $ErrorActionPreference = "Stop"
642 642
     if ($LastExitCode -ne 0) {
643 643
         Throw "ERROR: The daemon under test does not appear to be running."
644
-        $DumpDaemonLog=1
645 644
     }
646 645
     Write-Host
647 646
 
... ...
@@ -653,7 +651,6 @@ Try {
653 653
     $ErrorActionPreference = "Stop"
654 654
     if ($LastExitCode -ne 0) {
655 655
         Throw "ERROR: The daemon under test does not appear to be running."
656
-        $DumpDaemonLog=1
657 656
     }
658 657
     Write-Host
659 658
 
... ...
@@ -665,7 +662,6 @@ Try {
665 665
     $ErrorActionPreference = "Stop"
666 666
     if ($LastExitCode -ne 0) {
667 667
         Throw "ERROR: The daemon under test does not appear to be running."
668
-        $DumpDaemonLog=1
669 668
     }
670 669
     Write-Host
671 670
 
... ...
@@ -788,7 +784,6 @@ Try {
788 788
             $ErrorActionPreference = "Stop"
789 789
             if ($LastExitCode -ne 0) {
790 790
                 Throw "ERROR: The daemon under test does not appear to be running."
791
-                $DumpDaemonLog=1
792 791
             }
793 792
             Write-Host
794 793
         }
... ...
@@ -923,7 +918,6 @@ Try {
923 923
         $ErrorActionPreference = "Stop"
924 924
         if ($LastExitCode -ne 0) {
925 925
             Throw "ERROR: The daemon under test does not appear to be running."
926
-            $DumpDaemonLog=1
927 926
         }
928 927
         Write-Host
929 928
     }
... ...
@@ -969,19 +963,19 @@ Finally {
969 969
     if ($null -ne $origGOROOT) { $env:GOROOT=$origGOROOT }
970 970
     if ($null -ne $origGOPATH) { $env:GOPATH=$origGOPATH }
971 971
 
972
-    # Dump the daemon log if asked to 
973
-    if ($daemonStarted -eq 1) {
974
-        if ($dumpDaemonLog -eq 1) {
975
-            Write-Host -ForegroundColor Cyan "----------- DAEMON LOG ------------"
976
-            Get-Content "$env:TEMP\dut.err" -ErrorAction SilentlyContinue | Write-Host -ForegroundColor Cyan
977
-            Write-Host -ForegroundColor Cyan "----------- END DAEMON LOG --------"
978
-        }
972
+    # Dump the daemon log. This will include any possible panic stack in the .err.
973
+    if (($daemonStarted -eq 1) -and  ($(Get-Item "$env:TEMP\dut.err").Length -gt 0)) {
974
+        Write-Host -ForegroundColor Cyan "----------- DAEMON LOG ------------"
975
+        Get-Content "$env:TEMP\dut.err" -ErrorAction SilentlyContinue | Write-Host -ForegroundColor Cyan
976
+        Write-Host -ForegroundColor Cyan "----------- END DAEMON LOG --------"
979 977
     }
980 978
 
981 979
     # Save the daemon under test log
982 980
     if ($daemonStarted -eq 1) {
983
-        Write-Host -ForegroundColor Green "INFO: Saving daemon under test log ($env:TEMP\dut.err) to $TEMPORIG\CIDUT.log"
984
-        Copy-Item  "$env:TEMP\dut.err" "$TEMPORIG\CIDUT.log" -Force -ErrorAction SilentlyContinue
981
+        Write-Host -ForegroundColor Green "INFO: Saving daemon under test log ($env:TEMP\dut.out) to $TEMPORIG\CIDUT.out"
982
+        Copy-Item  "$env:TEMP\dut.out" "$TEMPORIG\CIDUT.out" -Force -ErrorAction SilentlyContinue
983
+        Write-Host -ForegroundColor Green "INFO: Saving daemon under test log ($env:TEMP\dut.err) to $TEMPORIG\CIDUT.err"
984
+        Copy-Item  "$env:TEMP\dut.err" "$TEMPORIG\CIDUT.err" -Force -ErrorAction SilentlyContinue
985 985
     }
986 986
 
987 987
     Set-Location "$env:SOURCES_DRIVE\$env:SOURCES_SUBDIR" -ErrorAction SilentlyContinue