New option "--extra-display" (#3, #4).

This commit is contained in:
Andrew Wood
2024-12-01 19:39:59 +00:00
parent 7e51fb8371
commit dccc7345ab
26 changed files with 1106 additions and 708 deletions
+30
View File
@@ -0,0 +1,30 @@
#!/bin/sh
#
# Run valgrind's memory checker against a process that sets is process
# title.
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"
# Without an extra format string.
(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 -x processtitle >/dev/null 2>"${workFile1}"; } 4>&1 || exit 1
# With an extra format string.
(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 -x 'processtitle:%t %b' >/dev/null 2>"${workFile1}"; } 4>&1 || exit 1
exit 0
+14 -1
View File
@@ -23,6 +23,7 @@ valgrindOutputFile="valgrind.out"
true "${testSubject:?not set - call this from 'make check'}"
true "${workFile4:?not set - call this from 'make check'}"
true "${workFile5:?not set - call this from 'make check'}"
if ! command -v valgrind >/dev/null 2>&1; then
echo "test requires \`valgrind'"
@@ -36,9 +37,21 @@ done
runWithValgrind () {
cat > "${workFile5}" <<EOF
{
ignore-initproctitle-leak
Memcheck:Leak
fun:malloc
fun:initproctitle
fun:main
}
EOF
true > "${workFile4}"
valgrind --tool=memcheck \
--verbose --show-error-list=yes \
--verbose \
--show-error-list=yes \
--suppressions="${workFile5}" \
--log-file="${workFile4}" \
--error-exitcode=125 \
--track-fds=yes \
+3 -2
View File
@@ -22,9 +22,10 @@ workFile1=$(mktemp 2>/dev/null) || workFile1="./.tmp1"
workFile2=$(mktemp 2>/dev/null) || workFile2="./.tmp2"
workFile3=$(mktemp 2>/dev/null) || workFile3="./.tmp3"
workFile4=$(mktemp 2>/dev/null) || workFile4="./.tmp4"
workFile5=$(mktemp 2>/dev/null) || workFile4="./.tmp5"
# Clean up the temporary files on exit, in case we are interrupted.
trap 'rm -f "${workFile1}" "${workFile2}" "${workFile3}" "${workFile4}"' EXIT
trap 'rm -f "${workFile1}" "${workFile2}" "${workFile3}" "${workFile4}" "${workFile5}"' EXIT
# Variables used by the test scripts.
export testSubject sourcePath workFile1 workFile2 workFile3 workFile4
export testSubject sourcePath workFile1 workFile2 workFile3 workFile4 workFile5