tests: Allow gcov to be used when running test cases within vm
authorJouni Malinen <j@w1.fi>
Wed, 25 Dec 2013 15:14:31 +0000 (17:14 +0200)
committerJouni Malinen <j@w1.fi>
Thu, 26 Dec 2013 11:37:06 +0000 (13:37 +0200)
Signed-hostap: Jouni Malinen <j@w1.fi>

tests/hwsim/example-wpa_supplicant.config
tests/hwsim/vm/vm-run.sh

index 536c56b..34525cc 100644 (file)
@@ -109,3 +109,7 @@ CONFIG_SAE=y
 CFLAGS += -DALL_DH_GROUPS
 
 CONFIG_WNM=y
+
+# gcov code coverage from the virtual machine
+#CONFIG_CODE_COVERAGE=y
+#CFLAGS += -fprofile-dir=/tmp/logs/gcov
index dd245d4..bf6933b 100755 (executable)
@@ -43,7 +43,7 @@ CMD=$TESTDIR/vm/inside.sh
 LOGDIR=$LOGS/$(date +%s)
 mkdir -p $LOGDIR
 
-exec kvm \
+kvm \
        -kernel $KERNEL -smp 4 \
        $KVMARGS -m $MEMORY -nographic \
        -fsdev local,security_model=none,id=fsdev-root,path=/$ROTAG \
@@ -52,3 +52,13 @@ exec kvm \
        -device virtio-9p-pci,id=fs-logs,fsdev=fsdev-logs,mount_tag=logshare \
        -monitor null -serial stdio -serial file:$LOGDIR/console \
        -append "mac80211_hwsim.channels=$CHANNELS mac80211_hwsim.radios=5 init=$CMD testdir=$TESTDIR console=$KVMOUT root=/dev/root rootflags=trans=virtio,version=9p2000.u ro rootfstype=9p EPATH=$EPATH ARGS=$*"
+
+echo LOGDIR=$LOGDIR
+
+if [ -d $LOGDIR/gcov ]; then
+    echo "Move gcov data files from vm logdir to build directories"
+    for i in $LOGDIR/gcov/*.gcda; do
+       file=`basename $i | sed "s/.gcda$//"`
+       find ../../.. -name $file.gcno | sed s/.gcno/.gcda/ | xargs mv $i
+    done
+fi