run-all.sh 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  1. #!/bin/sh
  2. errors=0
  3. umask 0002
  4. if [ -z "$LOGDIR" ]; then
  5. LOGDIR=logs
  6. fi
  7. if [ -z "$DBFILE" ]; then
  8. DB=""
  9. else
  10. DB="-S $DBFILE --commit $(git rev-parse HEAD)"
  11. if [ -n "$BUILD" ]; then
  12. DB="$DB -b $BUILD"
  13. fi
  14. fi
  15. if [ "x$1" = "xconcurrent-valgrind" ]; then
  16. VALGRIND=valgrind
  17. CONCURRENT=concurrent
  18. CONCURRENT_TESTS="-f test_p2p_autogo test_p2p_discovery test_p2p_grpform"
  19. SUFFIX=-concurrent-valgrind
  20. shift
  21. elif [ "x$1" = "xconcurrent" ]; then
  22. CONCURRENT=concurrent
  23. CONCURRENT_TESTS="-f test_p2p_autogo test_p2p_discovery test_p2p_grpform"
  24. unset VALGRIND
  25. SUFFIX=-concurrent
  26. shift
  27. elif [ "x$1" = "xvalgrind" ]; then
  28. VALGRIND=valgrind
  29. unset CONCURRENT
  30. unset CONCURRENT_TESTS
  31. SUFFIX=-valgrind
  32. shift
  33. else
  34. unset VALGRIND
  35. unset CONCURRENT
  36. unset CONCURRENT_TESTS
  37. SUFFIX=
  38. fi
  39. if [ "x$1" = "xtrace" ] ; then
  40. TRACE=trace
  41. SUFFIX=$SUFFIX-trace
  42. shift
  43. else
  44. unset TRACE
  45. fi
  46. if ! ./start.sh $CONCURRENT $VALGRIND $TRACE; then
  47. echo "Could not start test environment" > $LOGDIR/last-debug
  48. exit 1
  49. fi
  50. DATE=`ls -1tr $LOGDIR | tail -1 | cut -f1 -d-`
  51. rm $LOGDIR/last-debug 2>/dev/null
  52. RUNTESTS="./run-tests.py -l $LOGDIR/$DATE-run $DB -e $LOGDIR/$DATE-failed -r $LOGDIR/results.txt $CONCURRENT_TESTS $@"
  53. if [ "$TRACE" != "" ] ; then
  54. sudo trace-cmd record -o $LOGDIR/$DATE-trace.dat -e mac80211 -e cfg80211 su $USER -c $RUNTESTS || errors=1
  55. else
  56. $RUNTESTS || errors=1
  57. fi
  58. cat $LOGDIR/$DATE-run >> $LOGDIR/last-debug
  59. ./stop-wifi.sh
  60. if [ ! -z "$VALGRIND" ] ; then
  61. failures=`grep "ERROR SUMMARY" $LOGDIR/$DATE-valgrind-* | grep -v " 0 errors" | wc -l`
  62. if [ $failures -gt 0 ]; then
  63. echo "Mark as failed due to valgrind errors"
  64. errors=1
  65. fi
  66. fi
  67. if [ $errors -gt 0 ]; then
  68. tar czf /tmp/hwsim-tests-$DATE-FAILED$SUFFIX.tar.gz $LOGDIR/$DATE*
  69. exit 1
  70. fi
  71. echo "ALL-PASSED"