2013-10-30 19:23:57 -04:00
|
|
|
These scripts allow you to run the hwsim tests inside a KVM virtual machine.
|
|
|
|
|
|
|
|
To set it up, first compile a kernel with the kernel-config file as the
|
|
|
|
.config. You can adjust it as needed, the configuration is for a 64-bit
|
|
|
|
x86 system and should be close to minimal. The architecture must be the
|
|
|
|
same as your host since the host's filesystem is used.
|
|
|
|
|
|
|
|
Install the required tools: at least 'kvm', if you want tracing trace-cmd,
|
|
|
|
valgrind if you want, etc.
|
|
|
|
|
|
|
|
Compile the hwsim tests as per the instructions given, you may have to
|
|
|
|
install some extra development packages (e.g. binutils-dev for libbfd).
|
|
|
|
|
|
|
|
Create a vm-config file and put the KERNELDIR option into it (see the
|
|
|
|
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.
|
2013-12-05 17:22:10 -05:00
|
|
|
|
|
|
|
|
|
|
|
--------------------------------------------------------------------------------
|
|
|
|
|
|
|
|
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.)
|