hostap/tests/hwsim/vm/parallel-vm.sh
Johannes Berg 680ce356c0 tests: Honor HWSIM_TEST_LOG_DIR variable in VM runs
If /tmp has a relatively small size limit, or multiple people run the
tests on the same machine, using the same output directory can easily
cause problems.

Make the test framework honor the new HWSIM_TEST_LOG_DIR environment
variable to make it easier to avoid those problems.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
2015-11-27 21:11:53 +02:00

39 lines
789 B
Bash
Executable file

#!/bin/bash
cd "$(dirname $0)"
NUM=$1
if [ -z "$NUM" ]; then
echo "usage: $0 <num servers> [params..]"
exit 1
fi
shift
if [ -n "$HWSIM_TEST_LOG_DIR" ] ; then
LOGS="$HWSIM_TEST_LOG_DIR"
else
LOGS=/tmp/hwsim-test-logs
fi
mkdir -p $LOGS
DATE=$(date +%s)
for i in `seq 1 $NUM`; do
printf "\rStarting virtual machine $i/$NUM"
./vm-run.sh --timestamp $DATE --ext srv.$i --split $i/$NUM $* >> $LOGS/parallel-$DATE.srv.$i 2>&1 &
done
echo
echo "Waiting for virtual machines to complete testing"
count=$NUM
for i in `seq 1 $NUM`; do
printf "\r$count VM(s) remaining "
wait -n
count=$((count-1))
done
printf "\rTesting completed "
echo
echo -n "PASS count: "
grep ^PASS $LOGS/parallel-$DATE.srv.* | wc -l
cat $LOGS/parallel-$DATE.srv.* | grep FAIL | sort