|
| 1 | +name: Windows Nano Server tests |
| 2 | + |
| 3 | +on: |
| 4 | + workflow_dispatch: |
| 5 | + |
| 6 | +env: |
| 7 | + DEVELOPER: 1 |
| 8 | + |
| 9 | +jobs: |
| 10 | + test-nano-server: |
| 11 | + runs-on: windows-2022 |
| 12 | + env: |
| 13 | + WINDBG_DIR: "C:/Program Files (x86)/Windows Kits/10/Debuggers/x64" |
| 14 | + IMAGE: mcr.microsoft.com/powershell:nanoserver-ltsc2022 |
| 15 | + |
| 16 | + steps: |
| 17 | + - uses: actions/checkout@v3 |
| 18 | + - uses: git-for-windows/setup-git-for-windows-sdk@v1 |
| 19 | + - name: build Git |
| 20 | + shell: bash |
| 21 | + run: make -j15 |
| 22 | + - name: pull nanoserver image |
| 23 | + shell: bash |
| 24 | + run: docker pull $IMAGE |
| 25 | + - name: run nano-server test |
| 26 | + shell: bash |
| 27 | + run: | |
| 28 | + docker run \ |
| 29 | + --user "ContainerAdministrator" \ |
| 30 | + -v "$WINDBG_DIR:C:/dbg" \ |
| 31 | + -v "$(cygpath -aw /mingw64/bin):C:/mingw64-bin" \ |
| 32 | + -v "$(cygpath -aw .):C:/test" \ |
| 33 | + $IMAGE pwsh.exe -Command ' |
| 34 | + # Extend the PATH to include the `.dll` files in /mingw64/bin/ |
| 35 | + $env:PATH += ";C:\mingw64-bin" |
| 36 | +
|
| 37 | + # For each executable to test pick some no-operation set of |
| 38 | + # flags/subcommands or something that should quickly result in an |
| 39 | + # error with known exit code that is not a negative 32-bit |
| 40 | + # number, and set the expected return code appropriately. |
| 41 | + # |
| 42 | + # Only test executables that could be expected to run in a UI |
| 43 | + # less environment. |
| 44 | + # |
| 45 | + # ( Executable path, arguments, expected return code ) |
| 46 | + # also note space is required before close parenthesis (a |
| 47 | + # powershell quirk when defining nested arrays like this) |
| 48 | +
|
| 49 | + $executables_to_test = @( |
| 50 | + ("C:\test\git.exe", "", 1 ), |
| 51 | + ("C:\test\scalar.exe", "version", 0 ) |
| 52 | + ) |
| 53 | +
|
| 54 | + foreach ($executable in $executables_to_test) |
| 55 | + { |
| 56 | + Write-Output "Now testing $($executable[0])" |
| 57 | + &$executable[0] $executable[1] |
| 58 | + if ($LASTEXITCODE -ne $executable[2]) { |
| 59 | + # if we failed, run the debugger to find out what function |
| 60 | + # or DLL could not be found and then exit the script with |
| 61 | + # failure The missing DLL or EXE will be referenced near |
| 62 | + # the end of the output |
| 63 | +
|
| 64 | + # Set a flag to have the debugger show loader stub |
| 65 | + # diagnostics. This requires running as administrator, |
| 66 | + # otherwise the flag will be ignored. |
| 67 | + C:\dbg\gflags -i $executable[0] +SLS |
| 68 | +
|
| 69 | + C:\dbg\cdb.exe -c "g" -c "q" $executable[0] $executable[1] |
| 70 | +
|
| 71 | + exit 1 |
| 72 | + } |
| 73 | + } |
| 74 | +
|
| 75 | + exit 0 |
| 76 | + ' |
0 commit comments