README 2.5 KB

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