From: Johannes Berg <johannes.berg@xxxxxxxxx> If telnetd is installed, start it inside the VM(s) to be able to look into them when something is wrong. Use a user network in qemu with a single host forward from ports 4000 (and higher for parallel-vm) for this. Signed-off-by: Johannes Berg <johannes.berg@xxxxxxxxx> --- tests/hwsim/vm/inside.sh | 22 ++++++++++++++++++++++ tests/hwsim/vm/parallel-vm.py | 2 +- tests/hwsim/vm/vm-run.sh | 10 ++++++++-- 3 files changed, 31 insertions(+), 3 deletions(-) diff --git a/tests/hwsim/vm/inside.sh b/tests/hwsim/vm/inside.sh index ac01d411c3b2..3130557dfcfd 100755 --- a/tests/hwsim/vm/inside.sh +++ b/tests/hwsim/vm/inside.sh @@ -15,6 +15,10 @@ mount sysfs -t sysfs /sys # needed for tracing mount debugfs -t debugfs /sys/kernel/debug +# for inside telnet +mkdir /dev/pts +mount devpts -t devpts /dev/pts + export PATH=/usr/sbin:$PATH # reboot on any sort of crash @@ -29,6 +33,7 @@ ARGS=$(sed 's/.*ARGS=\([^ ]*\)\( \|$\).*/\1/' /proc/cmdline) # create /dev entries we need mknod -m 660 /dev/ttyS0 c 4 64 +mknod -m 666 /dev/ptmx c 5 2 mknod -m 660 /dev/random c 1 8 mknod -m 660 /dev/urandom c 1 9 mknod -m 666 /dev/null c 1 3 @@ -96,8 +101,25 @@ if [ "$TIMEWARP" = "1" ] ; then ) & fi +echo hwsimvm > /proc/sys/kernel/hostname echo 8 8 8 8 > /proc/sys/kernel/printk +cat > /tmp/bin/login <<EOF +#!/bin/sh + +export PS1='\h:\w\$ ' +exec bash +EOF +chmod +x /tmp/bin/login + +ip link set eth0 up +ip addr add 172.16.0.15/24 dev eth0 +which in.telnetd >/dev/null && ( + while true ; do + in.telnetd -debug 23 -L /tmp/bin/login + done +) & + # check if we're rebooting due to a kernel panic ... if grep -q 'Kernel panic' /tmp/logs/console ; then echo "KERNEL CRASHED!" >/dev/ttyS0 diff --git a/tests/hwsim/vm/parallel-vm.py b/tests/hwsim/vm/parallel-vm.py index c9baf5a6c2e1..34d8d5505085 100755 --- a/tests/hwsim/vm/parallel-vm.py +++ b/tests/hwsim/vm/parallel-vm.py @@ -433,7 +433,7 @@ def main(): logger.info("Starting virtual machine {}/{}".format(i + 1, num_servers)) cmd = [os.path.join(scriptsdir, 'vm-run.sh'), '--delay', str(i), '--timestamp', str(timestamp), - '--ext', 'srv.%d' % (i + 1), + '--num', '%d' % (i + 1), '-i'] + codecov_args + extra_args vm[i] = {} vm[i]['first_run_done'] = False diff --git a/tests/hwsim/vm/vm-run.sh b/tests/hwsim/vm/vm-run.sh index 67168da9b08c..40d6bfb76db8 100755 --- a/tests/hwsim/vm/vm-run.sh +++ b/tests/hwsim/vm/vm-run.sh @@ -32,6 +32,9 @@ KVMOUT=ttyS1 # number of channels each hwsim device supports CHANNELS=1 +# telnet (for debug) base port +BASEPORT=4000 + test -f vm-config && . vm-config test -f ~/.wpas-vm-config && . ~/.wpas-vm-config @@ -53,14 +56,16 @@ CODECOV=no TIMEWARP=0 DELAY=0 CODECOV_DIR= +PORT=$BASEPORT while [ "$1" != "" ]; do case $1 in --timestamp ) shift TIMESTAMP=$1 shift ;; - --ext ) shift - DATE=$TIMESTAMP.$1 + --num ) shift + DATE=$TIMESTAMP.srv.$1 + PORT=$(( $BASEPORT + $1 - 1 )) shift ;; --codecov ) shift @@ -134,6 +139,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 \ + -nic user,ipv6=off,model=virtio-net-pci,restrict=on,net=172.16.0.0/24,hostfwd=tcp:127.0.0.1:$PORT-:23 \ -append "mac80211_hwsim.support_p2p_device=0 mac80211_hwsim.channels=$CHANNELS mac80211_hwsim.radios=7 cfg80211.dyndbg=+p mac80211.dyndbg=+p mac80211_hwsim.dyndbg=+p init=$CMD testdir=$TESTDIR timewarp=$TIMEWARP console=$KVMOUT root=/dev/root rootflags=trans=virtio,version=9p2000.u ro rootfstype=9p EPATH=$EPATH ARGS=$argsfile" | \ sed -u '1,/running inside a VM/d' -- 2.17.2 _______________________________________________ Hostap mailing list Hostap@xxxxxxxxxxxxxxxxxxx http://lists.infradead.org/mailman/listinfo/hostap