|
| 1 | +name: 'Run SYCL CTS tests on Windows' |
| 2 | + |
| 3 | +inputs: |
| 4 | + ref: |
| 5 | + description: "Commit SHA or branch to checkout tests" |
| 6 | + required: false |
| 7 | + default: "main" |
| 8 | + extra_cmake_args: |
| 9 | + required: false |
| 10 | + cts_testing_mode: |
| 11 | + required: true |
| 12 | + sycl_cts_artifact: |
| 13 | + require: false |
| 14 | + target_devices: |
| 15 | + required: true |
| 16 | + retention-days: |
| 17 | + required: false |
| 18 | + |
| 19 | +runs: |
| 20 | + using: "composite" |
| 21 | + steps: |
| 22 | + - name: Checkout SYCL CTS tests |
| 23 | + if: inputs.cts_testing_mode != 'run-only' |
| 24 | + uses: ./devops/actions/cached_checkout |
| 25 | + with: |
| 26 | + path: khronos_sycl_cts |
| 27 | + repository: 'KhronosGroup/SYCL-CTS' |
| 28 | + ref: ${{ inputs.ref }} |
| 29 | + cache_path: "D:\\\\github\\\\_work\\\\repo_cache\\\\" |
| 30 | + - name: SYCL CTS GIT submodules init |
| 31 | + if: inputs.cts_testing_mode != 'run-only' |
| 32 | + shell: bash |
| 33 | + run: | |
| 34 | + git -C khronos_sycl_cts submodule update --init |
| 35 | + - name: Build SYCL CTS tests |
| 36 | + if: inputs.cts_testing_mode != 'run-only' |
| 37 | + shell: bash |
| 38 | + env: |
| 39 | + CMAKE_EXTRA_ARGS: ${{ inputs.extra_cmake_args }} |
| 40 | + run: | |
| 41 | + cts_exclude_filter="" |
| 42 | + # If CTS_TESTS_TO_BUILD is null - use filter |
| 43 | + if [ -z "$CTS_TESTS_TO_BUILD" ]; then |
| 44 | + if [ "${{ contains(inputs.cts_testing_mode, 'build-only') }}" = "true" ]; then |
| 45 | + cts_exclude_filter=$PWD/devops/cts_exclude_filter_compfails |
| 46 | + elif [ "${{ contains(inputs.target_devices, 'opencl:cpu') }}" = "true" ]; then |
| 47 | + cts_exclude_filter=$PWD/devops/cts_exclude_filter_OCL_CPU |
| 48 | + elif [ "${{ contains(inputs.target_devices, 'level_zero:gpu') }}" = "true" ]; then |
| 49 | + cts_exclude_filter=$PWD/devops/cts_exclude_filter_L0_GPU |
| 50 | + fi |
| 51 | +
|
| 52 | + # List excluded SYCL CTS categories: |
| 53 | + # SYCL_CTS_EXCLUDE_TEST_CATEGORIES - Optional file specifying a list |
| 54 | + # of test categories to be excluded from the build. |
| 55 | + echo "::group::Excluded test categories" |
| 56 | + cat $cts_exclude_filter |
| 57 | + echo "::endgroup::" |
| 58 | + fi |
| 59 | +
|
| 60 | + cmake -GNinja -B./build-cts -S./khronos_sycl_cts \ |
| 61 | + -DSYCL_IMPLEMENTATION=DPCPP \ |
| 62 | + -DSYCL_CTS_EXCLUDE_TEST_CATEGORIES="$cts_exclude_filter" \ |
| 63 | + -DSYCL_CTS_ENABLE_OPENCL_INTEROP_TESTS=OFF \ |
| 64 | + -DDPCPP_INSTALL_DIR="$(dirname $(which clang++))/.." \ |
| 65 | + -DCMAKE_CXX_COMPILER=cl \ |
| 66 | + -DCMAKE_BUILD_TYPE=Release \ |
| 67 | + $CMAKE_EXTRA_ARGS |
| 68 | + # Ignore errors so that if one category build fails others still have a |
| 69 | + # chance to finish and be executed at the run stage. Note that |
| 70 | + # "test_conformance" target skips building "test_all" executable. |
| 71 | + ninja -C build-cts -k0 $( [ -n "$CTS_TESTS_TO_BUILD" ] && echo "$CTS_TESTS_TO_BUILD" || echo "test_conformance") |
| 72 | +
|
| 73 | + - name: Pack SYCL-CTS binaries |
| 74 | + if: always() && !cancelled() && inputs.cts_testing_mode == 'build-only' |
| 75 | + shell: bash |
| 76 | + run: tar -I 'zstd -9' -cf sycl_cts_bin.tar.zst -C ./build-cts/bin . |
| 77 | + |
| 78 | + - name: Upload SYCL-CTS binaries |
| 79 | + if: always() && !cancelled() && inputs.cts_testing_mode == 'build-only' |
| 80 | + uses: actions/upload-artifact@v4 |
| 81 | + with: |
| 82 | + name: ${{ inputs.sycl_cts_artifact }} |
| 83 | + path: sycl_cts_bin.tar.zst |
| 84 | + retention-days: ${{ inputs.retention-days }} |
| 85 | + |
| 86 | + - name: Download SYCL-CTS binaries |
| 87 | + if: inputs.cts_testing_mode == 'run-only' |
| 88 | + uses: actions/download-artifact@v4 |
| 89 | + with: |
| 90 | + name: ${{ inputs.sycl_cts_artifact }} |
| 91 | + |
| 92 | + - name: Extract SYCL-CTS binaries |
| 93 | + if: inputs.cts_testing_mode == 'run-only' |
| 94 | + shell: bash |
| 95 | + run: | |
| 96 | + mkdir -p build-cts/bin |
| 97 | + tar -I 'zstd' -xf sycl_cts_bin.tar.zst -C build-cts/bin |
| 98 | +
|
| 99 | + - name: SYCL CTS List devices |
| 100 | + # Proceed with execution even if the 'build' step did not succeed. |
| 101 | + if: (always() && !cancelled()) && inputs.cts_testing_mode != 'build-only' |
| 102 | + shell: bash |
| 103 | + env: |
| 104 | + ONEAPI_DEVICE_SELECTOR: ${{ inputs.target_devices }} |
| 105 | + run: | |
| 106 | + ./build-cts/bin/* --list-devices |
| 107 | +
|
| 108 | + # If the suite was built on another machine then the build contains the full |
| 109 | + # set of tests. We have special files to filter out some test categories, |
| 110 | + # see "devops/cts_exclude_filter_*". Each configuration has its own file, e.g. |
| 111 | + # there is "cts_exclude_filter_OCL_CPU" for opencl:cpu device. Therefore, |
| 112 | + # these files may differ from each other, so when there is a pre-built set of |
| 113 | + # tests, we need to filter it according to the filter-file. |
| 114 | + - name: Filter SYCL CTS test categories |
| 115 | + if: inputs.cts_testing_mode == 'run-only' |
| 116 | + shell: bash |
| 117 | + run: | |
| 118 | + cts_exclude_filter="" |
| 119 | + if [ "${{ contains(inputs.target_devices, 'opencl:cpu') }}" = "true" ]; then |
| 120 | + cts_exclude_filter=$PWD/devops/cts_exclude_filter_OCL_CPU |
| 121 | + elif [ "${{ contains(inputs.target_devices, 'level_zero:gpu') }}" = "true" ]; then |
| 122 | + cts_exclude_filter=$PWD/devops/cts_exclude_filter_L0_GPU |
| 123 | + fi |
| 124 | +
|
| 125 | + while IFS= read -r line; do |
| 126 | + if [[ $line != \#* ]]; then |
| 127 | + rm "./build-cts/bin/test_$line" |
| 128 | + fi |
| 129 | + done < "$cts_exclude_filter" |
| 130 | +
|
| 131 | + - name: Run SYCL CTS tests |
| 132 | + # Proceed with execution even if the previous two steps did not succeed. |
| 133 | + if: (always() && !cancelled()) && inputs.cts_testing_mode != 'build-only' |
| 134 | + env: |
| 135 | + ONEAPI_DEVICE_SELECTOR: ${{ inputs.target_devices }} |
| 136 | + # By-default GitHub actions execute the "run" shell script with -e option, |
| 137 | + # so the execution terminates if any command returns a non-zero status. |
| 138 | + # Since we're using a loop to run all test-binaries separately, some test |
| 139 | + # may fail and terminate the execution. Setting "shell" value to override |
| 140 | + # the default behavior. |
| 141 | + # https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#custom-shell |
| 142 | + shell: bash {0} |
| 143 | + run: | |
| 144 | + # Run each test category separately so that |
| 145 | + # - crash on one would not affect others |
| 146 | + # - multiple tests could be run in parallel |
| 147 | + mkdir logs |
| 148 | + find build-cts/bin/ -type f -print | \ |
| 149 | + xargs -t -I % -P 8 sh -c 'log=logs/$(basename %).log ; echo % >$log ; date >>$log ; timeout 60m % >>$log 2>&1 ; ret=$? ; echo "exit code: $ret" >>$log ; date >>$log ; exit $ret' |
| 150 | + ret=$? |
| 151 | +
|
| 152 | + for f in logs/* ; do |
| 153 | + echo "::group::$f" |
| 154 | + cat $f |
| 155 | + echo "::endgroup::" |
| 156 | + done |
| 157 | +
|
| 158 | + echo "::group::Fails:" |
| 159 | + grep 'exit code: [^0]' -r logs |
| 160 | + echo "::endgroup::" |
| 161 | +
|
| 162 | + grep 'exit code: [^0]' -r logs >> $GITHUB_STEP_SUMMARY |
| 163 | +
|
| 164 | + exit $ret |
0 commit comments