Skip to content

Commit c9286f6

Browse files
committed
Add script for running valgrind tests
Signed-off-by: Lukasz Dorau <[email protected]>
1 parent 15652ee commit c9286f6

File tree

3 files changed

+112
-85
lines changed

3 files changed

+112
-85
lines changed

.github/workflows/nightly.yml

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
name: Nightly
2+
3+
# It is run at 00:00 UTC every day or on demand.
4+
#
5+
# TODO: uncomment before merge
6+
#
7+
# on:
8+
# workflow_dispatch:
9+
# schedule:
10+
# - cron: '0 0 * * *'
11+
12+
on: [push, pull_request]
13+
14+
jobs:
15+
Valgrind:
16+
name: Valgrind
17+
strategy:
18+
fail-fast: false
19+
matrix:
20+
tool: ['memcheck', 'drd', 'helgrind']
21+
runs-on: ubuntu-latest
22+
23+
steps:
24+
- name: Checkout repository
25+
uses: actions/checkout@v4
26+
27+
- name: Install apt packages
28+
run: |
29+
sudo apt-get update
30+
sudo apt-get install -y cmake libjemalloc-dev libnuma-dev libtbb-dev valgrind
31+
32+
- name: Configure CMake
33+
run: >
34+
cmake
35+
-B ${{github.workspace}}/build
36+
-DCMAKE_BUILD_TYPE=Debug
37+
-DUMF_FORMAT_CODE_STYLE=OFF
38+
-DUMF_DEVELOPER_MODE=ON
39+
-DUMF_ENABLE_POOL_TRACKING=ON
40+
-DUMF_BUILD_LIBUMF_POOL_SCALABLE=ON
41+
-DUMF_BUILD_LIBUMF_POOL_DISJOINT=ON
42+
-DUMF_BUILD_LIBUMF_POOL_JEMALLOC=ON
43+
44+
- name: Build
45+
run: >
46+
cmake --build ${{github.workspace}}/build --config Debug -j$(nproc)
47+
48+
- name: Run tests under valgrind
49+
working-directory: ${{github.workspace}}/build
50+
run: ../test/test_valgrind.sh ${{matrix.tool}}

.github/workflows/pr_push.yml

Lines changed: 0 additions & 85 deletions
This file was deleted.

test/test_valgrind.sh

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
#!/bin/bash
2+
3+
set -e
4+
5+
if ! valgrind --version > /dev/null; then
6+
echo "error: valgrind not found"
7+
exit 1
8+
fi
9+
10+
if [ "$1" == "" ]; then
11+
echo "Usage: $(basename $0) <memcheck|drd|helgrind>"
12+
exit 1
13+
fi
14+
15+
case $1 in
16+
memcheck)
17+
OPTION="--leak-check=full"
18+
;;
19+
drd)
20+
OPTION="--tool=drd"
21+
;;
22+
helgrind)
23+
OPTION="--tool=helgrind"
24+
;;
25+
*)
26+
echo "error: unknown option: $1"
27+
exit 1
28+
;;
29+
esac
30+
31+
FAIL=0
32+
33+
echo "Running: \"valgrind $OPTION\" for the following tests:"
34+
35+
for tf in $(ls -1 ./test/umf_test-*); do
36+
[ ! -x $tf ] && continue
37+
echo -n "$tf "
38+
LOG=${tf}.log
39+
valgrind $OPTION $tf >$LOG 2>&1
40+
if grep -q -e "ERROR SUMMARY: 0 errors from 0 contexts" $LOG; then
41+
echo "- OK"
42+
rm $LOG
43+
else
44+
echo "- FAILED! : $(grep -e "ERROR SUMMARY:" $LOG | cut -d' ' -f2-)"
45+
FAIL=1
46+
fi || true
47+
done
48+
49+
[ $FAIL -eq 0 ] && echo PASSED && exit 0
50+
51+
echo
52+
echo "======================================================================"
53+
echo
54+
55+
for log in $(ls -1 ./test/umf_test-*.log); do
56+
echo ">>>>>>> LOG $log"
57+
cat $log
58+
echo
59+
echo
60+
done
61+
62+
exit 1

0 commit comments

Comments
 (0)