Skip to content

Commit 3579980

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

File tree

3 files changed

+115
-85
lines changed

3 files changed

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

0 commit comments

Comments
 (0)