commit 44ba628725264b6445d680833aa0616394b07240
parent d73c98a385fc94e1d5dae8e4d01a001b5d0a57ae
Author: Antoine Amarilli <a3nm@a3nm.net>
Date: Tue, 10 Mar 2015 20:04:08 +0100
run tests with valgrind and log output
Diffstat:
4 files changed, 17 insertions(+), 4 deletions(-)
diff --git a/.gitignore b/.gitignore
@@ -1,3 +1,4 @@
test/*/
old/
irctk
+test/*.log
diff --git a/README b/README
@@ -430,7 +430,8 @@ things down.
You can run the test suite with ./tests_sequential.sh. This requires a working
IRC server on localhost:6667. I use ircd-hybrid from Debian testing, configured
-with throttle_time = 0 and anti_spam_exit_message_time = 0.
+with throttle_time = 0 and anti_spam_exit_message_time = 0. This also requires
+valgrind (which is packaged for Debian).
If you have GNU parallel and if your IRC server isn't afraid of many connections
from a single IP, you can run the tests in parallel: ./tests_parallel.sh. This
diff --git a/runtest.sh b/runtest.sh
@@ -1,7 +1,12 @@
#!/bin/bash
+trap "rm ${1}.tmp" EXIT
cd test
-if setsid ./$1
+# instrument to use valgrind
+sed 's,../../irctk\([^@]*\) \([^ @]*\)@,valgrind --log-file="../'${1%.sh}'_\2.log" ../../irctk\1 \2@,g' $1 \
+ > ${1}.tmp
+chmod +x ${1}.tmp
+if setsid ./${1}.tmp
then
echo "$1: passed"
else
diff --git a/tests_sequential.sh b/tests_sequential.sh
@@ -5,8 +5,14 @@ cd test
for t in *.sh
do
echo -n "$t... "
+ cd ..
+ ./runtest.sh ${t#test/}
+ cd test
#./$t || { echo "FAILED!"; exit 1; }
- setsid ./$t || echo "FAILED!"
- echo "passed."
+ #setsid ./$t || echo "FAILED!"
+ #echo "passed."
done
+# report valgrind errors
+grep -C20 0x *.log
+