@@ -15,6 +15,32 @@ function VerifyPath($path, $errorMessage) {
1515 }
1616}
1717
18+ function CheckSubmoduleStatus () {
19+ $submoduleStatus = (git submodule status) | Out-String
20+ # if the result string is empty, the command failed to run (we didn't capture the error stream)
21+ if ($submoduleStatus ) {
22+ # git has been called successfully, what about the status?
23+ if (($submoduleStatus -match " \-" ) -or ($submoduleStatus -match " \(\(null\)\)" ))
24+ {
25+ # submodule has not been initialized!
26+ return 2 ;
27+ }
28+ elseif ($submoduleStatus -match " \+" )
29+ {
30+ # submodule is not synced:
31+ return 1 ;
32+ }
33+ else {
34+ # everything fine:
35+ return 0 ;
36+ }
37+ } else {
38+ # git call failed, so we should warn
39+ return 3 ;
40+ }
41+ }
42+
43+
1844if ( ($targetFramework -eq " netcoreapp2.0" ) -and ($env: CI -eq " True" ) -and ($is32Bit -ne " True" )) {
1945 # We execute CodeCoverage.cmd only for one specific job on CI (netcoreapp2.0 + 64bit )
2046 $testRunnerCmd = " .\tests\CodeCoverage\CodeCoverage.cmd"
@@ -64,4 +90,23 @@ Invoke-Expression $testRunnerCmd
6490
6591cd $PSScriptRoot
6692
67- exit $LASTEXITCODE
93+ $exitCodeOfTests = $LASTEXITCODE ;
94+
95+ if (0 -ne ([int ]$exitCodeOfTests )) {
96+ # check submodule status
97+ $submoduleStatus = CheckSubmoduleStatus
98+ if ([int ]$submoduleStatus -eq 1 ) {
99+ # not synced
100+ Write-Host - ForegroundColor Yellow " Check if submodules are up to date. You can use 'git submodule update' to fix this" ;
101+ } elseif ($submoduleStatus -eq 2 ) {
102+ # not initialized
103+ Write-Host - ForegroundColor Yellow " Check if submodules are initialized. You can run 'git submodule init' to initialize them."
104+ } elseif ($submoduleStatus -eq 3 ) {
105+ # git not found, maybe submodules not synced?
106+ Write-Host - ForegroundColor Yellow " Could not check if submodules are initialized correctly. Maybe git is not installed?"
107+ } else {
108+ # Write-Host "Submodules are up to date";
109+ }
110+ }
111+
112+ exit $exitCodeOfTests
0 commit comments