darkhttpd/devel/cover

35 lines
783 B
Plaintext
Raw Normal View History

2011-01-17 15:59:41 +03:00
#!/bin/sh
#
# Coverage and unit tests!
#
cd $(dirname $0)
2011-01-17 15:59:41 +03:00
DIR=tmp.httpd.tests
PORT=12346
if [ ! -e test.py ]; then
echo "can't find test.py, aborting" >&2
exit 1
fi
2011-05-03 14:11:09 +04:00
if [ \( ! -x a.out \) -o \( ../darkhttpd.c -nt a.out \) ]; then
2011-01-17 15:59:41 +03:00
gcc -g -fprofile-arcs -ftest-coverage ../darkhttpd.c || exit 1
# generates a.out, darkhttpd.gcno
fi
if [ -e $DIR ]; then
rm -rf $DIR || exit 1
fi
mkdir $DIR || exit 1
2011-04-16 13:15:32 +04:00
rm -f darkhttpd.gcda darkhttpd.log
2011-05-03 14:14:10 +04:00
# display usage statement
./a.out >/dev/null
# run all tests against this instance (generates darkhttpd.gcda)
2011-04-16 13:15:32 +04:00
./a.out $DIR --port $PORT --log darkhttpd.log &
2011-01-17 15:59:41 +03:00
PID=$!
kill -0 $PID || exit 1
python test.py
kill $PID
echo generating darkhttpd.c.gcov report
2011-01-17 15:59:41 +03:00
gcov darkhttpd
rm -rf $DIR
rm -f darkhttpd.gcda darkhttpd.gcno darkhttpd.log a.out
echo done