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 14:55:58 +01:00
|
|
|
if [ -z "$LOGDIR" ]; then
|
|
|
|
LOGDIR=logs
|
|
|
|
fi
|
|
|
|
|
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
|
|
|
|
else
|
|
|
|
unset TRACE
|
|
|
|
fi
|
|
|
|
|
|
|
|
if ! ./start.sh $CONCURRENT $VALGRIND $TRACE; then
|
2013-10-30 14:55:58 +01:00
|
|
|
echo "Could not start test environment" > $LOGDIR/last-debug
|
2013-09-28 17:19:38 +02:00
|
|
|
exit 1
|
2013-10-30 18:49:12 +01:00
|
|
|
fi
|
|
|
|
DATE=`ls -1tr $LOGDIR | tail -1 | cut -f1 -d-`
|
|
|
|
rm $LOGDIR/last-debug 2>/dev/null
|
|
|
|
RUNTESTS="./run-tests.py -l $LOGDIR/$DATE-run $DB -e $LOGDIR/$DATE-failed -r $LOGDIR/results.txt $CONCURRENT_TESTS"
|
|
|
|
|
|
|
|
if [ "$TRACE" != "" ] ; then
|
|
|
|
sudo trace-cmd record -o $LOGDIR/$DATE-trace.dat -e mac80211 -e cfg80211 su $USER -c $RUNTESTS || errors=1
|
|
|
|
else
|
|
|
|
$RUNTESTS || errors=1
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
|
|
cat $LOGDIR/$DATE-run >> $LOGDIR/last-debug
|
|
|
|
./stop-wifi.sh
|
|
|
|
|
|
|
|
if [ ! -z "$VALGRIND" ] ; then
|
2013-10-30 14:55:58 +01:00
|
|
|
failures=`grep "ERROR SUMMARY" $LOGDIR/$DATE-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
|
|
|
|
tar czf /tmp/hwsim-tests-$DATE-FAILED$SUFFIX.tar.gz $LOGDIR/$DATE*
|
|
|
|
exit 1
|
2013-03-09 22:29:22 +01:00
|
|
|
fi
|
2013-09-28 17:19:38 +02:00
|
|
|
|
|
|
|
echo "ALL-PASSED"
|