2017-01-28 23:49:54 +01:00
|
|
|
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
|
2022-05-23 22:55:12 +02:00
|
|
|
example here uses Ubuntu 22.04 desktop to have a list of exact steps,
|
2017-01-28 23:49:54 +01:00
|
|
|
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.
|
|
|
|
|
|
|
|
|
2022-05-23 22:55:12 +02:00
|
|
|
Install Ubuntu 22.04 as the host system for VMs
|
2017-01-28 23:49:54 +01:00
|
|
|
|
2022-05-23 22:55:12 +02:00
|
|
|
- download installation image
|
2017-01-28 23:49:54 +01:00
|
|
|
- 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
|
|
|
|
|
|
|
|
# build tools
|
2022-05-23 22:55:12 +02:00
|
|
|
sudo apt install build-essential git libpcap-dev libssl-dev libxml2-dev \
|
|
|
|
libcurl4-openssl-dev libnl-3-dev libnl-genl-3-dev libnl-route-3-dev \
|
|
|
|
libsqlite3-dev binutils-dev libiberty-dev zlib1g-dev libpcsclite-dev \
|
|
|
|
flex bison libconfig-dev
|
2017-01-28 23:49:54 +01:00
|
|
|
|
|
|
|
# tools used be the test scripts
|
2022-05-23 22:55:12 +02:00
|
|
|
sudo apt install net-tools bridge-utils ebtables iw tshark \
|
|
|
|
python3-openssl python3-pyrad python3-cryptography python3-pycryptodome
|
2017-01-28 23:49:54 +01:00
|
|
|
|
2022-05-23 22:55:12 +02:00
|
|
|
# If using kvm and VM instead of UML (though, UML is the recommended option)
|
|
|
|
# kvm for running the VM guests
|
|
|
|
sudo apt install qemu-kvm
|
|
|
|
#Enable kvm use for the user
|
2017-01-28 23:49:54 +01:00
|
|
|
sudo adduser $USER kvm
|
|
|
|
|
|
|
|
|
2022-05-23 22:55:12 +02:00
|
|
|
|
2017-01-28 23:49:54 +01:00
|
|
|
Download a snapshot of the hostap.git repository and build the programs
|
|
|
|
|
|
|
|
cd
|
|
|
|
git clone git://w1.fi/hostap.git
|
|
|
|
cd hostap/tests/hwsim
|
|
|
|
./build.sh
|
|
|
|
cd vm
|
|
|
|
cat > vm-config <<EOF
|
2022-05-23 22:55:12 +02:00
|
|
|
KERNELDIR=~/wireless-next
|
2017-01-28 23:49:54 +01:00
|
|
|
MEMORY=512
|
|
|
|
KVMARGS="-cpu host"
|
|
|
|
EOF
|
|
|
|
|
|
|
|
|
|
|
|
Build a Linux kernel for testing
|
|
|
|
|
|
|
|
cd
|
2022-05-23 22:55:12 +02:00
|
|
|
git clone git://git.kernel.org/pub/scm/linux/kernel/git/wireless/wireless-next.git
|
|
|
|
cd wireless-next
|
|
|
|
cp ~/hostap/tests/hwsim/vm/kernel-config.uml .config
|
|
|
|
make ARCH=um oldconfig
|
|
|
|
make -j8 ARCH=um
|
|
|
|
|
|
|
|
|
|
|
|
Build wmediumd for testing
|
|
|
|
|
|
|
|
cd
|
|
|
|
git clone https://github.com/bcopeland/wmediumd.git
|
|
|
|
cd wmediumd
|
|
|
|
make
|
|
|
|
sudo cp wmediumd/wmediumd /usr/local/bin
|
|
|
|
|
|
|
|
|
|
|
|
Build sigma_dut for testing
|
|
|
|
|
|
|
|
cd
|
|
|
|
git clone https://github.com/qca/sigma-dut.git
|
|
|
|
cd sigma_dut
|
|
|
|
make
|
|
|
|
cd ~/hostap/tests/hwsim
|
|
|
|
ln -s ~/sigma_dut/sigma_dut
|
|
|
|
ln -s ~/sigma_dut/dpp-ca.py
|
2017-01-28 23:49:54 +01:00
|
|
|
|
|
|
|
|
|
|
|
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)
|
|
|
|
ALL-PASSED
|
|
|
|
|
|
|
|
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
|
|
|
|
following:
|
|
|
|
|
|
|
|
cd ~/hostap/tests/hwsim/vm
|
|
|
|
./parallel-vm.py 7
|