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