-
Notifications
You must be signed in to change notification settings - Fork 286
93 lines (81 loc) · 4.12 KB
/
ubuntu-sanitizers.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
name: Ubuntu-sanitizers
on:
pull_request:
types: [opened, reopened, synchronize]
schedule:
# https://docs.github.com/en/free-pro-team@latest/actions/reference/events-that-trigger-workflows#scheduled-events
# * is a special character in YAML so you have to quote this string
# every Sunday at 2 am
- cron: '0 2 * * SUN'
# https://stackoverflow.com/questions/66335225/how-to-cancel-previous-runs-in-the-pr-when-you-push-new-commitsupdate-the-curre#comment133398800_72408109
# https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#concurrency
concurrency:
group: ${{ github.workflow }}-${{ github.ref || github.run_id }}
cancel-in-progress: true
jobs:
build-ubuntu-sanitizers:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
flags: ["-fsanitize=address", "-fsanitize=leak", "-fsanitize=thread", "-fsanitize=undefined"]
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Print system information
run: lscpu
- name: Print OS information
run: lsb_release -a
- name: Install dependencies
run: sudo apt-get update && sudo apt-get install -y libx11-dev libdc1394-dev libv4l-dev liblapack-dev libblas-dev libeigen3-dev nlohmann-json3-dev
- name: Linear algebra liblapack/libblas alternatives
run: |
update-alternatives --list liblapack.so.3-x86_64-linux-gnu
update-alternatives --list libblas.so.3-x86_64-linux-gnu
- name: Clone visp-images
env:
BRANCH_NAME: ${{ github.head_ref || github.ref_name }}
# https://remarkablemark.org/blog/2022/09/25/check-git-branch-exists-in-remote-repository/
run: |
git clone --depth 1 https://github.com/lagadic/visp-images ${HOME}/visp-images
echo "VISP_INPUT_IMAGE_PATH=$HOME/visp-images" >> $GITHUB_ENV
echo ${VISP_INPUT_IMAGE_PATH}
- name: Configure CMake
run: |
mkdir build
cd build
cmake .. -DCMAKE_C_FLAGS=${{ matrix.flags }} -DCMAKE_CXX_FLAGS=${{ matrix.flags }} -DCMAKE_LDFLAGS=${{ matrix.flags }} -DCMAKE_BUILD_TYPE=RelWithDebInfo -DUSE_OPENMP=OFF
cat ViSP-third-party.txt
- name: Compile
working-directory: build
run: make -j$(nproc)
- name: Run unit tests with sanitizers
env:
# Workaround error in SimdLib
# ==20865==ERROR: AddressSanitizer: odr-violation (0x7f4ad36c4500):
# [1] size=8 'ALIGNMENT' /home/runner/work/visp/visp/3rdparty/simdlib/Simd/SimdLib.cpp:82:18
# [2] size=8 'ALIGNMENT' /home/runner/work/visp/visp/3rdparty/simdlib/Simd/SimdLib.cpp:82:18
# These globals were registered at these points:
# [1]:
# #0 0x7f4ad3702928 in __asan_register_globals ../../../../src/libsanitizer/asan/asan_globals.cpp:341
# #1 0x7f4ad2eea39a in _sub_I_00099_1 (/home/runner/work/visp/visp/build/lib/libvisp_mbt.so.3.5+0x4e839a)
# #2 0x7f4ad40c847d (/lib64/ld-linux-x86-64.so.2+0x647d)
#
# [2]:
# #0 0x7f4ad3702928 in __asan_register_globals ../../../../src/libsanitizer/asan/asan_globals.cpp:341
# #1 0x7f4ad1957db0 in _sub_I_00099_1 (/home/runner/work/visp/visp/build/lib/libvisp_core.so.3.5+0x6aadb0)
# #2 0x7f4ad40c847d (/lib64/ld-linux-x86-64.so.2+0x647d)
#
# ==20865==HINT: if you don't care about these errors you may set ASAN_OPTIONS=detect_odr_violation=0
# SUMMARY: AddressSanitizer: odr-violation: global 'ALIGNMENT' at /home/runner/work/visp/visp/3rdparty/simdlib/Simd/SimdLib.cpp:82:18
ASAN_OPTIONS: detect_odr_violation=0
working-directory: build
# When running ctest we got a lot of segfault
# This seems a bug reported in
# - https://stackoverflow.com/questions/77894856/possible-bug-in-gcc-sanitizers
# - https://stackoverflow.com/questions/77850769/fatal-threadsanitizer-unexpected-memory-mapping-when-running-on-linux-kernels
# The workaround seems to be to set vm.mmap_rnd_bits=28
run: |
sudo cat /proc/sys/vm/mmap_rnd_bits
sudo sysctl vm.mmap_rnd_bits=28
ctest -j$(nproc) --output-on-failure -V