From f4bfa2d27f407159e15848e2b6579fbc71e46aca Mon Sep 17 00:00:00 2001 From: Jouni Malinen Date: Wed, 25 Dec 2013 17:14:31 +0200 Subject: [PATCH] tests: Allow gcov to be used when running test cases within vm Signed-hostap: Jouni Malinen --- tests/hwsim/example-wpa_supplicant.config | 4 ++++ tests/hwsim/vm/vm-run.sh | 12 +++++++++++- 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/tests/hwsim/example-wpa_supplicant.config b/tests/hwsim/example-wpa_supplicant.config index 536c56bef..34525ccf8 100644 --- a/tests/hwsim/example-wpa_supplicant.config +++ b/tests/hwsim/example-wpa_supplicant.config @@ -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 diff --git a/tests/hwsim/vm/vm-run.sh b/tests/hwsim/vm/vm-run.sh index dd245d4ff..bf6933b27 100755 --- a/tests/hwsim/vm/vm-run.sh +++ b/tests/hwsim/vm/vm-run.sh @@ -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