• Home
  • History
  • Annotate
Name Date Size #Lines LOC

..--

regdb/11-Mar-2024-

.gitignoreD11-Mar-202410 21

READMED11-Mar-20242.9 KiB8153

bisect-run.shD11-Mar-2024909 4434

build-codecov.shD11-Mar-20241.5 KiB5847

combine-codecov.shD11-Mar-20241.6 KiB4032

dbus.confD11-Mar-20241.3 KiB3534

example-vm-setup.txtD11-Mar-20242.5 KiB9666

inside.shD11-Mar-20244.3 KiB172120

kernel-configD11-Mar-20244.4 KiB176175

kernel-config.umlD11-Mar-20243.3 KiB132131

min-seq.pyD11-Mar-20242.5 KiB8967

parallel-vm.pyD11-Mar-202423.5 KiB671614

process-codecov.shD11-Mar-20241.1 KiB3727

uevent.shD11-Mar-2024210 103

vm-run.shD11-Mar-20244.4 KiB203167

README

1These scripts allow you to run the hwsim tests inside a KVM virtual machine or
2as a UML (User Mode Linux) program.
3
4To set it up, first compile a kernel with the kernel-config[.uml] file as the
5.config. You can adjust it as needed, the configuration is for a 64-bit x86
6system and should be close to minimal. The architecture must be the same as
7your host since the host's filesystem is used.
8
9To build the regular x86_64 kernel, simply issue
10
11yes "" | make -j <n_cpus>
12
13or to build UML:
14
15yes "" | ARCH=um make -j <n_cpus>
16
17Running a UML kernel is recommended as it can optimize out any sleep()s or
18kernel timers by taking advantage of UML time travel mode, greatly increasing
19test efficiency (~3200 tests can be run in under 5 minutes using parallel-vm.py
20on a 24 core CPU).
21
22Install the required tools: at least 'kvm', if you want tracing trace-cmd,
23valgrind if you want, etc.
24
25Compile the hwsim tests as per the instructions given, you may have to
26install some extra development packages (e.g. binutils-dev for libbfd).
27
28Create a vm-config file and put the KERNELDIR option into it (see the
29vm-run.sh script). If you want valgrind, also increase the memory size.
30
31Now you can run the vm-run.sh script and it will execute the tests using
32your system's root filesystem (read-only) inside the VM. The options you
33give it are passed through to run-all.sh, see there.
34
35To speed up testing, it is possible to run multiple VMs concurrently and
36split the test cases between all the VMs. If the host system has enough
37memory and CPU resources, this can significantly speed up the full test
38cycle. For example, a 4 core system with 4 GB of RAM can easily run 8
39parallel VMs (assuming valgrind is not used with its higher memory
40requirements). This can be run with:
41
42./parallel-vm.py <number of VMs> [arguments..]
43
44
45--------------------------------------------------------------------------------
46
47Code Coverage Analysis for user space code
48
49Code coverage for wpa_supplicant and hostapd can be generated from the
50test run with following command line:
51
52./vm-run.sh --codecov [other arguments..]
53
54This builds a separate copies of wpa_supplicant and hostapd into a
55directory that is writable from the virtual machine to collect the gcov
56data. lcov is then used to prepare the reports at the end of the test
57run.
58
59
60Code Coverage Analysis for kernel code
61
62In order to do code coverage analysis, reconfigure the kernel to include
63
64CONFIG_GCOV_KERNEL=y
65CONFIG_GCOV_PROFILE_ALL=y
66
67Note that for gcc 4.7, kernel version 3.13-rc1 or higher is required.
68
69The scripts inside the VM will automatically copy the gcov data out of the
70VM into the logs directory. To post-process this data, you'll want to use
71lcov and run
72
73cd /tmp/hwsim-test-logs/<timestamp>
74lcov -b <path to kernel dir> -c -d gcov/ > gcov/data
75genhtml -o html/ gcov/data
76
77Then open html/index.html in your browser.
78
79Note that in this case you need to keep your build and source directories
80across the test run (otherwise, it's safe to only keep the kernel image.)
81