C-Thread-Pool/tests/pause_resume.sh

37 lines
684 B
Bash
Raw Normal View History

2015-03-06 19:18:15 +03:00
#! /bin/bash
2015-01-16 22:37:20 +03:00
#
# This file has several tests to check for memory leaks.
# valgrind is used so make sure you have it installed
#
2015-03-06 19:26:05 +03:00
. funcs.sh
2015-01-16 22:37:20 +03:00
# ---------------------------- Tests -----------------------------------
function test_pause_resume_est7secs { #threads
echo "Pause and resume test for 7 secs with $1 threads"
compile src/pause_resume.c
2015-01-16 22:37:20 +03:00
realsecs=$(/usr/bin/time -f '%e' ./test "$1" 2>&1 > /dev/null)
threshold=1.00 # in secs
ret=$(python -c "print(($realsecs-7)<=$threshold)")
if [ "$ret" == "True" ]; then
return
fi
err "Elapsed $realsecs which is more than than allowed"
2015-01-17 23:27:00 +03:00
exit 1
2015-01-16 22:37:20 +03:00
}
# Run tests
test_pause_resume_est7secs 4
echo "No pause/resume errors"