Debian Codegraph @

tests/valgrind_test.sh

raw symbols SCIP
1 #!/usr/bin/env bash
2
3
4 # Runs valgrind tests.
5 #
6 # Authors:
7 # Jan Černý <[email protected]>
8
9 # set up variables
10 valgrind_output=$(mktemp)
11 logfile=$builddir/tests/valgrind_test.log
12 error_code=66
13 suppfile=$top_srcdir/tests/suppressions.supp
14 valgrind_args="--trace-children=yes --free-fill=55 --malloc-fill=55 --leak-check=full --show-reachable=yes --show-leak-kinds=all --log-file=$valgrind_output --suppressions=$suppfile --error-exitcode=$error_code"
15
16 echo "VALGRIND TEST" >> $logfile
17 echo "working directory: " `pwd` >> $logfile
18 echo "command: oscap $@" >> $logfile
19
20 # run valgrind
21 "$RUN_WRAPPER" valgrind $valgrind_args "$OSCAP_EXEC" "$@"
22 ret_val=$?
23
24 if [ $ret_val -eq $error_code ] ; then
25 echo "Memory error detected!" >> $logfile
26 cat $valgrind_output >> $logfile
27 result=1 # fail the test
28 else
29 echo "OK" >> $logfile
30 result=0 # pass the test
31 fi
32
33 echo "" >> $logfile
34 rm $valgrind_output
35 exit $result