Skip to content

Commit c31ee55

Browse files
committed
CDRIVER-2822 run unittests with valgrind
Also fixes CDRIVER-2823.
1 parent dd26627 commit c31ee55

File tree

2 files changed

+26
-6
lines changed

2 files changed

+26
-6
lines changed

.evergreen/compile-unix.sh

+18-6
Original file line numberDiff line numberDiff line change
@@ -91,9 +91,9 @@ DEBUG_FLAGS="${DEBUG_AND_RELEASE_FLAGS} -DCMAKE_BUILD_TYPE=Debug"
9191
RELEASE_FLAGS="${DEBUG_AND_RELEASE_FLAGS} -DCMAKE_BUILD_TYPE=RelWithDebInfo"
9292

9393
# Where are we, without relying on realpath or readlink?
94-
if [ "$(dirname $0)" == "." ]; then
94+
if [ "$(dirname $0)" = "." ]; then
9595
DIR="$(pwd)"
96-
elif [ $(dirname $0) == ".." ]; then
96+
elif [ "$(dirname $0)" = ".." ]; then
9797
DIR="$(dirname "$(pwd)")"
9898
else
9999
DIR="$(cd "$(dirname "$0")"; pwd)"
@@ -216,15 +216,27 @@ if [ "$SKIP_TESTS" = "ON" ]; then
216216
exit 0
217217
fi
218218

219-
# Write stderr to error.log and to console.
220-
# TODO: valgrind
219+
if [ "$VALGRIND" = "ON" ]; then
220+
# Defines "run_valgrind" shell function.
221+
. $DIR/valgrind.sh
222+
else
223+
# Define a no-op function.
224+
run_valgrind ()
225+
{
226+
$@
227+
}
228+
fi
229+
230+
# Write stderr to error.log and to console. Turn off tracing to avoid spurious
231+
# log messages that CHECK_LOG considers failures.
221232
mkfifo pipe || true
222233
if [ -e pipe ]; then
234+
set +o xtrace
223235
tee error.log < pipe &
224-
./src/libmongoc/test-libmongoc -d -F test-results.json 2>pipe
236+
run_valgrind ./src/libmongoc/test-libmongoc -d -F test-results.json 2>pipe
225237
rm pipe
226238
else
227-
./src/libmongoc/test-libmongoc -d -F test-results.json
239+
run_valgrind ./src/libmongoc/test-libmongoc -d -F test-results.json
228240
fi
229241

230242
# Check if the error.log exists, and is more than 0 byte

valgrind.suppressions

+8
Original file line numberDiff line numberDiff line change
@@ -53,3 +53,11 @@
5353
...
5454
fun:_mongoc_do_init
5555
}
56+
{
57+
ignore_sasl_load_plugin_leak
58+
Memcheck:Leak
59+
...
60+
fun:_sasl_load_plugins
61+
...
62+
fun:_mongoc_do_init
63+
}

0 commit comments

Comments
 (0)