parallel-vm.sh 789 B

1234567891011121314151617181920212223242526272829303132333435363738
  1. #!/bin/bash
  2. cd "$(dirname $0)"
  3. NUM=$1
  4. if [ -z "$NUM" ]; then
  5. echo "usage: $0 <num servers> [params..]"
  6. exit 1
  7. fi
  8. shift
  9. if [ -n "$HWSIM_TEST_LOG_DIR" ] ; then
  10. LOGS="$HWSIM_TEST_LOG_DIR"
  11. else
  12. LOGS=/tmp/hwsim-test-logs
  13. fi
  14. mkdir -p $LOGS
  15. DATE=$(date +%s)
  16. for i in `seq 1 $NUM`; do
  17. printf "\rStarting virtual machine $i/$NUM"
  18. ./vm-run.sh --timestamp $DATE --ext srv.$i --split $i/$NUM $* >> $LOGS/parallel-$DATE.srv.$i 2>&1 &
  19. done
  20. echo
  21. echo "Waiting for virtual machines to complete testing"
  22. count=$NUM
  23. for i in `seq 1 $NUM`; do
  24. printf "\r$count VM(s) remaining "
  25. wait -n
  26. count=$((count-1))
  27. done
  28. printf "\rTesting completed "
  29. echo
  30. echo -n "PASS count: "
  31. grep ^PASS $LOGS/parallel-$DATE.srv.* | wc -l
  32. cat $LOGS/parallel-$DATE.srv.* | grep FAIL | sort