]>
git.ipfire.org Git - thirdparty/hostap.git/blob - tests/hwsim/vm/vm-run.sh
5 if [ -z "$TESTDIR" ] ; then
9 if [ -n "$HWSIM_TEST_LOG_DIR" ] ; then
10 LOGS
="$HWSIM_TEST_LOG_DIR"
12 LOGS
=/tmp
/hwsim-test-logs
15 # increase the memory size if you want to run with valgrind, 512 MB works
18 # Some ubuntu systems (notably 12.04) have issues with this - since the guest
19 # mounts as read-only it should be safe to not specify ,readonly. Override in
20 # vm-config if needed (see below)
23 # set this to ttyS0 to see kvm messages (if something doesn't work)
26 # you can set EPATH if you need anything extra in $PATH inside the VM
29 # extra KVM arguments, e.g., -s for gdbserver
32 # number of channels each hwsim device supports
35 test -f vm-config
&& . vm-config
36 test -f ~
/.wpas-vm-config
&& . ~
/.wpas-vm-config
38 if [ -z "$KERNEL" ] && [ -z "$KERNELDIR" ] ; then
39 echo "You need to set a KERNEL or KERNELDIR (in the environment or vm-config)"
42 if [ -z "$KERNEL" ] ; then
43 if [ -e $KERNELDIR/arch
/x86_64
/boot
/bzImage
]; then
44 KERNEL
=$KERNELDIR/arch
/x86_64
/boot
/bzImage
45 elif [ -e $KERNELDIR/linux
]; then
46 KERNEL
=$KERNELDIR/linux
48 echo "No suitable kernel image found from KERNELDIR"
52 if [ ! -e $KERNEL ]; then
53 echo "Kernel image not found: $KERNEL"
58 CMD
=$TESTDIR/vm
/inside.sh
68 while [ "$1" != "" ]; do
90 TELNET_QEMU
="-net nic,model=virtio -net user,id=telnet,restrict=on,net=172.16.0.0/24,hostfwd=tcp:127.0.0.1:$1-:23"
94 RUN_TEST_ARGS
="$RUN_TEST_ARGS$1 "
103 ln -s $LOGDIR $LOGS/latest
105 if [ -n "$CODECOV_DIR" ]; then
106 cp -a $CODECOV_DIR/alt-wpa_supplicant
$LOGDIR
107 cp -a $CODECOV_DIR/alt-hostapd
$LOGDIR
108 cp -a $CODECOV_DIR/alt-hostapd-as
$LOGDIR
109 cp -a $CODECOV_DIR/alt-hlr_auc_gw
$LOGDIR
110 elif [ $CODECOV = "yes" ]; then
111 .
/build-codecov.sh
$LOGDIR ||
exit 1
116 echo "Starting test run in a virtual machine"
118 if [ -x $KERNEL ]; then
122 for kvmprog
in kvm qemu-kvm
; do
123 if $kvmprog --version &> /dev
/null
; then
131 if [ $?
-ne 0 ] ; then
140 RUN_TEST_ARGS
="--long $RUN_TEST_ARGS"
142 echo "$RUN_TEST_ARGS" > $argsfile
144 A
="mac80211_hwsim.support_p2p_device=0 "
145 A
+="mac80211_hwsim.channels=$CHANNELS "
146 A
+="mac80211_hwsim.radios=7 "
147 A
+="cfg80211.dyndbg=+p "
148 A
+="mac80211.dyndbg=+p "
149 A
+="mac80211_hwsim.dyndbg=+p "
151 A
+="testdir=$TESTDIR "
152 A
+="timewarp=$TIMEWARP "
153 A
+="TELNET=$TELNET_ARG "
156 A
+="console=$KVMOUT "
163 time-travel
=inf-cpu \
165 root
=none hostfs
=/ rootfstype
=hostfs rootflags
=/ \
169 100<>$LOGDIR/console
2>&1 | \
170 sed -u '0,/VM has started up/d'
178 -fsdev local,security_model
=none
,id
=fsdev-root
,path
=/$ROTAG \
179 -device virtio-9p-pci
,id
=fs-root
,fsdev
=fsdev-root
,mount_tag
=/dev
/root \
180 -fsdev local,security_model
=none
,id
=fsdev-logs
,path
="$LOGDIR",writeout
=immediate \
181 -device virtio-9p-pci
,id
=fs-logs
,fsdev
=fsdev-logs
,mount_tag
=logshare \
184 -serial file:$LOGDIR/console \
186 -append "$A root=/dev/root rootflags=trans=virtio,version=9p2000.u rootfstype=9p" | \
187 sed -u '0,/VM has started up/d'
190 if [ $CODECOV = "yes" ]; then
191 echo "Preparing code coverage reports"
192 .
/process-codecov.sh
$LOGDIR "" restore
193 .
/combine-codecov.sh
$LOGDIR lcov
197 echo "Test run completed"
198 echo "Logfiles are at $LOGDIR ($LOGS/latest)"
199 if [ $CODECOV = "yes" ]; then
200 echo "Code coverage report:"
201 echo "file://$LOGDIR/lcov/index.html"