From: Jérémie Astor Date: Fri, 21 Feb 2020 19:51:03 +0000 (+0100) Subject: :wrench: Remove valgrind from tests X-Git-Tag: nightly~1797 X-Git-Url: http://10.10.0.4:5575/?a=commitdiff_plain;h=82f55c7d4b76b34399a413156e1e64a74b6d16aa;p=gwion.git :wrench: Remove valgrind from tests --- diff --git a/scripts/test.sh b/scripts/test.sh index 3ed65824..8aa5798b 100644 --- a/scripts/test.sh +++ b/scripts/test.sh @@ -1,7 +1,6 @@ #!/bin/bash : "${PRG:=gwion}" -: "${VALGRIND:=valgrind}" : "${GWION_TEST_DIR:=/tmp}" : "${GWION_TEST_PREFIX:=gwt_}" @@ -51,60 +50,6 @@ assert_exclude() { return 1 } -assert_rw() { - grep 'Invalid \(read\|write\) of size' "$2.valgrind.log" > /dev/null || return 0 - echo "invalid read/write" > "$2.log" - return 1 -} - -assert_free() { - grep 'Invalid free()' "$2.valgrind.log" > /dev/null || return 0 - echo "invalid free" > "$2.log" - return 1 -} - -assert_initial() { - grep 'Conditional jump or move depends on uninitialised value(s)' "$2.valgrind.log" > /dev/null || return 0 - echo "uninitialed value" > "$2.log" - return 1 -} - -assert_syscall() { - grep 'Syscall param .* uninitialised byte(s)' "$2.valgrind.log" > /dev/null || return 0 - echo "uninitialed value in syscall" > "$2.log" - return 1 -} - -assert_mismatch() { - grep 'Mismatched free() / delete / delete \[\]' "$2.valgrind.log" > /dev/null || return 0 - echo "mismatched free" > "$2.log" - return 1 -} - -assert_overlap() { - grep 'Source and destination overlap' "$2.valgrind.log" > /dev/null || return 0 - echo "mem overlap" > "$2.log" - return 1 -} - -assert_fishy() { - grep "Argument 'size' of .* has a fishy (possibly negative) value:" "$2.valgrind.log" > /dev/null || return 0 - echo "fishy alloc" > "$2.log" - return 1 -} - -assert_leak() { - grep "All heap blocks were freed -- no leaks are possible" "$2.valgrind.log" > /dev/null && return 0 - #[ "$suppressions" -eq 0 ] && echo "mem leak" > "$2.log" && return 1 - #[ -z "$suppressions" ] && echo "mem leak" > "$2.log" && return 1 - heap=$(grep "in use at exit:" "$2.valgrind.log" | cut -d ":" -f2) - supp=$(grep "suppressed: .* bytes" "$2.valgrind.log" | cut -d ":" -f2) - #[ -z "$supp" ] && echo "mem leak" > "$2.log" && return 1 - [ "$heap" = "$supp" ] && return 0 - echo "mem leak" > "$2.log" - return 1 -} - read_test() { while read -r line do @@ -183,42 +128,21 @@ test_gw(){ log=${GWION_TEST_DIR}${separator}${GWION_TEST_PREFIX}$(printf "%04i" "$n") slog=${GWION_TEST_DIR}${separator}${GWION_TEST_PREFIX}$(printf "%04i" "$n").std.log elog=${GWION_TEST_DIR}${separator}${GWION_TEST_PREFIX}$(printf "%04i" "$n").err.log - vlog=${GWION_TEST_DIR}${separator}${GWION_TEST_PREFIX}$(printf "%04i" "$n").valgrind.log rlog=${GWION_TEST_DIR}${separator}${GWION_TEST_PREFIX}$(printf "%04i" "$n").log - if [ "$VALGRIND" == "NO_VALGRIND" ] - then LANG=C ./"$PRG" "$GWOPT" -d "$DRIVER" "$file" > "$slog" 2>"$elog" |: - else - LANG=C "$VALGRIND" --suppressions=scripts/supp --log-file="$vlog" \ - ./"$PRG" "$GWOPT" -d "$DRIVER" "$file" > "$slog" 2>"$elog" |: - fi + LANG=C ./"$PRG" "$GWOPT" -d "$DRIVER" "$file" > "$slog" 2>"$elog" |: ret=$? #enable skip do_skip "$1" "$n" "$file" "$rlog" && return 0 # enable todo do_todo "$1" "$n" "$file" "$rlog" && return 0 - [ $severity -lt 1 ] && success "$n" "$file" "$rlog" "$vlog" && return 0 - assert_returns "$ret" "$log" || fail "$n" "$file" "$rlog" "$vlog" || return 1 - [ $severity -lt 2 ] && success "$n" "$file" "$rlog" "$vlog" && return 0 - assert_contain "$file" "$log" || fail "$n" "$file" "$rlog" "$vlog" || return 1 - [ $severity -lt 3 ] && success "$n" "$file" "$rlog" "$vlog" && return 0 - assert_exclude "$file" "$log" || fail "$n" "$file" "$rlog" "$vlog" || return 1 - [ $severity -lt 4 ] && success "$n" "$file" "$rlog" "$vlog" && return 0 - assert_rw "$file" "$log" || fail "$n" "$file" "$rlog" "$vlog" || return 1 - [ $severity -lt 5 ] && success "$n" "$file" "$rlog" "$vlog" && return 0 - assert_initial "$file" "$log" || fail "$n" "$file" "$rlog" "$vlog" || return 1 - [ $severity -lt 6 ] && success "$n" "$file" "$rlog" "$vlog" && return 0 - assert_syscall "$file" "$log" || fail "$n" "$file" "$rlog" "$vlog" || return 1 - [ $severity -lt 7 ] && success "$n" "$file" "$rlog" "$vlog" && return 0 - assert_free "$file" "$log" || fail "$n" "$file" "$rlog" "$vlog" || return 1 - [ $severity -lt 8 ] && success "$n" "$file" "$rlog" "$vlog" && return 0 - assert_mismatch "$file" "$log" || fail "$n" "$file" "$rlog" "$vlog" || return 1 - [ $severity -lt 9 ] && success "$n" "$file" "$rlog" "$vlog" && return 0 - assert_overlap "$file" "$log" || fail "$n" "$file" "$rlog" "$vlog" || return 1 - [ $severity -lt 10 ] && success "$n" "$file" "$rlog" "$vlog" && return 0 - assert_fishy "$file" "$log" || fail "$n" "$file" "$rlog" "$vlog" || return 1 - [ $severity -lt 11 ] && success "$n" "$file" "$rlog" "$vlog" && return 0 - assert_leak "$file" "$log" || fail "$n" "$file" "$rlog" "$vlog" || return 1 + [ $severity -lt 1 ] && success "$n" "$file" "$rlog" && return 0 + assert_returns "$ret" "$log" || fail "$n" "$file" "$rlog" || return 1 + [ $severity -lt 2 ] && success "$n" "$file" "$rlog" && return 0 + assert_contain "$file" "$log" || fail "$n" "$file" "$rlog" || return 1 + [ $severity -lt 3 ] && success "$n" "$file" "$rlog" && return 0 + assert_exclude "$file" "$log" || fail "$n" "$file" "$rlog" || return 1 + [ $severity -lt 4 ] && success "$n" "$file" "$rlog" && return 0 success "$n" "$file" "$rlog" && return 0 } diff --git a/tests/sh/common.sh b/tests/sh/common.sh index 150c2c1a..2a288b21 100644 --- a/tests/sh/common.sh +++ b/tests/sh/common.sh @@ -6,18 +6,9 @@ set -m : "${DRIVER:=dummy}" run() { - local good n ok - good="All heap blocks were freed -- no leaks are possible" + local ok n=$(printf "% 4i" "$1") - if [ "$VALGRIND" == "NO_VALGRIND" ] - then ./gwion "$GWOPT" -d "$DRIVER" "$3" &> "$4" && ok=1 - else - eval valgrind ./gwion "$GWOPT" -d "$DRIVER" "$3" &> "$4" - if [ -f "$4" ] - then grep "$good" "$4" > /dev/null && ok=1 - else ok=1 - fi - fi + ./gwion "$GWOPT" -d "$DRIVER" "$3" &> "$4" && ok=1 if [ $ok ] then echo "ok $n $2" else echo "not ok $n $2" diff --git a/tests/sh/test.sh b/tests/sh/test.sh index 98d4e764..a1d8a0b6 100644 --- a/tests/sh/test.sh +++ b/tests/sh/test.sh @@ -2,7 +2,6 @@ # [test] #0 : "${PRG:=gwion}" -: "${VALGRIND:=valgrind}" : "${GWION_TEST_DIR:=/tmp}" : "${GWION_TEST_PREFIX:=gwt_}" @@ -49,60 +48,6 @@ assert_exclude() { return 1 } -assert_rw() { - grep 'Invalid \(read\|write\) of size' "$2.valgrind.log" > /dev/null || return 0 - echo "invalid read/write" > "$2.log" - return 1 -} - -assert_free() { - grep 'Invalid free()' "$2.valgrind.log" > /dev/null || return 0 - echo "invalid free" > "$2.log" - return 1 -} - -assert_initial() { - grep 'Conditional jump or move depends on uninitialised value(s)' "$2.valgrind.log" > /dev/null || return 0 - echo "uninitialed value" > "$2.log" - return 1 -} - -assert_syscall() { - grep 'Syscall param .* uninitialised byte(s)' "$2.valgrind.log" > /dev/null || return 0 - echo "uninitialed value in syscall" > "$2.log" - return 1 -} - -assert_mismatch() { - grep 'Mismatched free() / delete / delete \[\]' "$2.valgrind.log" > /dev/null || return 0 - echo "mismatched free" > "$2.log" - return 1 -} - -assert_overlap() { - grep 'Source and destination overlap' "$2.valgrind.log" > /dev/null || return 0 - echo "mem overlap" > "$2.log" - return 1 -} - -assert_fishy() { - grep "Argument 'size' of .* has a fishy (possibly negative) value:" "$2.valgrind.log" > /dev/null || return 0 - echo "fishy alloc" > "$2.log" - return 1 -} - -assert_leak() { - grep "All heap blocks were freed -- no leaks are possible" "$2.valgrind.log" > /dev/null && return 0 - #[ "$suppressions" -eq 0 ] && echo "mem leak" > "$2.log" && return 1 - #[ -z "$suppressions" ] && echo "mem leak" > "$2.log" && return 1 - heap=$(grep "in use at exit:" "$2.valgrind.log" | cut -d ":" -f2) - supp=$(grep "suppressed: .* bytes" "$2.valgrind.log" | cut -d ":" -f2) - #[ -z "$supp" ] && echo "mem leak" > "$2.log" && return 1 - [ "$heap" = "$supp" ] && return 0 - echo "mem leak" > "$2.log" - return 1 -} - read_test() { while read -r line do @@ -184,41 +129,20 @@ test_gw(){ log=${GWION_TEST_DIR}/${GWION_TEST_PREFIX}$(printf "%04i" "$n") slog=${GWION_TEST_DIR}/${GWION_TEST_PREFIX}$(printf "%04i" "$n").std.log elog=${GWION_TEST_DIR}/${GWION_TEST_PREFIX}$(printf "%04i" "$n").err.log - vlog=${GWION_TEST_DIR}/${GWION_TEST_PREFIX}$(printf "%04i" "$n").valgrind.log rlog=${GWION_TEST_DIR}/${GWION_TEST_PREFIX}$(printf "%04i" "$n").log - if [ "$VALGRIND" == "NO_VALGRIND" ] - then LANG=C ./"$PRG" "$GWOPT" -m "$MODULE" -d "$DRIVER" "$file" > "$slog" 2>"$elog" |: - else - LANG=C "$VALGRIND" --suppressions="$SUPP" --log-file="$vlog" \ - ./"$PRG" "$GWOPT" -m "$MODULE" -d "$DRIVER" "$file" > "$slog" 2>"$elog" |: - fi + LANG=C ./"$PRG" "$GWOPT" -m "$MODULE" -d "$DRIVER" "$file" > "$slog" 2>"$elog" |: ret=$? #enable skip [ -z "$file" ] || do_skip "$1" "$n" "$file" "$rlog" && return 0 # enable todo [ -z "$file" ] || do_todo "$1" "$n" "$file" "$rlog" && return 0 - [ $severity -lt 1 ] && success "$n" "$file" "$rlog" "$vlog" && return 0 - assert_returns "$ret" "$log" || fail "$n" "$file" "$rlog" "$vlog" || return 1 - [ -z "$file" ] || [ $severity -lt 2 ] && success "$n" "$file" "$rlog" "$vlog" && return 0 - assert_contain "$file" "$log" || fail "$n" "$file" "$rlog" "$vlog" || return 1 - [ $severity -lt 3 ] && success "$n" "$file" "$rlog" "$vlog" && return 0 - [ -f "$file" ] && assert_exclude "$file" "$log" || fail "$n" "$file" "$rlog" "$vlog" || return 1 - [ $severity -lt 4 ] && success "$n" "$file" "$rlog" "$vlog" && return 0 - assert_rw "$file" "$log" || fail "$n" "$file" "$rlog" "$vlog" || return 1 - [ $severity -lt 5 ] && success "$n" "$file" "$rlog" "$vlog" && return 0 - assert_initial "$file" "$log" || fail "$n" "$file" "$rlog" "$vlog" || return 1 - [ $severity -lt 6 ] && success "$n" "$file" "$rlog" "$vlog" && return 0 - assert_syscall "$file" "$log" || fail "$n" "$file" "$rlog" "$vlog" || return 1 - [ $severity -lt 7 ] && success "$n" "$file" "$rlog" "$vlog" && return 0 - assert_free "$file" "$log" || fail "$n" "$file" "$rlog" "$vlog" || return 1 - [ $severity -lt 8 ] && success "$n" "$file" "$rlog" "$vlog" && return 0 - assert_mismatch "$file" "$log" || fail "$n" "$file" "$rlog" "$vlog" || return 1 - [ $severity -lt 9 ] && success "$n" "$file" "$rlog" "$vlog" && return 0 - assert_overlap "$file" "$log" || fail "$n" "$file" "$rlog" "$vlog" || return 1 - [ $severity -lt 10 ] && success "$n" "$file" "$rlog" "$vlog" && return 0 - assert_fishy "$file" "$log" || fail "$n" "$file" "$rlog" "$vlog" || return 1 - [ $severity -lt 11 ] && success "$n" "$file" "$rlog" "$vlog" && return 0 - assert_leak "$file" "$log" || fail "$n" "$file" "$rlog" "$vlog" || return 1 + [ $severity -lt 1 ] && success "$n" "$file" "$rlog" && return 0 + assert_returns "$ret" "$log" || fail "$n" "$file" "$rlog" || return 1 + [ -z "$file" ] || [ $severity -lt 2 ] && success "$n" "$file" "$rlog" && return 0 + assert_contain "$file" "$log" || fail "$n" "$file" "$rlog" || return 1 + [ $severity -lt 3 ] && success "$n" "$file" "$rlog" && return 0 + [ -f "$file" ] && assert_exclude "$file" "$log" || fail "$n" "$file" "$rlog" || return 1 + [ $severity -lt 4 ] && success "$n" "$file" "$rlog" && return 0 success "$n" "$file" "$rlog" && return 0 }