44 lines
1.4 KiB
Bash
Executable File
44 lines
1.4 KiB
Bash
Executable File
#!/bin/sh
|
|
#
|
|
# Run valgrind's memory checker against a process using various different
|
|
# transfer options.
|
|
|
|
# Allow all tests to be skipped, e.g. during a release build
|
|
test "${SKIP_ALL_TESTS}" = "1" && exit 77
|
|
|
|
true "${sourcePath:?not set - call this from 'make check'}"
|
|
true "${testSubject:?not set - call this from 'make check'}"
|
|
true "${workFile1:?not set - call this from 'make check'}"
|
|
true "${workFile2:?not set - call this from 'make check'}"
|
|
true "${workFile3:?not set - call this from 'make check'}"
|
|
true "${workFile4:?not set - call this from 'make check'}"
|
|
|
|
# Load the valgrind function.
|
|
. "${sourcePath}/tests/run-valgrind.sh"
|
|
|
|
# Plain, no options.
|
|
{ echo "testing" | runWithValgrind >/dev/null 2>&1; } 4>&1 || exit 1
|
|
|
|
# With --force.
|
|
{ echo "testing" | runWithValgrind -f >/dev/null 2>&1; } 4>&1 || exit 1
|
|
|
|
# Check "--average-rate".
|
|
(dd if=/dev/zero bs=100 count=1 2>/dev/null;
|
|
sleep 1;
|
|
dd if=/dev/zero bs=110 count=1 2>/dev/null;
|
|
sleep 1;
|
|
) | { runWithValgrind -f -i 0.5 -a >/dev/null 2>"${workFile1}"; } 4>&1 || exit 1
|
|
|
|
# Check "--buffer-size" and "--buffer-percent".
|
|
{ \
|
|
( dd if=/dev/zero bs=1024 count=1024; sleep 2; ) 2>/dev/null \
|
|
| runWithValgrind -f -T -i 0.5 -B 1024 2>"${workFile1}" \
|
|
| (sleep 1; dd bs=1024 count=512; sleep 1; cat; ) >/dev/null 2>&1; \
|
|
} 4>&1 || exit 1
|
|
|
|
# Check "--numeric" "--bytes" "--line-mode".
|
|
seq -w 3 1 100 \
|
|
| { runWithValgrind -bnl -i 0.2 -f -L 100 2>"${workFile1}" > "${workFile2}"; } 4>&1 || exit 1
|
|
|
|
exit 0
|