From 7e6942253c5a0723aae8a29f9a5a74c1f603ccda Mon Sep 17 00:00:00 2001 From: Jouni Malinen Date: Sun, 16 Nov 2014 22:24:18 +0200 Subject: [PATCH] tests: Use a single timestamp in all vm-run.sh instances This avoids possible mismatches in directory and log file timestamps if the UNIX timestamp (seconds) changes during the startup sequence. Signed-off-by: Jouni Malinen --- tests/hwsim/vm/parallel-vm.py | 3 ++- tests/hwsim/vm/parallel-vm.sh | 2 +- tests/hwsim/vm/vm-run.sh | 9 +++++++-- 3 files changed, 10 insertions(+), 4 deletions(-) diff --git a/tests/hwsim/vm/parallel-vm.py b/tests/hwsim/vm/parallel-vm.py index 42083f761..6436c341c 100755 --- a/tests/hwsim/vm/parallel-vm.py +++ b/tests/hwsim/vm/parallel-vm.py @@ -129,7 +129,8 @@ def main(): vm = {} for i in range(0, num_servers): print("\rStarting virtual machine {}/{}".format(i + 1, num_servers)), - cmd = ['./vm-run.sh', '--ext', 'srv.%d' % (i + 1), + cmd = ['./vm-run.sh', '--timestamp', str(timestamp), + '--ext', 'srv.%d' % (i + 1), '--split', '%d/%d' % (i + 1, num_servers)] + sys.argv[2:] vm[i] = {} vm[i]['proc'] = subprocess.Popen(cmd, diff --git a/tests/hwsim/vm/parallel-vm.sh b/tests/hwsim/vm/parallel-vm.sh index 9074b82e5..b2fd0786f 100755 --- a/tests/hwsim/vm/parallel-vm.sh +++ b/tests/hwsim/vm/parallel-vm.sh @@ -15,7 +15,7 @@ DATE=$(date +%s) for i in `seq 1 $NUM`; do printf "\rStarting virtual machine $i/$NUM" - ./vm-run.sh --ext srv.$i --split $i/$NUM $* >> $LOGS/parallel-$DATE.srv.$i 2>&1 & + ./vm-run.sh --timestamp $DATE --ext srv.$i --split $i/$NUM $* >> $LOGS/parallel-$DATE.srv.$i 2>&1 & done echo diff --git a/tests/hwsim/vm/vm-run.sh b/tests/hwsim/vm/vm-run.sh index 762651695..478690a9c 100755 --- a/tests/hwsim/vm/vm-run.sh +++ b/tests/hwsim/vm/vm-run.sh @@ -43,13 +43,18 @@ fi CMD=$TESTDIR/vm/inside.sh unset RUN_TEST_ARGS -DATE=$(date +%s) +TIMESTAMP=$(date +%s) +DATE=$TIMESTAMP CODECOV=no TIMEWARP=0 while [ "$1" != "" ]; do case $1 in + --timestamp ) shift + TIMESTAMP=$1 + shift + ;; --ext ) shift - DATE=$(date +%s).$1 + DATE=$TIMESTAMP.$1 shift ;; --codecov ) shift