2013-03-09 20:40:31 +01:00
|
|
|
#!/bin/sh
|
|
|
|
|
2013-03-09 22:29:22 +01:00
|
|
|
errors=0
|
2013-03-30 10:11:55 +01:00
|
|
|
umask 0002
|
2013-08-24 19:33:21 +02:00
|
|
|
|
2013-10-30 22:08:10 +01:00
|
|
|
DATE="$(date +%s)"
|
|
|
|
unset LOGBASEDIR
|
2013-10-30 14:55:58 +01:00
|
|
|
if [ -z "$LOGDIR" ]; then
|
2013-10-30 22:08:10 +01:00
|
|
|
LOGBASEDIR=logs
|
|
|
|
LOGDIR=$LOGBASEDIR/$DATE
|
|
|
|
mkdir -p $LOGDIR
|
2013-10-30 14:55:58 +01:00
|
|
|
fi
|
2013-10-30 22:08:10 +01:00
|
|
|
export LOGDIR
|
2013-10-30 14:55:58 +01:00
|
|
|
|
2013-10-27 00:05:45 +02:00
|
|
|
if [ -z "$DBFILE" ]; then
|
|
|
|
DB=""
|
|
|
|
else
|
2013-10-30 20:01:11 +01:00
|
|
|
DB="-S $DBFILE --commit $(git rev-parse HEAD)"
|
2013-10-27 00:05:45 +02:00
|
|
|
if [ -n "$BUILD" ]; then
|
|
|
|
DB="$DB -b $BUILD"
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|
2013-08-24 19:33:21 +02:00
|
|
|
if [ "x$1" = "xconcurrent-valgrind" ]; then
|
2013-10-30 18:49:12 +01:00
|
|
|
VALGRIND=valgrind
|
|
|
|
CONCURRENT=concurrent
|
|
|
|
CONCURRENT_TESTS="-f test_p2p_autogo test_p2p_discovery test_p2p_grpform"
|
|
|
|
SUFFIX=-concurrent-valgrind
|
|
|
|
shift
|
2013-08-24 19:33:21 +02:00
|
|
|
elif [ "x$1" = "xconcurrent" ]; then
|
2013-10-30 18:49:12 +01:00
|
|
|
CONCURRENT=concurrent
|
|
|
|
CONCURRENT_TESTS="-f test_p2p_autogo test_p2p_discovery test_p2p_grpform"
|
|
|
|
unset VALGRIND
|
|
|
|
SUFFIX=-concurrent
|
|
|
|
shift
|
2013-08-24 19:33:21 +02:00
|
|
|
elif [ "x$1" = "xvalgrind" ]; then
|
2013-10-30 18:49:12 +01: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 21:05:24 +01:00
|
|
|
TRACE_ARGS="-T $LOGDIR"
|
2013-10-30 19:01:56 +01:00
|
|
|
shift
|
2013-10-30 18:49:12 +01:00
|
|
|
else
|
|
|
|
unset TRACE
|
2013-10-30 21:05:24 +01:00
|
|
|
unset TRACE_ARGS
|
2013-10-30 18:49:12 +01:00
|
|
|
fi
|
|
|
|
|
|
|
|
if ! ./start.sh $CONCURRENT $VALGRIND $TRACE; then
|
2013-10-30 22:08:10 +01:00
|
|
|
if ! [ -z "$LOGBASEDIR" ] ; then
|
|
|
|
echo "Could not start test environment" > $LOGDIR/run
|
|
|
|
fi
|
2013-09-28 17:19:38 +02:00
|
|
|
exit 1
|
2013-10-30 18:49:12 +01:00
|
|
|
fi
|
|
|
|
|
2013-10-30 22:08:10 +01:00
|
|
|
if ! [ -z "$LOGBASEDIR" ] ; then
|
|
|
|
rm $LOGBASEDIR/last-debug 2>/dev/null
|
|
|
|
fi
|
|
|
|
./run-tests.py $TRACE_ARGS -l $LOGDIR/run $DB -e $LOGDIR/failed -r $LOGDIR/results.txt $CONCURRENT_TESTS $@ || errors=1
|
|
|
|
|
|
|
|
if ! [ -z "$LOGBASEDIR" ] ; then
|
|
|
|
cat $LOGDIR/run >> $LOGBASEDIR/last-debug
|
|
|
|
fi
|
|
|
|
|
2013-10-30 18:49:12 +01:00
|
|
|
./stop-wifi.sh
|
|
|
|
|
|
|
|
if [ ! -z "$VALGRIND" ] ; then
|
2013-10-30 22:08:10 +01:00
|
|
|
failures=`grep "ERROR SUMMARY" $LOGDIR/valgrind-* | grep -v " 0 errors" | wc -l`
|
2013-08-24 19:33:21 +02:00
|
|
|
if [ $failures -gt 0 ]; then
|
|
|
|
echo "Mark as failed due to valgrind errors"
|
|
|
|
errors=1
|
|
|
|
fi
|
2013-10-30 18:49:12 +01:00
|
|
|
fi
|
|
|
|
if [ $errors -gt 0 ]; then
|
2013-10-30 22:08:10 +01:00
|
|
|
tar czf /tmp/hwsim-tests-$DATE-FAILED$SUFFIX.tar.gz $LOGDIR/
|
2013-10-30 18:49:12 +01:00
|
|
|
exit 1
|
2013-03-09 22:29:22 +01:00
|
|
|
fi
|
2013-09-28 17:19:38 +02:00
|
|
|
|
|
|
|
echo "ALL-PASSED"
|