• Home
  • History
  • Annotate
Name Date Size #Lines LOC

..03-May-2022-

auth_serv/H03-May-2022-6,3215,936

tnc/H26-Nov-2021-562394

vm/H03-May-2022-1,6601,437

.gitignoreH A D26-Nov-202110 21

READMEH A D26-Nov-20218.7 KiB221171

build.shH A D26-Nov-20211.7 KiB8468

check_kernel.pyH A D26-Nov-2021897 3219

devdetail.xmlH A D26-Nov-20211.2 KiB4847

devinfo.xmlH A D26-Nov-2021190 87

dictionary.radiusH A D26-Nov-2021744 2120

example-hostapd.configH A D26-Nov-20212.5 KiB117103

example-wpa_supplicant.configH A D26-Nov-20212.9 KiB161124

fst_module_aux.pyH A D26-Nov-202132.4 KiB833710

fst_test_common.pyH A D26-Nov-20212.7 KiB9368

hostapd.pyH A D26-Nov-202128.5 KiB883786

hostapd.vlanH A D26-Nov-202125 32

hostapd.vlan2H A D26-Nov-202147 43

hostapd.wlan3.vlanH A D26-Nov-202120 32

hostapd.wlan4.vlanH A D26-Nov-202120 32

hostapd.wpa_pskH A D26-Nov-2021236 65

hwsim.pyH A D26-Nov-20214.5 KiB11587

hwsim_utils.pyH A D26-Nov-20219.5 KiB247214

multi-bss-acs.confH A D26-Nov-2021404 2923

multi-bss-iface-per_sta_vif.confH A D26-Nov-2021701 4337

multi-bss-iface.confH A D26-Nov-2021673 4135

multi-bss.confH A D26-Nov-2021271 2215

netlink.pyH A D26-Nov-20216.8 KiB238192

nl80211.pyH A D26-Nov-20218.8 KiB358342

owe-bss-1.confH A D26-Nov-2021179 139

owe-bss-2.confH A D26-Nov-2021243 1713

p2p0.confH A D26-Nov-202197 43

p2p1.confH A D26-Nov-202197 43

p2p2.confH A D26-Nov-202197 43

p2p_utils.pyH A D26-Nov-202114.9 KiB395362

pps-mo-1.xmlH A D26-Nov-20212.1 KiB6362

radius_das.pyH A D26-Nov-20211.7 KiB4833

remotehost.pyH A D26-Nov-20217.6 KiB259210

rfkill.pyH A D26-Nov-20213.6 KiB153120

run-all.shH A D26-Nov-20213.1 KiB163140

run-tests.pyH A D26-Nov-202126.7 KiB693616

start.shH A D26-Nov-20215.9 KiB214184

stop.shH A D26-Nov-20212 KiB8168

test_ap_acs.pyH A D26-Nov-202124.9 KiB689576

test_ap_ciphers.pyH A D26-Nov-202145.5 KiB1,2011,012

test_ap_config.pyH A D26-Nov-202124.7 KiB582514

test_ap_csa.pyH A D26-Nov-20216.4 KiB190144

test_ap_dynamic.pyH A D26-Nov-202121.9 KiB587513

test_ap_eap.pyH A D26-Nov-2021332.2 KiB7,5176,686

test_ap_ft.pyH A D26-Nov-2021136.4 KiB3,4622,851

test_ap_hs20.pyH A D26-Nov-2021262.4 KiB6,4975,595

test_ap_ht.pyH A D26-Nov-202160.1 KiB1,6451,415

test_ap_mixed.pyH A D26-Nov-20214.2 KiB10284

test_ap_open.pyH A D26-Nov-202140.1 KiB1,018860

test_ap_params.pyH A D26-Nov-202137.9 KiB973888

test_ap_pmf.pyH A D26-Nov-202148.3 KiB1,2051,051

test_ap_psk.pyH A D26-Nov-2021141.3 KiB3,5742,945

test_ap_qosmap.pyH A D26-Nov-20217.5 KiB170153

test_ap_roam.pyH A D26-Nov-202115.5 KiB396331

test_ap_tdls.pyH A D26-Nov-202124.7 KiB653591

test_ap_track.pyH A D26-Nov-202115.9 KiB438365

test_ap_vht.pyH A D26-Nov-202154.6 KiB1,3391,193

test_ap_vlan.pyH A D26-Nov-202132.7 KiB808668

test_ap_wps.pyH A D26-Nov-2021418.3 KiB10,6099,229

test_authsrv.pyH A D26-Nov-202111.6 KiB263223

test_autoscan.pyH A D26-Nov-20213.2 KiB8267

test_bgscan.pyH A D26-Nov-202112 KiB316253

test_cert_check.pyH A D26-Nov-202111.9 KiB313270

test_cfg80211.pyH A D26-Nov-20216.6 KiB151111

test_connect_cmd.pyH A D26-Nov-20219.6 KiB255198

test_dbus.pyH A D26-Nov-2021248.2 KiB6,0945,203

test_dfs.pyH A D26-Nov-202128 KiB768621

test_dpp.pyH A D26-Nov-2021300.7 KiB6,9715,838

test_dscp.pyH A D26-Nov-202115.4 KiB408312

test_eap.pyH A D26-Nov-202127.5 KiB603535

test_eap_proto.pyH A D26-Nov-2021444.1 KiB10,3789,198

test_erp.pyH A D26-Nov-202131.3 KiB742662

test_ext_password.pyH A D26-Nov-20214.8 KiB11398

test_fils.pyH A D26-Nov-202195.5 KiB2,4612,082

test_fst_config.pyH A D26-Nov-202122.6 KiB553472

test_fst_module.pyH A D26-Nov-2021128.4 KiB2,8262,397

test_gas.pyH A D26-Nov-202181.9 KiB2,0541,721

test_hapd_ctrl.pyH A D26-Nov-202146.4 KiB1,078976

test_he.pyH A D26-Nov-202148.4 KiB1,2221,100

test_hostapd_oom.pyH A D26-Nov-20216.5 KiB174152

test_hs20_filter.pyH A D26-Nov-20218.1 KiB206160

test_hs20_pps_mo.pyH A D26-Nov-20211.5 KiB4432

test_ibss.pyH A D26-Nov-202122.9 KiB602478

test_ieee8021x.pyH A D26-Nov-202121 KiB532459

test_kernel.pyH A D26-Nov-20214.4 KiB12985

test_macsec.pyH A D26-Nov-202131.9 KiB891754

test_mbo.pyH A D26-Nov-202125.3 KiB614515

test_module_tests.pyH A D26-Nov-2021889 2918

test_monitor_interface.pyH A D26-Nov-20213.6 KiB9572

test_mscs.pyH A D26-Nov-20218.3 KiB232181

test_multi_ap.pyH A D26-Nov-202116.2 KiB369302

test_nfc_p2p.pyH A D26-Nov-202136.9 KiB849745

test_nfc_wps.pyH A D26-Nov-202132.8 KiB710658

test_oce.pyH A D26-Nov-20216.1 KiB186140

test_ocv.pyH A D26-Nov-202148.2 KiB1,2481,079

test_offchannel_tx.pyH A D26-Nov-20211.9 KiB5137

test_owe.pyH A D26-Nov-202136.1 KiB954814

test_p2p_autogo.pyH A D26-Nov-202136.7 KiB937802

test_p2p_channel.pyH A D26-Nov-202156.7 KiB1,3851,166

test_p2p_concurrency.pyH A D26-Nov-202111.2 KiB287238

test_p2p_device.pyH A D26-Nov-202123.8 KiB553472

test_p2p_discovery.pyH A D26-Nov-202135 KiB872750

test_p2p_ext.pyH A D26-Nov-202115.8 KiB385345

test_p2p_grpform.pyH A D26-Nov-202149.7 KiB1,1861,048

test_p2p_invitation.pyH A D26-Nov-20217.2 KiB196154

test_p2p_messages.pyH A D26-Nov-202187.3 KiB2,1441,821

test_p2p_persistent.pyH A D26-Nov-202128.6 KiB677590

test_p2p_service.pyH A D26-Nov-202126.1 KiB587501

test_p2p_set.pyH A D26-Nov-20214.7 KiB129107

test_p2p_wifi_display.pyH A D26-Nov-202119.9 KiB476392

test_p2ps.pyH A D26-Nov-202176.1 KiB1,6901,381

test_pasn.pyH A D26-Nov-202128.6 KiB855630

test_pmksa_cache.pyH A D26-Nov-202151.6 KiB1,2681,099

test_radio_work.pyH A D26-Nov-20215.3 KiB134108

test_radius.pyH A D26-Nov-202171.2 KiB1,7111,501

test_rfkill.pyH A D26-Nov-20218.1 KiB243201

test_rrm.pyH A D26-Nov-202190.1 KiB2,1481,671

test_sae.pyH A D26-Nov-2021112.9 KiB2,7832,417

test_sae_pk.pyH A D26-Nov-202117.8 KiB463387

test_scan.pyH A D26-Nov-202178.8 KiB2,0261,641

test_scs.pyH A D26-Nov-202110.5 KiB197166

test_sigma_dut.pyH A D26-Nov-2021240.5 KiB5,2654,528

test_ssid.pyH A D26-Nov-20215.1 KiB128106

test_sta_dynamic.pyH A D26-Nov-202113.3 KiB330277

test_suite_b.pyH A D26-Nov-202130.5 KiB740660

test_tnc.pyH A D26-Nov-20218.3 KiB195166

test_wep.pyH A D26-Nov-20216.7 KiB173155

test_wext.pyH A D26-Nov-20219.2 KiB255204

test_wmediumd.pyH A D26-Nov-202116.2 KiB481370

test_wnm.pyH A D26-Nov-202188.6 KiB1,9851,706

test_wpas_ap.pyH A D26-Nov-202134.4 KiB928817

test_wpas_config.pyH A D26-Nov-202124.8 KiB664566

test_wpas_ctrl.pyH A D26-Nov-202196.5 KiB2,1601,904

test_wpas_mesh.pyH A D26-Nov-202193.6 KiB2,5472,075

test_wpas_wmm_ac.pyH A D26-Nov-202115.3 KiB401297

tshark.pyH A D26-Nov-20213.9 KiB125102

utils.pyH A D26-Nov-20219.9 KiB315265

wlantest.pyH A D26-Nov-20219.6 KiB278231

wpasupplicant.pyH A D26-Nov-202159.3 KiB1,6501,483

README

1Automated hostapd/wpa_supplicant testing with mac80211_hwsim
2------------------------------------------------------------
3
4This directory contains testing infrastructure and test cases to run
5automated tests of full hostapd and wpa_supplicant functionality. This
6testing is done with the help of mac80211_hwsim which is Linux kernel
7driver that simulates IEEE 802.11 radios without requiring any
8additional hardware. This setup most of the hostapd and wpa_supplicant
9functionality (and large parts of the Linux cfg80211 and mac80211
10functionality for that matter) to be tested.
11
12mac80211_hwsim is loaded with five simulated radios to allow different
13device combinations to be tested. wlantest is used analyze raw packets
14captured through the hwsim0 monitor interface that capture all frames
15sent on all channels. wlantest is used to store the frames for
16analysis. Three wpa_supplicant processes are used to control three
17virtual radios and one hostapd process is used to dynamically control
18the other two virtual radios. wpa_supplicant/hostapd test functionality
19is used to verify that data connection (both unicast and broadcast)
20works between two netdevs.
21
22The python scripts and tools in this directory control test case
23execution. They interact wpa_supplicant and hostapd through control
24interfaces to perform the operations. In addition, wlantest_cli is used
25to verify that operations have been performed correctly and that the
26network connection works in the expected way.
27
28These test cases are run automatically against the hostap.git commits
29for regression testing and to help in keeping the hostap.git master
30branch in stable state. Results from these tests are available here:
31http://buildbot.w1.fi/hwsim/
32
33
34Building binaries for testing
35-----------------------------
36
37You will need to build (or use already built) components to be
38tested. These are available in the hostap.git repository and can be
39built for example as follows:
40
41cd ../../wpa_supplicant
42cp ../tests/hwsim/example-wpa_supplicant.config .config
43make clean
44make
45cd ../hostapd
46cp ../tests/hwsim/example-hostapd.config .config
47make clean
48make hostapd hostapd_cli hlr_auc_gw
49cd ../wlantest
50make clean
51make
52
53Alternatively, the build.sh script here can be used to run these steps
54with conditional creation of .config files only if they do not exist.
55
56The test scripts can find the binaries in the locations where they were
57built. It is also possible to install wlantest_cli somewhere on the path
58to use pre-built tools.
59
60Please note that some of the configuration parameters used to enable
61more testing coverage may require development packages that may not be
62installed by default in many distributions. For example, following
63Debian/Ubuntu packages are likely to be needed:
64- binutils-dev
65- libsqlite3-dev
66- libpcap-dev
67
68example-setup.txt provides more complete step-by-step example on how a
69test setup can be built.
70
71
72wpaspy
73------
74
75The python scripts use wpaspy.py to interact with the wpa_supplicant
76control interface, but the run-tests.py script adds the (relative)
77path into the environment so it doesn't need to be installed.
78
79
80mac80211_hwsim
81--------------
82
83mac80211_hwsim kernel module is available from the upstream Linux
84kernel. Some Linux distributions enable it by default. If that's not the
85case, you can either enable it in the kernel configuration
86(CONFIG_MAC80211_HWSIM=m) and rebuild your kernel or use Backports with
87CPTCFG_MAC80211_HWSIM=m to replace the wireless LAN components in the
88base kernel.
89
90
91sudo
92----
93
94Some parts of the testing process requires root privileges. The test
95scripts are currently using sudo to achieve this. To be able to run the
96tests, you'll probably want to enable sudo with a timeout to not expire
97password entry very quickly. For example, use this in the sudoers file:
98
99Defaults        env_reset,timestamp_timeout=180
100
101Or on a dedicated test system, you could even disable password prompting
102with this in sudoers:
103
104%sudo   ALL=NOPASSWD: ALL
105
106
107Other network interfaces
108------------------------
109
110Some of the test scripts are still using hardcoded interface names, so
111the easiest way of making things work is to avoid using other network
112devices that may use conflicting interface names. For example, unload
113any wireless LAN driver before running the tests and make sure that
114wlan0..4 gets assigned as the interface names for the mac80211_hwsim
115radios. It may also be possible to rename the interface expectations in
116run-tests.py to allow other names to be used.
117
118Please also note that some commonly enabled tools, like NetworkManager,
119may end up trying to control new network interfaces automatically. This
120can result in conflicts with the test scripts and you may need to
121disable such network services or at least mark the mac80211_hwsim wlan#
122interfaces as umanaged. As an example, this can be done in
123/etc/NetworkManager/NetworkManager.conf with following addition:
124
125[keyfile]
126unmanaged-devices=mac:02:00:00:00:00:00;mac:02:00:00:00:01:00;mac:02:00:00:00:02:00;mac:02:00:00:00:03:00;mac:02:00:00:00:04:00
127
128
129Running tests
130-------------
131
132Simplest way to run a full set of the test cases is by running
133run-all.sh in tests/hwsim directory. This will use start.sh to load the
134mac80211_hwsim module and start wpa_supplicant, hostapd, and various
135test tools. run-tests.sh is then used to run through all the defined
136test cases and stop.sh to stop the programs and unload the kernel
137module.
138
139run-all.sh can be used to run the same test cases under different
140conditions:
141
142# run normal test cases
143./run-all.sh
144
145# run normal test cases under valgrind
146./run-all.sh valgrind
147
148# run normal test cases with Linux tracing
149./run-all.sh trace
150
151# run normal test cases with multi channel support (see details below)
152./run-all.sh channels=<num of channels>
153
154run-all.sh directs debug logs into the logs subdirectory (or $LOGDIR if
155present in the environment). Log file names include the current UNIX
156timestamp and a postfix to identify the specific log:
157- *.log0 = wpa_supplicant debug log for the first radio
158- *.log1 = wpa_supplicant debug log for the second radio
159- *.log2 = wpa_supplicant debug log for the third radio
160- *.hostapd = hostapd debug log
161- hwsim0 = wlantest debug log
162- hwsim0.pcapng = capture with all frames exchanged during the tests
163- *.log = debug prints from the test scripts
164- trace.dat = Linux tracing record (if enabled)
165- hlr_auc_gw - hlr_auc_gw (EAP-SIM/AKA/AKA' authentication) log
166- auth_serv - hostapd as RADIUS authentication server log
167
168
169For manual testing, ./start.sh can be used to initialize interfaces and
170programs and run-tests.py to execute one or more test
171cases. run-tests.py output verbosity can be controlled with -d (more
172verbose debug output) and -q (less verbose output) on the command
173line. "-f <module name>" (pointing to file test_<module name>.py) can be
174used to specify that all test cases from a single file are to be
175run. Test name as the last command line argument can be specified that a
176single test case is to be run (e.g., "./run-tests.py ap_pmf_required").
177
178Notice that some tests require the driver to support concurrent
179operation on multi channels in order to run. These tests will be skipped
180in case the driver does not support multi channels. To enable support
181for multi channel, the number of supported channel is passed as an
182argument to run-all.sh or start.sh
183
184
185Adding/modifying test cases
186---------------------------
187
188All the test cases are defined in the test_*.py files. These are python
189scripts that can use the local helper classes to interact with the test
190components. While various python constructs can be used in the scripts,
191only a minimal level of python knowledge should really be needed to
192modify and add new test cases. The easiest starting point for this is
193likely to take a look at some of the example scripts. When working on a
194new test, run-tests.py with -d and the test case name on the command
195line is a convenient way of verifying functionality.
196
197run-tests.py will automatically import all test cases from the test_*.py
198files in this directory. All functions starting with the "test_" prefix
199in these files are assumed to be test cases. Each test case is named by
200the function name following the "test_" prefix.
201
202
203Results database
204----------------
205
206run-tests.py can be requested to write results from the execution of
207each test case into an sqlite database. The "-S <path to database>" and
208"-b <build id>" command line arguments can be used to do that. The
209database must have been prepared before this, e.g., with following:
210
211cat | sqlite3 /tmp/example.db <<EOF
212CREATE TABLE results (test,result,run,time,duration,build,commitid);
213CREATE INDEX results_idx ON results (test);
214CREATE INDEX results_idx2 ON results (run);
215CREATE TABLE tests (test,description);
216CREATE UNIQUE INDEX tests_idx ON tests (test);
217CREATE TABLE logs (test,run,type,contents);
218CREATE INDEX logs_idx ON logs (test);
219CREATE INDEX logs_idx2 ON logs (run);
220EOF
221