summaryrefslogtreecommitdiffstats
path: root/src/fluent-bit/lib/librdkafka-2.1.0/tests/run-test.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/librdkafka-2.1.0/tests/run-test.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/librdkafka-2.1.0/tests/run-test.sh')
-rwxr-xr-xsrc/fluent-bit/lib/librdkafka-2.1.0/tests/run-test.sh140
1 files changed, 140 insertions, 0 deletions
diff --git a/src/fluent-bit/lib/librdkafka-2.1.0/tests/run-test.sh b/src/fluent-bit/lib/librdkafka-2.1.0/tests/run-test.sh
new file mode 100755
index 000000000..2f531c61f
--- /dev/null
+++ b/src/fluent-bit/lib/librdkafka-2.1.0/tests/run-test.sh
@@ -0,0 +1,140 @@
+#!/usr/bin/env bash
+#
+
+RED='\033[31m'
+GREEN='\033[32m'
+CYAN='\033[36m'
+CCLR='\033[0m'
+
+if [[ $1 == -h ]]; then
+ echo "Usage: $0 [-..] [modes..]"
+ echo ""
+ echo " Modes: bare valgrind helgrind cachegrind drd gdb lldb bash"
+ echo " Options:"
+ echo " -.. - test-runner command arguments (pass thru)"
+ exit 0
+fi
+
+ARGS=
+
+while [[ $1 == -* ]]; do
+ ARGS="$ARGS $1"
+ shift
+done
+
+TEST=./test-runner
+
+if [ ! -z "$1" ]; then
+ MODES=$1
+else
+ MODES="bare"
+ # Enable valgrind:
+ #MODES="bare valgrind"
+fi
+
+FAILED=0
+
+export RDKAFKA_GITVER="$(git rev-parse --short HEAD)@$(git symbolic-ref -q --short HEAD)"
+
+# Enable valgrind suppressions for false positives
+SUPP="--suppressions=librdkafka.suppressions"
+
+# Uncomment to generate valgrind suppressions
+#GEN_SUPP="--gen-suppressions=yes"
+
+# Common valgrind arguments
+VALGRIND_ARGS="--error-exitcode=3"
+
+# Enable vgdb on valgrind errors.
+#VALGRIND_ARGS="$VALGRIND_ARGS --vgdb-error=1"
+
+# Exit valgrind on first error
+VALGRIND_ARGS="$VALGRIND_ARGS --exit-on-first-error=yes"
+
+export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:../src:../src-cpp
+export DYLD_LIBRARY_PATH=$DYLD_LIBRARY_PATH:../src:../src-cpp
+
+echo -e "${CYAN}############## $TEST ################${CCLR}"
+
+for mode in $MODES; do
+ echo -e "${CYAN}### Running test $TEST in $mode mode ###${CCLR}"
+ export TEST_MODE=$mode
+ case "$mode" in
+ valgrind)
+ valgrind $VALGRIND_ARGS --leak-check=full --show-leak-kinds=all \
+ --errors-for-leak-kinds=all \
+ --track-origins=yes \
+ --track-fds=yes \
+ $SUPP $GEN_SUPP \
+ $TEST $ARGS
+ RET=$?
+ ;;
+ helgrind)
+ valgrind $VALGRIND_ARGS --tool=helgrind \
+ --sim-hints=no-nptl-pthread-stackcache \
+ $SUPP $GEN_SUPP \
+ $TEST $ARGS
+ RET=$?
+ ;;
+ cachegrind|callgrind)
+ valgrind $VALGRIND_ARGS --tool=$mode \
+ $SUPP $GEN_SUPP \
+ $TEST $ARGS
+ RET=$?
+ ;;
+ drd)
+ valgrind $VALGRIND_ARGS --tool=drd $SUPP $GEN_SUPP \
+ $TEST $ARGS
+ RET=$?
+ ;;
+ callgrind)
+ valgrind $VALGRIND_ARGS --tool=callgrind $SUPP $GEN_SUPP \
+ $TEST $ARGS
+ RET=$?
+ ;;
+ gdb)
+ grun=$(mktemp gdbrunXXXXXX)
+ cat >$grun <<EOF
+set \$_exitcode = -999
+run $ARGS
+if \$_exitcode != -999
+ quit
+end
+EOF
+ export ASAN_OPTIONS="$ASAN_OPTIONS:abort_on_error=1"
+ gdb -x $grun $TEST
+ RET=$?
+ rm $grun
+ ;;
+ bare)
+ $TEST $ARGS
+ RET=$?
+ ;;
+ lldb)
+ lldb -b -o "process launch --environment DYLD_LIBRARY_PATH=$DYLD_LIBRARY_PATH" -- $TEST $ARGS
+ RET=$?
+ ;;
+ bash)
+ PS1="[run-test.sh] $PS1" bash
+ RET=$?
+ ;;
+ *)
+ echo -e "${RED}### Unknown mode $mode for $TEST ###${CCLR}"
+ RET=1
+ ;;
+ esac
+
+ if [ $RET -gt 0 ]; then
+ echo -e "${RED}###"
+ echo -e "### Test $TEST in $mode mode FAILED! (return code $RET) ###"
+ echo -e "###${CCLR}"
+ FAILED=1
+ else
+ echo -e "${GREEN}###"
+ echo -e "### $Test $TEST in $mode mode PASSED! ###"
+ echo -e "###${CCLR}"
+ fi
+done
+
+exit $FAILED
+