Skip to content

Commit c6f5618

Browse files
authored
[CI] Build each SYCL-CTS category separately (#13421)
1 parent 4ade7b7 commit c6f5618

File tree

1 file changed

+44
-29
lines changed

1 file changed

+44
-29
lines changed

.github/workflows/sycl-linux-run-tests.yml

Lines changed: 44 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -300,25 +300,53 @@ jobs:
300300
if: inputs.tests_selector == 'cts'
301301
env:
302302
CMAKE_EXTRA_ARGS: ${{ inputs.extra_cmake_args }}
303+
# Continue execution if some category fails to build.
304+
shell: bash {0}
305+
# Compile each binary individually; if a failure occurs during the
306+
# 'test_all' build, the entire build will be affected.
303307
run: |
304308
cmake -GNinja -B./build-cts -S./khronos_sycl_cts -DCMAKE_CXX_COMPILER=$(which clang++) \
305309
-DSYCL_IMPLEMENTATION=DPCPP \
306310
-DSYCL_CTS_EXCLUDE_TEST_CATEGORIES="$PWD/devops/cts_exclude_filter" \
307311
-DSYCL_CTS_ENABLE_OPENCL_INTEROP_TESTS=OFF \
308312
-DSYCL_CTS_MEASURE_BUILD_TIMES=ON \
309-
-DDPCPP_INSTALL_DIR="$$(dirname (which clang++))/.." \
310-
$CMAKE_EXTRA_ARGS
311-
ninja -C build-cts
313+
-DDPCPP_INSTALL_DIR="$(dirname $(which clang++))/.." \
314+
$CMAKE_EXTRA_ARGS | tee "cmake_output.txt"
315+
316+
# Get names of all added test-categories:
317+
categories=$(grep -o '^-- Adding test: test_[a-zA-Z0-9_]*' "./cmake_output.txt" | sed 's/^-- Adding test: //')
318+
319+
number_of_test_categories=$(echo $categories | wc -w)
320+
iteration=1
321+
failed_to_build=""
322+
323+
for i in $categories; do
324+
echo "::group::Building $i ($iteration of $number_of_test_categories)"
325+
ninja -C build-cts $i
326+
[ $? -ne 0 ] && failed_to_build+=$i'\n'
327+
echo "::endgroup::"
328+
((iteration++))
329+
done
330+
331+
if [ -n "$failed_to_build" ]; then
332+
echo -e "Failed to build:\n$failed_to_build"
333+
echo -e "Failed to build:\n$failed_to_build" >> $GITHUB_STEP_SUMMARY
334+
exit 1
335+
fi
336+
337+
exit 0
312338
313339
- name: SYCL CTS List devices
314-
if: inputs.tests_selector == 'cts'
340+
# Proceed with execution even if the 'build' step did not succeed.
341+
if: inputs.tests_selector == 'cts' && (success() || failure())
315342
env:
316343
ONEAPI_DEVICE_SELECTOR: ${{ inputs.target_devices }}
317344
run: |
318-
./build-cts/bin/test_all --list-devices
345+
./build-cts/bin/* --list-devices
319346
320347
- name: Run SYCL CTS tests
321-
if: inputs.tests_selector == 'cts'
348+
# Proceed with execution even if the previous two steps did not succeed.
349+
if: inputs.tests_selector == 'cts' && (success() || failure())
322350
env:
323351
ONEAPI_DEVICE_SELECTOR: ${{ inputs.target_devices }}
324352
# This job takes ~100min usually. But sometimes some test isn't
@@ -331,33 +359,20 @@ jobs:
331359
# the default behavior.
332360
# https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#custom-shell
333361
shell: bash {0}
334-
# FIXME: For some reason the "sub_group api" test-case is failing with
335-
# SIGSEGV while running test_all, so running each binary separately.
336-
# BTW test_all requires a lot of resources to build it, so probably it'll
337-
# be better to build each binary also separately.
338-
# run: |
339-
# ./build-cts/bin/test_all $CTS_TEST_ARGS
340362
run: |
341-
status=""
342363
failed_suites=""
364+
343365
for i in `ls -1 ./build-cts/bin`; do
344-
if [ "$i" != "test_all" ]; then
345-
echo "::group::Running $i"
346-
build-cts/bin/$i
347-
if [ $? -ne 0 ]; then
348-
status=1
349-
if [$failed_suites == ""]; then
350-
failed_suites=$i
351-
else
352-
failed_suites="$failed_suites, $i"
353-
fi
354-
fi
355-
echo "::endgroup::"
356-
fi
366+
echo "::group::Running $i"
367+
build-cts/bin/$i
368+
[ $? -ne 0 ] && failed_suites+=$i'\n'
369+
echo "::endgroup::"
357370
done
358-
if [ -n "$status" ]; then
359-
echo "Failed suite(s): $failed_suites"
360-
echo "Failed suite(s): $failed_suites" >> $GITHUB_STEP_SUMMARY
371+
372+
if [ -n "$failed_suites" ]; then
373+
echo -e "Failed suite(s): $failed_suites"
374+
echo -e "Failed suite(s): $failed_suites" >> $GITHUB_STEP_SUMMARY
361375
exit 1
362376
fi
377+
363378
exit 0

0 commit comments

Comments
 (0)