From bc796d1d95bc5097d3682af4a9e9db6d419434f8 Mon Sep 17 00:00:00 2001 From: Jeremy Day Date: Thu, 7 Mar 2024 07:09:40 -0800 Subject: [PATCH] Run test in Powershell script --- .github/workflows/swift-toolchain.yml | 18 ++---------------- tests/sourcekit-lsp/initialization-test.ps1 | 11 +++++++++++ .../sourcekit-lsp-initialization-message | 0 3 files changed, 13 insertions(+), 16 deletions(-) create mode 100644 tests/sourcekit-lsp/initialization-test.ps1 rename tests/{ => sourcekit-lsp}/sourcekit-lsp-initialization-message (100%) diff --git a/.github/workflows/swift-toolchain.yml b/.github/workflows/swift-toolchain.yml index 32ba69ee2..b00b25bbb 100644 --- a/.github/workflows/swift-toolchain.yml +++ b/.github/workflows/swift-toolchain.yml @@ -2490,23 +2490,9 @@ jobs: - name: SourceKit Validation id: sourcekit-validation working-directory: ${{ github.workspace }}/SourceCache/swift-win32 - continue-on-error: true run: | - $diagnosticOutput = $( $output = & Get-Content ${{ github.workspace }}/tests/sourcekit-lsp-initialization-message | sourcekit-lsp.exe ) 2>&1 - if (-not ($diagnosticOutput -Match "Succeeded") -or -not ($diagnosticOutput -Match "InitializeResult")) { - Write-Host "sourcekit-lsp failed to initialize" - Write-Host $diagnosticOutput - echo "failed=true" >> $GITHUB_OUTPUT - } else { - echo "failed=false" >> $GITHUB_OUTPUT - } - - - name: SourceKit Validation Check - run: | - if (${{ steps.sourcekit-validation.outputs.failed == 'true' }}) { - Write-Host "sourcekit-lsp failed to initialize" - exit 1 - } + $SourcekitLspPath = (Resolve-Path sourcekit-lsp.exe).Path + powershell.exe -File ${{ github.workspace }}/tests/sourcekit-lsp/initialization-test.ps1 -PathToSourcekitLsp $SourcekitLspPath snapshot: runs-on: ubuntu-latest diff --git a/tests/sourcekit-lsp/initialization-test.ps1 b/tests/sourcekit-lsp/initialization-test.ps1 new file mode 100644 index 000000000..930eaeb84 --- /dev/null +++ b/tests/sourcekit-lsp/initialization-test.ps1 @@ -0,0 +1,11 @@ +param( + [Parameter(Mandatory)] + [string] $PathToSourcekitLsp +) + +$diagnosticOutput = $( & Get-Content sourcekit-lsp-initialization-message | & $PathToSourcekitLsp ) 2>&1 +if (-not ($diagnosticOutput -Match "Succeeded") -or -not ($diagnosticOutput -Match "InitializeResult")) { + Write-Host "sourcekit-lsp failed to initialize" + Write-Host $diagnosticOutput + exit 1 +} \ No newline at end of file diff --git a/tests/sourcekit-lsp-initialization-message b/tests/sourcekit-lsp/sourcekit-lsp-initialization-message similarity index 100% rename from tests/sourcekit-lsp-initialization-message rename to tests/sourcekit-lsp/sourcekit-lsp-initialization-message