From 23fcfd6004004dbc51e4f1a4df728becd6b465cf Mon Sep 17 00:00:00 2001 From: Johannes Berg Date: Mon, 30 Nov 2015 11:59:09 +0100 Subject: [PATCH] tests: Allow passing more arguments to vm-run.sh The script is currently limited by the maximum kernel command line length and if that's exceeded the kernel panics at boot. Fix this by writing the arguments to a file and reading it in the VM. Signed-off-by: Johannes Berg --- tests/hwsim/vm/inside.sh | 8 ++++++-- tests/hwsim/vm/vm-run.sh | 13 ++++++++++++- 2 files changed, 18 insertions(+), 3 deletions(-) diff --git a/tests/hwsim/vm/inside.sh b/tests/hwsim/vm/inside.sh index 603980813..3cbfe1081 100755 --- a/tests/hwsim/vm/inside.sh +++ b/tests/hwsim/vm/inside.sh @@ -22,7 +22,7 @@ sysctl kernel.panic=1 TESTDIR=$(sed 's/.*testdir=\([^ ]*\) .*/\1/' /proc/cmdline) TIMEWARP=$(sed 's/.*timewarp=\([^ ]*\) .*/\1/' /proc/cmdline) EPATH=$(sed 's/.*EPATH=\([^ ]*\) .*/\1/' /proc/cmdline) -ARGS=$(sed 's/.*ARGS=//' /proc/cmdline) +ARGS=$(sed 's/.*ARGS=\([^ ]*\)\( \|$\).*/\1/' /proc/cmdline) # create /dev entries we need mknod -m 660 /dev/ttyS0 c 4 64 @@ -78,6 +78,10 @@ ip link set lo up mkdir /tmp/logs mount -t 9p -o trans=virtio,rw logshare /tmp/logs +# allow access to any outside directory (e.g. /tmp) we also have +mkdir /tmp/host +mount --bind / /tmp/host + if [ "$TIMEWARP" = "1" ] ; then ( while sleep 1 ; do @@ -107,7 +111,7 @@ else dbus-daemon --config-file=$TESTDIR/vm/dbus.conf --fork cd $TESTDIR - ./run-all.sh $ARGS /dev/ttyS0 2>&1 + ./run-all.sh $(cat /tmp/host$ARGS) /dev/ttyS0 2>&1 if test -d /sys/kernel/debug/gcov ; then cp -ar /sys/kernel/debug/gcov /tmp/logs/ # these are broken as they're updated while being read ... diff --git a/tests/hwsim/vm/vm-run.sh b/tests/hwsim/vm/vm-run.sh index ab4df4c10..c0ef5b0fe 100755 --- a/tests/hwsim/vm/vm-run.sh +++ b/tests/hwsim/vm/vm-run.sh @@ -113,6 +113,17 @@ for kvmprog in kvm qemu-kvm; do fi done +argsfile=$(mktemp) +if [ $? -ne 0 ] ; then + exit 2 +fi +function finish { + rm -f $argsfile +} +trap finish EXIT + +echo "$RUN_TEST_ARGS" > $argsfile + $KVM \ -kernel $KERNEL -smp 4 \ $KVMARGS -m $MEMORY -nographic \ @@ -121,7 +132,7 @@ $KVM \ -fsdev local,security_model=none,id=fsdev-logs,path="$LOGDIR",writeout=immediate \ -device virtio-9p-pci,id=fs-logs,fsdev=fsdev-logs,mount_tag=logshare \ -monitor null -serial stdio -serial file:$LOGDIR/console \ - -append "mac80211_hwsim.support_p2p_device=0 mac80211_hwsim.channels=$CHANNELS mac80211_hwsim.radios=7 init=$CMD testdir=$TESTDIR timewarp=$TIMEWARP console=$KVMOUT root=/dev/root rootflags=trans=virtio,version=9p2000.u ro rootfstype=9p EPATH=$EPATH ARGS=$RUN_TEST_ARGS" + -append "mac80211_hwsim.support_p2p_device=0 mac80211_hwsim.channels=$CHANNELS mac80211_hwsim.radios=7 init=$CMD testdir=$TESTDIR timewarp=$TIMEWARP console=$KVMOUT root=/dev/root rootflags=trans=virtio,version=9p2000.u ro rootfstype=9p EPATH=$EPATH ARGS=$argsfile" if [ $CODECOV = "yes" ]; then echo "Preparing code coverage reports"