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
|
|
|
|
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
|
|
|
|
CONCURRENT_TESTS="-f test_p2p_autogo test_p2p_discovery test_p2p_grpform"
|
|
|
|
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
|
|
|
|
CONCURRENT_TESTS="-f test_p2p_autogo test_p2p_discovery test_p2p_grpform"
|
|
|
|
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-10-30 17:50:56 -04:00
|
|
|
./run-tests.py -D --logdir "$LOGDIR" $TRACE_ARGS -l run $DB -e failed -r results.txt $CONCURRENT_TESTS $@ || errors=1
|
2013-10-30 17:08:10 -04:00
|
|
|
|
2013-10-30 13:49:12 -04:00
|
|
|
./stop-wifi.sh
|
|
|
|
|
|
|
|
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"
|