name: Run LIT testsuite
inputs:
  arch:
    required: false # Windows only
runs:
  using: composite
  steps:

    - name: 'Posix: Run LIT testsuite'
      if: runner.os != 'Windows'
      shell: bash
      # temporarily add LLVM bin dir to PATH, so that e.g. wasm-ld is found
      run: cd ../build && PATH="$PWD/../llvm/bin:$PATH" ctest -V -R "lit-tests"

    - name: 'Windows: Run LIT testsuite'
      if: runner.os == 'Windows'
      shell: cmd
      run: |
        echo on
        :: * strings_cdb has regressed for 32-bit starting with the VS 2019 v16.6.0 Azure Image (worked fine until v16.5.4)
        ::   it also works fine on my box with the same v16.7.2...
        :: * msvc_dwarf spuriously hits LLD assertions with v13.* and v14.0.0
        if "${{ inputs.arch }}" == "x86" (
          del tests\debuginfo\strings_cdb.d || exit /b
          del tests\debuginfo\msvc_dwarf.d || exit /b
        )
        call "%LDC_VSDIR%\Common7\Tools\VsDevCmd.bat" -arch=${{ inputs.arch }} || exit /b
        echo on
        cd ..\build || exit /b
        ctest -V -R "lit-tests" || exit /b
