]>
Commit | Line | Data |
---|---|---|
970d3b09 JB |
1 | These scripts allow you to run the hwsim tests inside a KVM virtual machine. |
2 | ||
3 | To set it up, first compile a kernel with the kernel-config file as the | |
4 | .config. You can adjust it as needed, the configuration is for a 64-bit | |
5 | x86 system and should be close to minimal. The architecture must be the | |
6 | same as your host since the host's filesystem is used. | |
7 | ||
8 | Install the required tools: at least 'kvm', if you want tracing trace-cmd, | |
9 | valgrind if you want, etc. | |
10 | ||
11 | Compile the hwsim tests as per the instructions given, you may have to | |
12 | install some extra development packages (e.g. binutils-dev for libbfd). | |
13 | ||
14 | Create a vm-config file and put the KERNELDIR option into it (see the | |
15 | vm-run.sh script). If you want valgrind, also increase the memory size. | |
16 | ||
17 | Now you can run the vm-run.sh script and it will execute the tests using | |
18 | your system's root filesystem (read-only) inside the VM. The options you | |
19 | give it are passed through to run-all.sh, see there. | |
667a158d JB |
20 | |
21 | ||
22 | -------------------------------------------------------------------------------- | |
23 | ||
3f33b3ad JM |
24 | Code Coverage Analysis for user space code |
25 | ||
26 | Code coverage for wpa_supplicant and hostapd can be generated from the | |
27 | test run with following command line: | |
28 | ||
29 | ./vm-run.sh --codecov [other arguments..] | |
30 | ||
31 | This builds a separate copies of wpa_supplicant and hostapd into a | |
32 | directory that is writable from the virtual machine to collect the gcov | |
33 | data. lcov is then used to prepare the reports at the end of the test | |
34 | run. | |
35 | ||
36 | ||
37 | Code Coverage Analysis for kernel code | |
667a158d JB |
38 | |
39 | In order to do code coverage analysis, reconfigure the kernel to include | |
40 | ||
41 | CONFIG_GCOV_KERNEL=y | |
42 | CONFIG_GCOV_PROFILE_ALL=y | |
43 | ||
44 | Note that for gcc 4.7, kernel version 3.13-rc1 or higher is required. | |
45 | ||
46 | The scripts inside the VM will automatically copy the gcov data out of the | |
47 | VM into the logs directory. To post-process this data, you'll want to use | |
48 | lcov and run | |
49 | ||
50 | cd /tmp/hwsim-test-logs/<timestamp> | |
51 | lcov -c -d gcov/ > gcov/data | |
52 | genhtml -o html/ gcov/data | |
53 | ||
54 | Then open html/index.html in your browser. | |
55 | ||
56 | Note that in this case you need to keep your build and source directories | |
57 | across the test run (otherwise, it's safe to only keep the kernel image.) |