example-vm-setup.txt 2.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495
  1. Step-by-step guide for setting up hostapd/wpa_supplicant test framework (VM)
  2. ----------------------------------------------------------------------------
  3. This document can be used as a quick guide for getting started with
  4. hostapd/wpa_supplicant test framework with mac80211_hwsim. While the
  5. example here uses Ubuntu 16.04.1 server to have a list of exact steps,
  6. there are no requirements for using that specific distribution in the
  7. testing setup.
  8. The steps here describe how to run a guest VM for testing on a Linux
  9. host system.
  10. Install Ubuntu Server 16.04.1 as the host system for VMs
  11. - download installation image, e.g.,
  12. http://releases.ubuntu.com/16.04.1/ubuntu-16.04.1-server-amd64.iso
  13. - install the host system with default settings
  14. - boot to the installed system
  15. - update the installed packages:
  16. sudo apt update
  17. sudo apt upgrade
  18. Install the prerequisite packages that may not have been installed by default
  19. # kvm for running the VM guests
  20. sudo apt install qemu-kvm
  21. # build tools
  22. sudo apt install build-essential git libpcap-dev libsqlite3-dev binutils-dev \
  23. bc pkg-config libssl-dev libiberty-dev libdbus-1-dev \
  24. libnl-3-dev libnl-genl-3-dev libnl-route-3-dev
  25. # tools used be the test scripts
  26. sudo apt install python-minimal python-crypto python-pyrad python-netifaces \
  27. python-dbus python-gobject python-openssl bridge-utils ebtables tshark
  28. Enable kvm use for the user
  29. sudo adduser $USER kvm
  30. Download a snapshot of the hostap.git repository and build the programs
  31. cd
  32. git clone git://w1.fi/hostap.git
  33. cd hostap/tests/hwsim
  34. ./build.sh
  35. cd vm
  36. cat > vm-config <<EOF
  37. KERNELDIR=~/wireless-testing
  38. MEMORY=512
  39. KVMARGS="-cpu host"
  40. EOF
  41. Build a Linux kernel for testing
  42. cd
  43. git clone git://git.kernel.org/pub/scm/linux/kernel/git/wireless/wireless-testing.git
  44. cd wireless-testing
  45. cp ~/hostap/tests/hwsim/vm/kernel-config .config
  46. make oldconfig
  47. make -j8
  48. Setup is now ready for testing. You can run a quick test to confirm that
  49. things work as expected:
  50. cd ~/hostap/tests/hwsim/vm
  51. ./vm-run ap_open
  52. This should print out following style results:
  53. Starting test run in a virtual machine
  54. ./run-all.sh: passing the following args to run-tests.py: ap_open
  55. START ap_open 1/1
  56. PASS ap_open 0.924019 2017-01-28 20:20:12.137717
  57. passed all 1 test case(s)
  58. ALL-PASSED
  59. Test run completed
  60. Logfiles are at /tmp/hwsim-test-logs/1485634801
  61. (If that "PASS ap_open" line does not show up, something unexpected has
  62. happened and the setup is not in working condition.)
  63. To run all available test cases in 7 parallel VMs, you can run
  64. following:
  65. cd ~/hostap/tests/hwsim/vm
  66. ./parallel-vm.py 7