Skip to content

custom_tests_tsan #1080

custom_tests_tsan

custom_tests_tsan #1080

name: custom_tests_tsan
on:
push:
pull_request:
schedule:
- cron: '3 */8 * * *'
jobs:
linux-custom-tests:
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v4
- name: mmap rnd_bits workaround
run: |
sudo sysctl -w vm.mmap_rnd_bits=28
- run: |
sudo apt-get update && \
sudo DEBIAN_FRONTEND=noninteractive apt-get remove g++ && \
sudo DEBIAN_FRONTEND=noninteractive \
apt-get install -y --no-install-recommends \
ca-certificates \
coreutils \
clang \
cmake \
git \
tor \
curl \
libconfig-dev \
libgtest-dev \
libopus-dev \
libsodium-dev \
libvpx-dev \
llvm-dev \
ninja-build \
pkg-config \
libavutil-dev \
libavcodec-dev \
libavformat-dev \
libavfilter-dev \
libx264-dev \
libx265-dev
- name: setup tor
run: |
sudo /etc/init.d/tor restart
ps -ef|grep tor
cat /usr/share/tor/tor-service-defaults-torrc
- name: test tor connection
run: |
set -x
curl -x socks5h://localhost:9050 -s https://check.torproject.org/api/ip || echo "ignore error"
- run: git submodule update --init --recursive
- name: build toxcore
run: |
CC=clang cmake -B_build -H. -GNinja \
-DCMAKE_INSTALL_PREFIX:PATH="$PWD/_install" \
-DCMAKE_C_FLAGS="-g -O1 -Wno-everything -Wno-missing-variable-declarations -fno-omit-frame-pointer -fsanitize=thread" \
-DCMAKE_CXX_FLAGS="-g -O1 -Wno-everything -Wno-missing-variable-declarations -fno-omit-frame-pointer -fsanitize=thread" \
-DCMAKE_EXE_LINKER_FLAGS="-g -O1 -Wno-everything -Wno-missing-variable-declarations -fno-omit-frame-pointer -fsanitize=thread" \
-DCMAKE_SHARED_LINKER_FLAGS="-g -O1 -Wno-everything -Wno-missing-variable-declarations -fno-omit-frame-pointer -fsanitize=thread" \
-DMIN_LOGGER_LEVEL=INFO \
-DMUST_BUILD_TOXAV=ON \
-DNON_HERMETIC_TESTS=OFF \
-DSTRICT_ABI=OFF \
-DUSE_IPV6=OFF \
-DAUTOTEST=OFF \
-DBUILD_MISC_TESTS=OFF \
-DBUILD_FUN_UTILS=OFF
cd _build
ninja install -j"$(nproc)"
- name: run custom tests
run: |
pwd
CACHEDIR="$HOME/cache"
mkdir -p "$CACHEDIR"
echo 'race:^av_buffer_unref$' > "$CACHEDIR/tsan_ignore"
echo 'race:^av_malloc$' >> "$CACHEDIR/tsan_ignore"
echo 'race:libavutil.so*' >> "$CACHEDIR/tsan_ignore"
echo 'race:libavcodec.so*' >> "$CACHEDIR/tsan_ignore"
cat "$CACHEDIR/tsan_ignore"
export TSAN_OPTIONS="color=always"
export TSAN_OPTIONS="$TSAN_OPTIONS,halt_on_error=1"
export TSAN_OPTIONS="$TSAN_OPTIONS,second_deadlock_stack=1"
export TSAN_OPTIONS="$TSAN_OPTIONS,symbolize=1"
export TSAN_OPTIONS="$TSAN_OPTIONS,suppressions=$CACHEDIR/tsan_ignore"
export TEST_MAX_TIME=$[10*60] # 10 minutes
ls -1 ./custom_tests/*.c
export PKG_CONFIG_PATH="$PWD"/_install/lib/pkgconfig
export LD_LIBRARY_PATH="$PWD"/_install/lib
for i in $(ls -1 ./custom_tests/*.c) ; do
echo "CCC:--------------- ""$i"" ---------------"
rm -f test
clang -g -O1 -fno-omit-frame-pointer -fsanitize=thread \
-Wno-everything -Wno-missing-variable-declarations \
$(pkg-config --cflags toxcore libavcodec libavutil x264 x265 opus vpx libsodium) \
$(pkg-config --libs toxcore libavcodec libavutil x264 x265 opus vpx libsodium) \
"$i" \
-o test
echo "RUN:--------------- ""$i"" ---------------"
timeout -v -k ${TEST_MAX_TIME} $[${TEST_MAX_TIME}+1] ./test
if [ $? -ne 0 ]; then
echo "ERR:--------------- ""$i"" ---------------"
exit $?
else
echo "OK :*************** ""$i"" ***************"
fi
done