summaryrefslogtreecommitdiffstats
path: root/src/fluent-bit/lib/jansson-e23f558/test/scripts/valgrind.sh
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-05 12:08:03 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-05 12:08:18 +0000
commit5da14042f70711ea5cf66e034699730335462f66 (patch)
tree0f6354ccac934ed87a2d555f45be4c831cf92f4a /src/fluent-bit/lib/jansson-e23f558/test/scripts/valgrind.sh
parentReleasing debian version 1.44.3-2. (diff)
downloadnetdata-5da14042f70711ea5cf66e034699730335462f66.tar.xz
netdata-5da14042f70711ea5cf66e034699730335462f66.zip
Merging upstream version 1.45.3+dfsg.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'src/fluent-bit/lib/jansson-e23f558/test/scripts/valgrind.sh')
-rw-r--r--src/fluent-bit/lib/jansson-e23f558/test/scripts/valgrind.sh35
1 files changed, 35 insertions, 0 deletions
diff --git a/src/fluent-bit/lib/jansson-e23f558/test/scripts/valgrind.sh b/src/fluent-bit/lib/jansson-e23f558/test/scripts/valgrind.sh
new file mode 100644
index 000000000..afbdcee15
--- /dev/null
+++ b/src/fluent-bit/lib/jansson-e23f558/test/scripts/valgrind.sh
@@ -0,0 +1,35 @@
+# Copyright (c) 2009-2016 Petri Lehtinen <petri@digip.org>
+#
+# Jansson is free software; you can redistribute it and/or modify
+# it under the terms of the MIT license. See LICENSE for details.
+
+[ -z "$VALGRIND" ] && VALGRIND=0
+
+VALGRIND_CMDLINE="valgrind --leak-check=full --show-reachable=yes --track-origins=yes -q"
+
+if [ $VALGRIND -eq 1 ]; then
+ test_runner="$VALGRIND_CMDLINE"
+ json_process="$VALGRIND_CMDLINE $json_process"
+else
+ test_runner=""
+fi
+
+valgrind_check() {
+ if [ $VALGRIND -eq 1 ]; then
+ # Check for Valgrind error output. The valgrind option
+ # --error-exitcode is not enough because Valgrind doesn't
+ # think unfreed allocs are errors.
+ if grep -E -q '^==[0-9]+== ' $1; then
+ touch $test_log/valgrind_error
+ return 1
+ fi
+ fi
+}
+
+valgrind_show_error() {
+ if [ $VALGRIND -eq 1 -a -f $test_log/valgrind_error ]; then
+ echo "valgrind detected an error"
+ return 0
+ fi
+ return 1
+}