2015-04-09 23:20:51 +00:00
|
|
|
#!/bin/bash -x
|
2007-09-10 20:28:03 +00:00
|
|
|
|
2012-11-21 21:28:52 +00:00
|
|
|
# Argument can be substring of tests (such as 'local')
|
|
|
|
|
2010-06-14 22:05:47 +00:00
|
|
|
export LANG=C
|
2010-05-27 22:34:00 +00:00
|
|
|
SHFILE=/tmp/unittest-parallel.sh
|
2013-02-01 19:44:56 +00:00
|
|
|
MAX_SEC_PER_TEST=900
|
|
|
|
export TIMEOUT=$MAX_SEC_PER_TEST
|
2010-05-27 22:34:00 +00:00
|
|
|
|
2015-04-09 23:20:51 +00:00
|
|
|
run_test() {
|
|
|
|
script="$1"
|
|
|
|
base=`basename "$script" .sh`
|
2015-04-20 22:08:08 +00:00
|
|
|
export TMPDIR=/tmp/$base
|
2015-04-09 23:20:51 +00:00
|
|
|
if [ "$TRIES" = "3" ] ; then
|
|
|
|
# Try 3 times
|
|
|
|
bash $script > actual-results/$base
|
|
|
|
diff -Naur wanted-results/$base actual-results/$base >/dev/null ||
|
|
|
|
bash $script > actual-results/$base
|
|
|
|
diff -Naur wanted-results/$base actual-results/$base >/dev/null ||
|
|
|
|
bash $script > actual-results/$base
|
|
|
|
diff -Naur wanted-results/$base actual-results/$base ||
|
|
|
|
(touch $script && echo touch $script)
|
|
|
|
else
|
|
|
|
# Run only once
|
|
|
|
bash $script > actual-results/$base
|
|
|
|
diff -Naur wanted-results/$base actual-results/$base ||
|
|
|
|
(touch $script && echo touch $script)
|
|
|
|
fi
|
|
|
|
|
|
|
|
# Check if it was cleaned up
|
|
|
|
find /tmp -maxdepth 1 |
|
2015-04-17 21:51:45 +00:00
|
|
|
perl -ne '/\.(tmx|pac|arg|all|log|swp|loa|ssh|df|pip|tmb|chr|tms|par)$/ and ++$a and print "TMP NOT CLEAN. FOUND: $_".`touch '$script'`;'
|
2015-04-09 23:20:51 +00:00
|
|
|
# May be owned by other users
|
2015-04-17 21:51:45 +00:00
|
|
|
sudo rm -f /tmp/*.{tmx,pac,arg,all,log,swp,loa,ssh,df,pip,tmb,chr,tms,par}
|
2015-04-09 23:20:51 +00:00
|
|
|
}
|
|
|
|
export -f run_test
|
2012-11-21 21:28:52 +00:00
|
|
|
|
2015-04-19 00:55:17 +00:00
|
|
|
# Create a monitor script
|
|
|
|
echo forever pstree -lp $$ >/tmp/monitor
|
|
|
|
chmod 755 /tmp/monitor
|
2015-04-04 14:37:32 +00:00
|
|
|
date
|
2010-06-25 23:56:14 +00:00
|
|
|
mkdir -p actual-results
|
2015-04-09 23:20:51 +00:00
|
|
|
ls -t tests-to-run/*${1}*.sh | grep -v ${2} |
|
|
|
|
stdout parallel --tty -tj1 run_test | tee testsuite.log
|
2011-07-16 23:46:02 +00:00
|
|
|
# If testsuite.log contains @@ then there is a diff
|
|
|
|
if grep -q '@@' testsuite.log ; then
|
|
|
|
false
|
|
|
|
else
|
|
|
|
# No @@'s: So everything worked: Copy the source
|
|
|
|
rm -rf src-passing-testsuite
|
|
|
|
cp -a ../src src-passing-testsuite
|
|
|
|
fi
|
|
|
|
rm testsuite.log
|
2015-04-04 14:37:32 +00:00
|
|
|
date
|