Skip to content

Commit

Permalink
memory checks via valgrind
Browse files Browse the repository at this point in the history
  • Loading branch information
wookietreiber committed May 12, 2017
1 parent 75f27d8 commit 6c535f9
Show file tree
Hide file tree
Showing 4 changed files with 50 additions and 1 deletion.
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ compiler:

before_install:
- sudo apt-get update -qq
- sudo apt-get install -qq asciidoc cppcheck libarchive-dev liblzma-dev xz-utils
- sudo apt-get install -qq asciidoc cppcheck libarchive-dev liblzma-dev valgrind xz-utils

script:
- autoconf --version
Expand Down
2 changes: 2 additions & 0 deletions test/Makefile.am
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
TESTS = \
compress-file-permissions.sh \
cppcheck-src.sh \
compression-memcheck.sh \
decompression-memcheck.sh \
single-file-round-trip.sh \
xz-compatibility-c-option.sh

Expand Down
22 changes: 22 additions & 0 deletions test/compression-memcheck.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
#!/bin/bash

if which valgrind &> /dev/null ; then
PIXZ=../src/pixz

INPUT=$(basename $0)
OUTPUT=$INPUT.pixz

MEMCHECK_OUT=$(mktemp)

trap "rm -f $OUTPUT $MEMCHECK_OUT" EXIT

valgrind --tool=memcheck --leak-check=full --show-leak-kinds=all --track-origins=yes \
$PIXZ $INPUT $OUTPUT \
2> $MEMCHECK_OUT

cat $MEMCHECK_OUT
grep -q 'ERROR SUMMARY: 0' $MEMCHECK_OUT
else
echo "no valgrind, skipping test"
exit 77
fi
25 changes: 25 additions & 0 deletions test/decompression-memcheck.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
#!/bin/bash

if which valgrind &> /dev/null ; then
PIXZ=../src/pixz

INPUT=$(basename $0)
OUTPUT=$INPUT.pixz
UNCOMPRESSED=$INPUT.uncompressed

MEMCHECK_OUT=$(mktemp)

trap "rm -f $OUTPUT $MEMCHECK_OUT $UNCOMPRESSED" EXIT

$PIXZ $INPUT $OUTPUT

valgrind --tool=memcheck --leak-check=full --show-leak-kinds=all --track-origins=yes \
$PIXZ -d $OUTPUT $UNCOMPRESSED \
2> $MEMCHECK_OUT

cat $MEMCHECK_OUT
grep -q 'ERROR SUMMARY: 0' $MEMCHECK_OUT
else
echo "no valgrind, skipping test"
exit 77
fi

0 comments on commit 6c535f9

Please sign in to comment.