]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
tests: VM test script: Copy gcov data if present
authorJohannes Berg <johannes.berg@intel.com>
Thu, 5 Dec 2013 22:22:10 +0000 (23:22 +0100)
committerJouni Malinen <j@w1.fi>
Sun, 8 Dec 2013 01:45:12 +0000 (17:45 -0800)
If there's code coverage analysis data, copy it out of the VM
to be able to analyse it later. Also add a description to the
README file about how to use it.

Signed-hostap: Johannes Berg <johannes.berg@intel.com>

tests/hwsim/vm/README
tests/hwsim/vm/inside.sh

index 53d80974ade977cab3f3a71091a9cca34d4ea70a..ba124ef581fb76f65f7ed2bedc2509d65ac7119d 100644 (file)
@@ -17,3 +17,28 @@ vm-run.sh script). If you want valgrind, also increase the memory size.
 Now you can run the vm-run.sh script and it will execute the tests using
 your system's root filesystem (read-only) inside the VM. The options you
 give it are passed through to run-all.sh, see there.
+
+
+--------------------------------------------------------------------------------
+
+Code Coverage Analysis
+
+In order to do code coverage analysis, reconfigure the kernel to include
+
+CONFIG_GCOV_KERNEL=y
+CONFIG_GCOV_PROFILE_ALL=y
+
+Note that for gcc 4.7, kernel version 3.13-rc1 or higher is required.
+
+The scripts inside the VM will automatically copy the gcov data out of the
+VM into the logs directory. To post-process this data, you'll want to use
+lcov and run
+
+cd /tmp/hwsim-test-logs/<timestamp>
+lcov -c -d gcov/ > gcov/data
+genhtml -o html/ gcov/data
+
+Then open html/index.html in your browser.
+
+Note that in this case you need to keep your build and source directories
+across the test run (otherwise, it's safe to only keep the kernel image.)
index d14bf01b51cb97392fc2bd4f036a941dc89b054d..331702f2c9eb8df11c844f4d9a1c37b77f1fa6b5 100755 (executable)
@@ -68,6 +68,11 @@ else
 
        cd $TESTDIR
        ./run-all.sh $ARGS >/dev/ttyS0 2>&1
+       if test -d /sys/kernel/debug/gcov ; then
+               cp -ar /sys/kernel/debug/gcov /tmp/logs/
+               # these are broken as they're updated while being read ...
+               find /tmp/logs/gcov/ -wholename '*kernel/gcov/*' -print0 | xargs -0 rm
+       fi
        #bash </dev/ttyS0 >/dev/ttyS0 2>&1
 fi