5 if [ -z "$TESTDIR" ] ; then
9 LOGS
=/tmp
/hwsim-test-logs
11 # increase the memory size if you want to run with valgrind, 512 MB works
14 # Some ubuntu systems (notably 12.04) have issues with this - since the guest
15 # mounts as read-only it should be safe to not specify ,readonly. Override in
16 # vm-config if needed (see below)
19 # set this to ttyS0 to see kvm messages (if something doesn't work)
22 # you can set EPATH if you need anything extra in $PATH inside the VM
25 # extra KVM arguments, e.g., -s for gdbserver
28 # number of channels each hwsim device supports
31 test -f vm-config
&& . vm-config
32 test -f ~
/.wpas-vm-config
&& . ~
/.wpas-vm-config
34 if [ -z "$KERNEL" ] && [ -z "$KERNELDIR" ] ; then
35 echo "You need to set a KERNEL or KERNELDIR (in the environment or vm-config)"
38 if [ -z "$KERNEL" ] ; then
39 KERNEL
=$KERNELDIR/arch
/x86_64
/boot
/bzImage
43 CMD
=$TESTDIR/vm
/inside.sh
48 if [ "$1" = "--codecov" ]; then
52 if [ -e /tmp
/logs
]; then
53 echo "/tmp/logs exists - cannot prepare build trees"
57 echo "Preparing separate build trees for hostapd/wpa_supplicant"
59 git archive
--format=tar --prefix=hostap
/ HEAD
> /tmp
/logs
/hostap.
tar
61 cat ..
/..
/..
/wpa_supplicant
/.config
> /tmp
/logs
/wpa_supplicant.config
62 echo "CONFIG_CODE_COVERAGE=y" >> /tmp
/logs
/wpa_supplicant.config
63 cat ..
/..
/..
/hostapd
/.config
> /tmp
/logs
/hostapd.config
64 echo "CONFIG_CODE_COVERAGE=y" >> /tmp
/logs
/hostapd.config
68 mv hostap alt-wpa_supplicant
69 mv wpa_supplicant.config alt-wpa_supplicant
/wpa_supplicant
/.config
72 cp hostapd.config alt-hostapd
/hostapd
/.config
74 mv hostap alt-hostapd-as
75 cp hostapd.config alt-hostapd-as
/hostapd
/.config
77 mv hostap alt-hlr_auc_gw
78 mv hostapd.config alt-hlr_auc_gw
/hostapd
/.config
81 cd /tmp
/logs
/alt-wpa_supplicant
/wpa_supplicant
82 echo "Building wpa_supplicant"
85 cd /tmp
/logs
/alt-hostapd
/hostapd
86 echo "Building hostapd"
87 make -j8 hostapd
> /dev
/null
89 cd /tmp
/logs
/alt-hostapd-as
/hostapd
90 echo "Building hostapd (AS)"
91 make -j8 hostapd
> /dev
/null
93 cd /tmp
/logs
/alt-hlr_auc_gw
/hostapd
94 echo "Building hlr_auc_gw"
95 make -j8 hlr_auc_gw
> /dev
/null
99 mv /tmp
/logs
/alt-wpa_supplicant
$LOGDIR
100 mv /tmp
/logs
/alt-hostapd
$LOGDIR
101 mv /tmp
/logs
/alt-hostapd-as
$LOGDIR
102 mv /tmp
/logs
/alt-hlr_auc_gw
$LOGDIR
107 if [ "$1" == "--timewarp" ] ; then
114 echo "Starting test run in a virtual machine"
117 -kernel $KERNEL -smp 4 \
118 $KVMARGS -m $MEMORY -nographic \
119 -fsdev local,security_model
=none
,id
=fsdev-root
,path
=/$ROTAG \
120 -device virtio-9p-pci
,id
=fs-root
,fsdev
=fsdev-root
,mount_tag
=/dev
/root \
121 -fsdev local,security_model
=none
,id
=fsdev-logs
,path
="$LOGDIR",writeout
=immediate \
122 -device virtio-9p-pci
,id
=fs-logs
,fsdev
=fsdev-logs
,mount_tag
=logshare \
123 -monitor null
-serial stdio
-serial file:$LOGDIR/console \
124 -append "mac80211_hwsim.channels=$CHANNELS mac80211_hwsim.radios=6 init=$CMD testdir=$TESTDIR timewarp=$TIMEWARP console=$KVMOUT root=/dev/root rootflags=trans=virtio,version=9p2000.u ro rootfstype=9p EPATH=$EPATH ARGS=$*"
126 if [ $CODECOV = "yes" ]; then
127 mv $LOGDIR/alt-wpa_supplicant
/tmp
/logs
128 mv $LOGDIR/alt-hostapd
/tmp
/logs
129 mv $LOGDIR/alt-hostapd-as
/tmp
/logs
130 mv $LOGDIR/alt-hlr_auc_gw
/tmp
/logs
132 echo "Generating code coverage report for wpa_supplicant"
133 cd /tmp
/logs
/alt-wpa_supplicant
/wpa_supplicant
134 lcov
-c -d ..
> lcov.info
2> lcov.log
135 genhtml
-t "wpa_supplicant hwsim test run $DATE" lcov.info
--output-directory $LOGDIR/lcov-wpa_supplicant
>> lcov.log
2>&1
136 mv lcov.info lcov.log
$LOGDIR/lcov-wpa_supplicant
138 echo "Generating code coverage report for hostapd"
139 cd /tmp
/logs
/alt-hostapd
/hostapd
140 lcov
-c -d ..
> lcov.info
2> lcov.log
141 genhtml
-t "hostapd hwsim test run $DATE" lcov.info
--output-directory $LOGDIR/lcov-hostapd
>> lcov.log
2>&1
142 mv lcov.info lcov.log
$LOGDIR/lcov-hostapd
144 echo "Generating code coverage report for hostapd (AS)"
145 cd /tmp
/logs
/alt-hostapd-as
/hostapd
146 lcov
-c -d ..
> lcov.info
2> lcov.log
147 genhtml
-t "hostapd (AS) hwsim test run $DATE" lcov.info
--output-directory $LOGDIR/lcov-hostapd-as
>> lcov.log
2>&1
148 mv lcov.info lcov.log
$LOGDIR/lcov-hostapd-as
150 echo "Generating code coverage report for hlr_auc_gw"
151 cd /tmp
/logs
/alt-hlr_auc_gw
/hostapd
152 lcov
-c -d ..
> lcov.info
2> lcov.log
153 genhtml
-t "hlr_auc_gw hwsim test run $DATE" lcov.info
--output-directory $LOGDIR/lcov-hlr_auc_gw
>> lcov.log
2>&1
154 mv lcov.info lcov.log
$LOGDIR/lcov-hlr_auc_gw
156 echo "Generating combined code coverage report"
157 mkdir
$LOGDIR/lcov-combined
158 for i
in wpa_supplicant hostapd hostapd-as hlr_auc_gw
; do
159 sed s
%SF
:/tmp
/logs
/alt-
[^
/]*/%SF
:/tmp
/logs
/alt-wpa_supplicant
/% < $LOGDIR/lcov-
$i/lcov.info
> $LOGDIR/lcov-combined
/$i.info
161 cd $LOGDIR/lcov-combined
162 lcov
-a wpa_supplicant.info
-a hostapd.info
-a hostapd-as.info
-a hlr_auc_gw.info
-o combined.info
> lcov.log
2>&1
163 genhtml
-t "wpa_supplicant/hostapd combined for hwsim test run $DATE" combined.info
--output-directory .
>> lcov.log
2>&1
166 rm -r /tmp
/logs
/alt-wpa_supplicant
167 rm -r /tmp
/logs
/alt-hostapd
168 rm -r /tmp
/logs
/alt-hostapd-as
169 rm -r /tmp
/logs
/alt-hlr_auc_gw
174 echo "Test run completed"
175 echo "Logfiles are at $LOGDIR"
176 if [ $CODECOV = "yes" ]; then
177 echo "Code coverage reports:"
178 echo "wpa_supplicant: file://$LOGDIR/lcov-wpa_supplicant/index.html"
179 echo "hostapd: file://$LOGDIR/lcov-hostapd/index.html"
180 echo "hostapd (AS): file://$LOGDIR/lcov-hostapd-as/index.html"
181 echo "hlr_auc_gw: file://$LOGDIR/lcov-hlr_auc_gw/index.html"
182 echo "combined: file://$LOGDIR/lcov-combined/index.html"