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