Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Linux / CPU x86-64 / CTS+Sanitizers #30

Linux / CPU x86-64 / CTS+Sanitizers

Linux / CPU x86-64 / CTS+Sanitizers #30

---
name: Linux / CPU x86-64 / CTS+Sanitizers
permissions:
contents: read
on:
workflow_dispatch:
schedule:
# at 7:11 UTC every wednesday
- cron: '11 7 * * 3'
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref || github.run_id }}
cancel-in-progress: true
jobs:
cts_san_matrix:
name: LLVM ${{ matrix.llvm }} - ${{ matrix.config }}
runs-on: [self-hosted, linux, x64, "${{ matrix.config }}" ]
# CPU runners have action runner directly in the home directory
env:
CCACHE_BASEDIR: "${{ github.workspace }}"
CCACHE_DIR: "${{ github.workspace }}/../../../ccache_storage"
EXAMPLES_DIR: "${{ github.workspace }}/../../../examples"
TSAN_OPTIONS: "second_deadlock_stack=1"
strategy:
fail-fast: false
matrix:
# cts_asan = CTS build with AddressSanitizer
# cts_tsan = CTS build with ThreadSanitizer
include:
- llvm: 20
config: cts_tsan
- llvm: 21
config: cts_asan
steps:
- name: Checkout
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8
- name: Load Env vars
id: load-env
run: |
cat ${{ github.workspace }}/.github/variables.txt >> $GITHUB_ENV
- name: CMake
id: cmake
run: |
runCMake() {
BUILD_FLAGS="-O1 -ggdb -g3 -fno-omit-frame-pointer -march=native"
cmake -DCMAKE_C_COMPILER_LAUNCHER=ccache -DCMAKE_CXX_COMPILER_LAUNCHER=ccache \
-DCMAKE_BUILD_TYPE=RelWithDebInfo "-DCMAKE_C_FLAGS_RELWITHDEBINFO=$BUILD_FLAGS" \
"-DCMAKE_CXX_FLAGS_RELWITHDEBINFO=$BUILD_FLAGS" \
-DWITH_LLVM_CONFIG=/usr/bin/llvm-config-${{ matrix.llvm }} -DLLVM_SPIRV=/usr/bin/llvm-spirv-${{ matrix.llvm }} \
"$@" -B ${{ github.workspace }}/build ${{ github.workspace }}
}
rm -rf ${{ github.workspace }}/build
mkdir ${{ github.workspace }}/build
if [ "${{ matrix.config }}" == "cts_asan" ]; then
mkdir -p ${EXAMPLES_DIR}/build_cts_asan
mkdir -p ${EXAMPLES_DIR}/source
runCMake -DENABLE_ICD=0 -DENABLE_ASAN=1 -DENABLE_LOADABLE_DRIVERS=0 -DENABLE_TESTSUITES=conformance -DENABLE_CONFORMANCE=ON -DTESTSUITE_SOURCE_BASEDIR=${EXAMPLES_DIR}/source -DTESTSUITE_BASEDIR=${EXAMPLES_DIR}/build_cts_asan
elif [ "${{ matrix.config }}" == "cts_tsan" ]; then
mkdir -p ${EXAMPLES_DIR}/build_cts_tsan
mkdir -p ${EXAMPLES_DIR}/source
runCMake -DENABLE_ICD=0 -DENABLE_TSAN=1 -DENABLE_LOADABLE_DRIVERS=0 -DENABLE_TESTSUITES=conformance -DENABLE_CONFORMANCE=ON -DTESTSUITE_SOURCE_BASEDIR=${EXAMPLES_DIR}/source -DTESTSUITE_BASEDIR=${EXAMPLES_DIR}/build_cts_tsan
else
echo "Unknown configuration" && exit 1
fi
- name: Build PoCL
id: build_pocl
timeout-minutes: 30
run: |
cd ${{ github.workspace }}/build && make -j$(${{ github.workspace }}/.github/scripts/get_cpus.sh)
- name: Build CTS Examples
id: build_cts_examples
# occasionally git timeouts on git clone of the examples
timeout-minutes: 60
run: |
cd ${{ github.workspace }}/build/examples/conformance && make -j$(${{ github.workspace }}/.github/scripts/get_cpus.sh) conformance
- name: Get CMake version
id: cmake_version
run: echo "version=$(cmake --version | head -n 1)" >> $GITHUB_OUTPUT
shell: bash
- name: Cache CTest timings
id: cache_ctest
uses: actions/cache@5a3ec84eff668545956fd18022155c47e93e2684
with:
path: ${{ github.workspace }}/build/Testing/Temporary/CTestCostData.txt
key: ctest-cache-${{ steps.cmake_version.outputs.version }}-${{ runner.name }}-${{ matrix.config }}-${{ github.run_id }}
restore-keys: ctest-cache-${{ steps.cmake_version.outputs.version }}-${{ runner.name }}-${{ matrix.config }}
- name: Run Tests
env:
POCL_CACHE_DIR: "${{ runner.temp }}/GH_POCL_CACHE"
CL_PLATFORM_NAME: "Portable"
CL_DEVICE_TYPE: "cpu"
id: ctest
timeout-minutes: 120
run: |
runCTest() {
cd ${{ github.workspace }}/build && ${{ github.workspace }}/tools/scripts/run_cpu_tests -j$(${{ github.workspace }}/.github/scripts/get_cpus.sh) $CTEST_FLAGS "$@"
}
rm -rf ${{ env.POCL_CACHE_DIR }}
# hardcoded path in test_compiler / execute_after_included_header_link
rm -rf /tmp/foo
mkdir ${{ env.POCL_CACHE_DIR }}
if [ "${{ matrix.config }}" == "cts_asan" ]; then
runCTest -L conformance_suite_micro_main -L asan
elif [ "${{ matrix.config }}" == "cts_tsan" ]; then
runCTest -L conformance_suite_micro_main -L tsan
else
echo "Unknown configuration" && exit 1
fi