2013-03-09 14:40:31 -05:00
|
|
|
#!/bin/sh
|
|
|
|
|
2013-03-09 16:29:22 -05:00
|
|
|
errors=0
|
2013-03-30 05:11:55 -04:00
|
|
|
umask 0002
|
2013-08-24 13:33:21 -04:00
|
|
|
|
2013-10-30 17:08:10 -04:00
|
|
|
DATE="$(date +%s)"
|
|
|
|
unset LOGBASEDIR
|
2013-10-30 09:55:58 -04:00
|
|
|
if [ -z "$LOGDIR" ]; then
|
2013-10-30 17:08:10 -04:00
|
|
|
LOGBASEDIR=logs
|
|
|
|
LOGDIR=$LOGBASEDIR/$DATE
|
|
|
|
mkdir -p $LOGDIR
|
2013-10-30 09:55:58 -04:00
|
|
|
fi
|
2013-10-30 17:08:10 -04:00
|
|
|
export LOGDIR
|
2013-10-30 09:55:58 -04:00
|
|
|
|
2013-10-26 18:05:45 -04:00
|
|
|
if [ -z "$DBFILE" ]; then
|
|
|
|
DB=""
|
|
|
|
else
|
2013-10-30 15:01:11 -04:00
|
|
|
DB="-S $DBFILE --commit $(git rev-parse HEAD)"
|
2013-10-26 18:05:45 -04:00
|
|
|
if [ -n "$BUILD" ]; then
|
|
|
|
DB="$DB -b $BUILD"
|
|
|
|
fi
|
2013-10-31 11:05:11 -04:00
|
|
|
if [ "$PREFILL_DB" = "y" ] ; then
|
|
|
|
DB="$DB --prefill-tests"
|
|
|
|
fi
|
2013-10-26 18:05:45 -04:00
|
|
|
fi
|
|
|
|
|
2013-08-24 13:33:21 -04:00
|
|
|
if [ "x$1" = "xconcurrent-valgrind" ]; then
|
2013-10-30 13:49:12 -04:00
|
|
|
VALGRIND=valgrind
|
|
|
|
CONCURRENT=concurrent
|
2013-10-31 05:47:43 -04:00
|
|
|
CONCURRENT_TESTS="-f p2p_autogo p2p_discovery p2p_grpform"
|
2013-10-30 13:49:12 -04:00
|
|
|
SUFFIX=-concurrent-valgrind
|
|
|
|
shift
|
2013-08-24 13:33:21 -04:00
|
|
|
elif [ "x$1" = "xconcurrent" ]; then
|
2013-10-30 13:49:12 -04:00
|
|
|
CONCURRENT=concurrent
|
2013-10-31 05:47:43 -04:00
|
|
|
CONCURRENT_TESTS="-f p2p_autogo p2p_discovery p2p_grpform"
|
2013-10-30 13:49:12 -04:00
|
|
|
unset VALGRIND
|
|
|
|
SUFFIX=-concurrent
|
|
|
|
shift
|
2013-08-24 13:33:21 -04:00
|
|
|
elif [ "x$1" = "xvalgrind" ]; then
|
2013-10-30 13:49:12 -04:00
|
|
|
VALGRIND=valgrind
|
|
|
|
unset CONCURRENT
|
|
|
|
unset CONCURRENT_TESTS
|
|
|
|
SUFFIX=-valgrind
|
|
|
|
shift
|
|
|
|
else
|
|
|
|
unset VALGRIND
|
|
|
|
unset CONCURRENT
|
|
|
|
unset CONCURRENT_TESTS
|
|
|
|
SUFFIX=
|
|
|
|
fi
|
|
|
|
|
|
|
|
if [ "x$1" = "xtrace" ] ; then
|
|
|
|
TRACE=trace
|
|
|
|
SUFFIX=$SUFFIX-trace
|
2013-10-30 17:37:15 -04:00
|
|
|
TRACE_ARGS="-T"
|
2013-10-30 14:01:56 -04:00
|
|
|
shift
|
2013-10-30 13:49:12 -04:00
|
|
|
else
|
|
|
|
unset TRACE
|
2013-10-30 16:05:24 -04:00
|
|
|
unset TRACE_ARGS
|
2013-10-30 13:49:12 -04:00
|
|
|
fi
|
|
|
|
|
|
|
|
if ! ./start.sh $CONCURRENT $VALGRIND $TRACE; then
|
2013-10-30 17:08:10 -04:00
|
|
|
if ! [ -z "$LOGBASEDIR" ] ; then
|
|
|
|
echo "Could not start test environment" > $LOGDIR/run
|
|
|
|
fi
|
2013-09-28 11:19:38 -04:00
|
|
|
exit 1
|
2013-10-30 13:49:12 -04:00
|
|
|
fi
|
|
|
|
|
2013-11-02 06:20:59 -04:00
|
|
|
./run-tests.py -D --logdir "$LOGDIR" $TRACE_ARGS -q $DB $CONCURRENT_TESTS $@ || errors=1
|
2013-10-30 17:08:10 -04:00
|
|
|
|
2013-11-02 09:39:25 -04:00
|
|
|
./stop.sh
|
2013-10-30 13:49:12 -04:00
|
|
|
|
|
|
|
if [ ! -z "$VALGRIND" ] ; then
|
2013-10-30 17:08:10 -04:00
|
|
|
failures=`grep "ERROR SUMMARY" $LOGDIR/valgrind-* | grep -v " 0 errors" | wc -l`
|
2013-08-24 13:33:21 -04:00
|
|
|
if [ $failures -gt 0 ]; then
|
|
|
|
echo "Mark as failed due to valgrind errors"
|
|
|
|
errors=1
|
|
|
|
fi
|
2013-10-30 13:49:12 -04:00
|
|
|
fi
|
|
|
|
if [ $errors -gt 0 ]; then
|
2013-10-30 17:08:10 -04:00
|
|
|
tar czf /tmp/hwsim-tests-$DATE-FAILED$SUFFIX.tar.gz $LOGDIR/
|
2013-10-30 13:49:12 -04:00
|
|
|
exit 1
|
2013-03-09 16:29:22 -05:00
|
|
|
fi
|
2013-09-28 11:19:38 -04:00
|
|
|
|
|
|
|
echo "ALL-PASSED"
|