hostap/tests/hwsim/vm
Jouni Malinen 56dfb604a4 Revert "tests: vm: Output everything on console"
This reverts commit be9fe3d8af. While I
did manage to complete multiple test runs without failures, it looks
like this change increases full test run duration by about 30 seconds
when using seven VMs. The most visible reason for that seems to be in
"breaking" active scanning quite frequently with the Probe Response
frame coming out about 40 ms (or more) after the Probe Request frame
which is long enough for the station to already have left the channel.

Since this logging change is not critical, it is simplest to revert it
for now rather than make changes to huge number of test cases to allow
more scan attempts to be performed before timing out.

Signed-off-by: Jouni Malinen <j@w1.fi>
2015-12-30 21:51:52 +02:00
..
.gitignore hwsim tests: Add scripts to run in a VM 2013-10-31 11:08:16 +02:00
build-codecov.sh tests: Fix --codecov cases to find correct wpa_cli/hostapd_cli 2014-12-29 15:49:04 +02:00
combine-codecov.sh tests: Filter out extra files from codecov reports 2014-12-29 18:27:23 +02:00
dbus.conf tests: Enable wpa_supplicant D-Bus support for hwsim tests 2015-01-02 22:50:27 +02:00
inside.sh Revert "tests: vm: Output everything on console" 2015-12-30 21:51:52 +02:00
kernel-config tests: Verify correct VLAN operation in multi-BSS multi-VLAN case 2015-06-14 13:40:50 +03:00
parallel-vm.py tests: Show vm-run.sh command line for re-running failure sequences 2015-11-30 19:42:56 +02:00
parallel-vm.sh tests: Honor HWSIM_TEST_LOG_DIR variable in VM runs 2015-11-27 21:11:53 +02:00
process-codecov.sh tests: Use new scripts for vm-run.sh codecov 2014-12-21 16:41:59 +02:00
README tests: Update vm README 2014-11-01 17:08:29 +02:00
uevent.sh tests: vm: Honor EPATH in uevent.sh 2015-12-18 00:24:51 +02:00
vm-run.sh tests: Allow passing more arguments to vm-run.sh 2015-11-30 14:03:28 +02:00

These scripts allow you to run the hwsim tests inside a KVM virtual machine.

To set it up, first compile a kernel with the kernel-config file as the
.config. You can adjust it as needed, the configuration is for a 64-bit
x86 system and should be close to minimal. The architecture must be the
same as your host since the host's filesystem is used.

Install the required tools: at least 'kvm', if you want tracing trace-cmd,
valgrind if you want, etc.

Compile the hwsim tests as per the instructions given, you may have to
install some extra development packages (e.g. binutils-dev for libbfd).

Create a vm-config file and put the KERNELDIR option into it (see the
vm-run.sh script). If you want valgrind, also increase the memory size.

Now you can run the vm-run.sh script and it will execute the tests using
your system's root filesystem (read-only) inside the VM. The options you
give it are passed through to run-all.sh, see there.

To speed up testing, it is possible to run multiple VMs concurrently and
split the test cases between all the VMs. If the host system has enough
memory and CPU resources, this can significantly speed up the full test
cycle. For example, a 4 core system with 4 GB of RAM can easily run 8
parallel VMs (assuming valgrind is not used with its higher memory
requirements). This can be run with:

./parallel-vm.sh <number of VMs> [arguments..]


--------------------------------------------------------------------------------

Code Coverage Analysis for user space code

Code coverage for wpa_supplicant and hostapd can be generated from the
test run with following command line:

./vm-run.sh --codecov [other arguments..]

This builds a separate copies of wpa_supplicant and hostapd into a
directory that is writable from the virtual machine to collect the gcov
data. lcov is then used to prepare the reports at the end of the test
run.


Code Coverage Analysis for kernel code

In order to do code coverage analysis, reconfigure the kernel to include

CONFIG_GCOV_KERNEL=y
CONFIG_GCOV_PROFILE_ALL=y

Note that for gcc 4.7, kernel version 3.13-rc1 or higher is required.

The scripts inside the VM will automatically copy the gcov data out of the
VM into the logs directory. To post-process this data, you'll want to use
lcov and run

cd /tmp/hwsim-test-logs/<timestamp>
lcov -b <path to kernel dir> -c -d gcov/ > gcov/data
genhtml -o html/ gcov/data

Then open html/index.html in your browser.

Note that in this case you need to keep your build and source directories
across the test run (otherwise, it's safe to only keep the kernel image.)