path: root/tests
diff options
authorJouni Malinen <j@w1.fi>2017-01-28 22:49:54 (GMT)
committerJouni Malinen <j@w1.fi>2017-01-29 12:32:17 (GMT)
commit371920b941d1d8c1492920a3457f43b77e947a12 (patch)
treea6a2e0a552ef6f55e4e02551bb95d4752b93d98d /tests
parent0d46095ec87bc6884efde620e03fdc92c98e492f (diff)
tests: Step-by-step guide for testing in VM
This describes example steps on how to get the VM testing setup with parallel VMs configured with Ubuntu Server 16.04.1. Signed-off-by: Jouni Malinen <j@w1.fi>
Diffstat (limited to 'tests')
1 files changed, 95 insertions, 0 deletions
diff --git a/tests/hwsim/vm/example-vm-setup.txt b/tests/hwsim/vm/example-vm-setup.txt
new file mode 100644
index 0000000..81e2dfd
--- /dev/null
+++ b/tests/hwsim/vm/example-vm-setup.txt
@@ -0,0 +1,95 @@
+Step-by-step guide for setting up hostapd/wpa_supplicant test framework (VM)
+This document can be used as a quick guide for getting started with
+hostapd/wpa_supplicant test framework with mac80211_hwsim. While the
+example here uses Ubuntu 16.04.1 server to have a list of exact steps,
+there are no requirements for using that specific distribution in the
+testing setup.
+The steps here describe how to run a guest VM for testing on a Linux
+host system.
+Install Ubuntu Server 16.04.1 as the host system for VMs
+- download installation image, e.g.,
+ http://releases.ubuntu.com/16.04.1/ubuntu-16.04.1-server-amd64.iso
+- install the host system with default settings
+- boot to the installed system
+- update the installed packages:
+ sudo apt update
+ sudo apt upgrade
+Install the prerequisite packages that may not have been installed by default
+# kvm for running the VM guests
+sudo apt install qemu-kvm
+# build tools
+sudo apt install build-essential git libpcap-dev libsqlite3-dev binutils-dev \
+ bc pkg-config libssl-dev libiberty-dev libdbus-1-dev \
+ libnl-3-dev libnl-genl-3-dev libnl-route-3-dev
+# tools used be the test scripts
+sudo apt install python-minimal python-crypto python-pyrad python-netifaces \
+ python-dbus python-gobject python-openssl bridge-utils ebtables tshark
+Enable kvm use for the user
+sudo adduser $USER kvm
+Download a snapshot of the hostap.git repository and build the programs
+git clone git://w1.fi/hostap.git
+cd hostap/tests/hwsim
+cd vm
+cat > vm-config <<EOF
+KVMARGS="-cpu host"
+Build a Linux kernel for testing
+git clone git://git.kernel.org/pub/scm/linux/kernel/git/wireless/wireless-testing.git
+cd wireless-testing
+cp ~/hostap/tests/hwsim/vm/kernel-config .config
+make oldconfig
+make -j8
+Setup is now ready for testing. You can run a quick test to confirm that
+things work as expected:
+cd ~/hostap/tests/hwsim/vm
+./vm-run ap_open
+This should print out following style results:
+Starting test run in a virtual machine
+./run-all.sh: passing the following args to run-tests.py: ap_open
+START ap_open 1/1
+PASS ap_open 0.924019 2017-01-28 20:20:12.137717
+passed all 1 test case(s)
+Test run completed
+Logfiles are at /tmp/hwsim-test-logs/1485634801
+(If that "PASS ap_open" line does not show up, something unexpected has
+happened and the setup is not in working condition.)
+To run all available test cases in 7 parallel VMs, you can run
+cd ~/hostap/tests/hwsim/vm
+./parallel-vm.py 7