diff options
author | emanuele-f <faranda@ntop.org> | 2019-12-04 13:06:05 +0100 |
---|---|---|
committer | emanuele-f <faranda@ntop.org> | 2019-12-04 13:06:05 +0100 |
commit | d62526f9ed0d504c928a3861b4838f7029bc0632 (patch) | |
tree | 7326cf5478a6e6dc78f2ac0e15d83f1ed8c8e2c7 /tests | |
parent | e66d7216b8de3aa479db82486dcf64a63d8353ff (diff) |
Fix invalid reads and add valgrind test
Diffstat (limited to 'tests')
-rwxr-xr-x | tests/vagrind_test.sh | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/tests/vagrind_test.sh b/tests/vagrind_test.sh new file mode 100755 index 000000000..aa04dab40 --- /dev/null +++ b/tests/vagrind_test.sh @@ -0,0 +1,33 @@ +#!/bin/sh + +READER="valgrind -q --leak-check=full ../example/ndpiReader -p ../example/protos.txt -c ../example/categories.txt" + +RC=0 +PCAPS=`cd pcap; /bin/ls *.pcap` + +check_results() { + for f in $PCAPS; do + CMD="$READER -q -i pcap/$f > /tmp/reader.out" + $CMD + NUM_DIFF=0 + + if [ -f /tmp/reader.out ]; then + NUM_DIFF=`wc -l /tmp/reader.out` + fi + + if [ $NUM_DIFF -eq 0 ]; then + printf "%-32s\tOK\n" "$f" + else + printf "%-32s\tERROR\n" "$f" + echo "$CMD" + cat /tmp/reader.out + RC=1 + fi + + /bin/rm -f /tmp/reader.out + done +} + +check_results + +exit $RC |