mirror of
https://github.com/sockspls/badfish
synced 2025-04-29 16:23:09 +00:00

Since an unknown amount of time the instrumented CI has been a bit flawed, explained here https://github.com/official-stockfish/Stockfish/issues/5185. It also experiences random timeout issues where restarting the workflow fixes it or very long run times (more than other workflows) and is not very portable. The intention of this commit is to port the instrumented.sh to python which also works on other operating systems. It should also be relatively easy for beginners to add new tests to assert stockfish's output and to run it. From the source directory the following command can be run. `python3 ../tests/instrumented.py --none ./stockfish` A test runner will go over the test suites and run the test cases. All instrumented tests should have been ported over. The required python version for this is should be 3.7 (untested) + the requests package, testing.py includes some infrastructure code which setups the testing. fixes https://github.com/official-stockfish/Stockfish/issues/5185 closes https://github.com/official-stockfish/Stockfish/pull/5583 No functional change
78 lines
2.4 KiB
YAML
78 lines
2.4 KiB
YAML
name: Sanitizers
|
|
on:
|
|
workflow_call:
|
|
jobs:
|
|
Test-under-sanitizers:
|
|
name: ${{ matrix.sanitizers.name }}
|
|
runs-on: ${{ matrix.config.os }}
|
|
env:
|
|
COMPCXX: ${{ matrix.config.compiler }}
|
|
COMP: ${{ matrix.config.comp }}
|
|
CXXFLAGS: "-Werror"
|
|
strategy:
|
|
fail-fast: false
|
|
matrix:
|
|
config:
|
|
- name: Ubuntu 22.04 GCC
|
|
os: ubuntu-22.04
|
|
compiler: g++
|
|
comp: gcc
|
|
shell: bash
|
|
sanitizers:
|
|
- name: Run with thread sanitizer
|
|
make_option: sanitize=thread
|
|
instrumented_option: sanitizer-thread
|
|
- name: Run with UB sanitizer
|
|
make_option: sanitize=undefined
|
|
instrumented_option: sanitizer-undefined
|
|
- name: Run under valgrind
|
|
make_option: ""
|
|
instrumented_option: valgrind
|
|
- name: Run under valgrind-thread
|
|
make_option: ""
|
|
instrumented_option: valgrind-thread
|
|
- name: Run non-instrumented
|
|
make_option: ""
|
|
instrumented_option: none
|
|
defaults:
|
|
run:
|
|
working-directory: src
|
|
shell: ${{ matrix.config.shell }}
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
with:
|
|
persist-credentials: false
|
|
|
|
- name: Download required linux packages
|
|
run: |
|
|
sudo apt update
|
|
sudo apt install expect valgrind g++-multilib
|
|
|
|
- name: Download the used network from the fishtest framework
|
|
run: make net
|
|
|
|
- name: Check compiler
|
|
run: $COMPCXX -v
|
|
|
|
- name: Test help target
|
|
run: make help
|
|
|
|
- name: Check git
|
|
run: git --version
|
|
|
|
# Since Linux Kernel 6.5 we are getting false positives from the ci,
|
|
# lower the ALSR entropy to disable ALSR, which works as a temporary workaround.
|
|
# https://github.com/google/sanitizers/issues/1716
|
|
# https://bugs.launchpad.net/ubuntu/+source/linux/+bug/2056762
|
|
|
|
- name: Lower ALSR entropy
|
|
run: sudo sysctl -w vm.mmap_rnd_bits=28
|
|
|
|
# Sanitizers
|
|
|
|
- name: ${{ matrix.sanitizers.name }}
|
|
run: |
|
|
export CXXFLAGS="-O1 -fno-inline"
|
|
make clean
|
|
make -j4 ARCH=x86-64-sse41-popcnt ${{ matrix.sanitizers.make_option }} debug=yes optimize=no build > /dev/null
|
|
python3 ../tests/instrumented.py --${{ matrix.sanitizers.instrumented_option }} ./stockfish
|