diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-05-05 12:08:03 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-05-05 12:08:18 +0000 |
commit | 5da14042f70711ea5cf66e034699730335462f66 (patch) | |
tree | 0f6354ccac934ed87a2d555f45be4c831cf92f4a /src/fluent-bit/lib/jansson-e23f558/test/scripts | |
parent | Releasing debian version 1.44.3-2. (diff) | |
download | netdata-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')
-rw-r--r-- | src/fluent-bit/lib/jansson-e23f558/test/scripts/run-tests.sh | 100 | ||||
-rw-r--r-- | src/fluent-bit/lib/jansson-e23f558/test/scripts/valgrind.sh | 35 |
2 files changed, 135 insertions, 0 deletions
diff --git a/src/fluent-bit/lib/jansson-e23f558/test/scripts/run-tests.sh b/src/fluent-bit/lib/jansson-e23f558/test/scripts/run-tests.sh new file mode 100644 index 000000000..f980a7657 --- /dev/null +++ b/src/fluent-bit/lib/jansson-e23f558/test/scripts/run-tests.sh @@ -0,0 +1,100 @@ +# 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. + +die() { + echo "$1" >&2 + exit 1 +} + +[ -n "$1" ] || die "Usage: $0 suite-name" +[ -n "$bindir" ] || die "Set bindir" +[ -n "$logdir" ] || die "Set logdir" +[ -n "$scriptdir" ] || die "Set scriptdir" +[ -n "$suites_srcdir" ] || die "Set suites_srcdir" +[ -n "$suites_builddir" ] || die "Set suites_builddir" + +json_process=$bindir/json_process + +suite_name=$1 +suite_srcdir=$suites_srcdir/$suite_name +suite_builddir=$suites_builddir/$suite_name +suite_log=$logdir/$suite_name + +[ -z "$VERBOSE" ] && VERBOSE=0 +[ -z "$STOP" ] && STOP=0 + +. $scriptdir/valgrind.sh + +rm -rf $suite_log +mkdir -p $suite_log + +for test_path in $suite_srcdir/*; do + test_name=$(basename $test_path) + test_builddir=$suite_builddir/$test_name + test_log=$suite_log/$test_name + + [ "$test_name" = "run" ] && continue + is_test || continue + + rm -rf $test_log + mkdir -p $test_log + if [ $VERBOSE -eq 1 ]; then + printf '%s... ' "$test_name" + fi + + run_test + case $? in + 0) + # Success + if [ $VERBOSE -eq 1 ]; then + printf 'ok\n' + else + printf '.' + fi + rm -rf $test_log + ;; + + 77) + # Skip + if [ $VERBOSE -eq 1 ]; then + printf 'skipped\n' + else + printf 'S' + fi + rm -rf $test_log + ;; + + *) + # Failure + if [ $VERBOSE -eq 1 ]; then + printf 'FAILED\n' + else + printf 'F' + fi + + [ $STOP -eq 1 ] && break + ;; + esac +done + +if [ $VERBOSE -eq 0 ]; then + printf '\n' +fi + +if [ -n "$(ls -A $suite_log)" ]; then + for test_log in $suite_log/*; do + test_name=$(basename $test_log) + test_path=$suite_srcdir/$test_name + echo "=================================================================" + echo "$suite_name/$test_name" + echo "=================================================================" + show_error + echo + done + echo "=================================================================" + exit 1 +else + rm -rf $suite_log +fi 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 +} |