tests: Replace last remaining hwsim_test uses with DATA_TEST
External tool is not needed anymore to run the data connectivity tests since hostapd test mode now allows the possible bridge or VLAN interface to be specified. Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
This commit is contained in:
parent
527d2378ac
commit
1131a1c8d2
6 changed files with 41 additions and 64 deletions
|
@ -15,14 +15,15 @@ captured through the hwsim0 monitor interface that capture all frames
|
|||
sent on all channels. wlantest is used to store the frames for
|
||||
analysis. Three wpa_supplicant processes are used to control three
|
||||
virtual radios and one hostapd process is used to dynamically control
|
||||
the other two virtual radios. hwsim_test is used to verify that data
|
||||
connection (both unicast and broadcast) works between two netdevs.
|
||||
the other two virtual radios. wpa_supplicant/hostapd test functionality
|
||||
is used to verify that data connection (both unicast and broadcast)
|
||||
works between two netdevs.
|
||||
|
||||
The python scripts and tools in this directory control test case
|
||||
execution. They interact wpa_supplicant and hostapd through control
|
||||
interfaces to perform the operations. In addition, wlantest_cli and
|
||||
hwsim_test are used to verify that operations have been performed
|
||||
correctly and that the network connection works in the expected way.
|
||||
interfaces to perform the operations. In addition, wlantest_cli is used
|
||||
to verify that operations have been performed correctly and that the
|
||||
network connection works in the expected way.
|
||||
|
||||
These test cases are run automatically against the hostap.git commits
|
||||
for regression testing and to help in keeping the hostap.git master
|
||||
|
@ -48,15 +49,13 @@ make hostapd hlr_auc_gw
|
|||
cd ../wlantest
|
||||
make clean
|
||||
make
|
||||
cd ../mac80211_hwsim/tools
|
||||
make
|
||||
|
||||
Alternatively, the build.sh script here can be used to run these steps
|
||||
with conditional creation of .config files only if they do not exist.
|
||||
|
||||
The test scripts can find the binaries in the locations where they were
|
||||
built. It is also possible to install hwsim_test and wlantest_cli
|
||||
somewhat on the path to use pre-built tools.
|
||||
built. It is also possible to install wlantest_cli somewhere on the path
|
||||
to use pre-built tools.
|
||||
|
||||
Please note that some of the configuration parameters used to enable
|
||||
more testing coverage may require development packages that may not be
|
||||
|
|
|
@ -64,10 +64,7 @@ make -j8 hostapd hlr_auc_gw
|
|||
cd ../wlantest
|
||||
make clean
|
||||
make -j8
|
||||
cd ../mac80211_hwsim/tools
|
||||
make clean
|
||||
make -j8
|
||||
cd ../../tests/hwsim/tnc
|
||||
cd ../tests/hwsim/tnc
|
||||
make clean
|
||||
make -j8
|
||||
cd ..
|
||||
|
|
|
@ -12,37 +12,8 @@ logger = logging.getLogger()
|
|||
|
||||
from wpasupplicant import WpaSupplicant
|
||||
|
||||
def test_connectivity_run(ifname1, ifname2, dscp=None, tos=None, max_tries=1):
|
||||
if os.path.isfile("../../mac80211_hwsim/tools/hwsim_test"):
|
||||
hwsim_test = "../../mac80211_hwsim/tools/hwsim_test"
|
||||
else:
|
||||
hwsim_test = "hwsim_test"
|
||||
cmd = ["sudo",
|
||||
hwsim_test,
|
||||
ifname1,
|
||||
ifname2]
|
||||
if dscp:
|
||||
cmd.append('-D')
|
||||
cmd.append(str(dscp))
|
||||
elif tos:
|
||||
cmd.append('-t')
|
||||
cmd.append(str(tos))
|
||||
success = False
|
||||
for i in range(0, max_tries):
|
||||
try:
|
||||
s = subprocess.check_output(cmd)
|
||||
logger.debug(s)
|
||||
success = True
|
||||
break
|
||||
except subprocess.CalledProcessError, e:
|
||||
logger.info("hwsim failed: " + str(e.returncode))
|
||||
logger.info(e.output)
|
||||
if i + 1 < max_tries:
|
||||
time.sleep(1)
|
||||
if not success:
|
||||
raise Exception("hwsim_test failed")
|
||||
|
||||
def run_connectivity_test(dev1, dev2, tos, dev1group=False, dev2group=False):
|
||||
def run_connectivity_test(dev1, dev2, tos, dev1group=False, dev2group=False,
|
||||
ifname1=None, ifname2=None):
|
||||
addr1 = dev1.own_addr()
|
||||
if not dev1group and isinstance(dev1, WpaSupplicant):
|
||||
addr1 = dev1.get_driver_status_field('addr')
|
||||
|
@ -53,6 +24,8 @@ def run_connectivity_test(dev1, dev2, tos, dev1group=False, dev2group=False):
|
|||
|
||||
try:
|
||||
cmd = "DATA_TEST_CONFIG 1"
|
||||
if ifname1:
|
||||
cmd = cmd + " ifname=" + ifname1
|
||||
if dev1group:
|
||||
res = dev1.group_request(cmd)
|
||||
else:
|
||||
|
@ -60,6 +33,9 @@ def run_connectivity_test(dev1, dev2, tos, dev1group=False, dev2group=False):
|
|||
if "OK" not in res:
|
||||
raise Exception("Failed to enable data test functionality")
|
||||
|
||||
cmd = "DATA_TEST_CONFIG 1"
|
||||
if ifname2:
|
||||
cmd = cmd + " ifname=" + ifname2
|
||||
if dev2group:
|
||||
res = dev2.group_request(cmd)
|
||||
else:
|
||||
|
@ -132,7 +108,9 @@ def run_connectivity_test(dev1, dev2, tos, dev1group=False, dev2group=False):
|
|||
else:
|
||||
dev2.request("DATA_TEST_CONFIG 0")
|
||||
|
||||
def test_connectivity(dev1, dev2, dscp=None, tos=None, max_tries=1, dev1group=False, dev2group=False):
|
||||
def test_connectivity(dev1, dev2, dscp=None, tos=None, max_tries=1,
|
||||
dev1group=False, dev2group=False,
|
||||
ifname1=None, ifname2=None):
|
||||
if dscp:
|
||||
tos = dscp << 2
|
||||
if not tos:
|
||||
|
@ -142,7 +120,8 @@ def test_connectivity(dev1, dev2, dscp=None, tos=None, max_tries=1, dev1group=Fa
|
|||
last_err = None
|
||||
for i in range(0, max_tries):
|
||||
try:
|
||||
run_connectivity_test(dev1, dev2, tos, dev1group, dev2group)
|
||||
run_connectivity_test(dev1, dev2, tos, dev1group, dev2group,
|
||||
ifname1, ifname2)
|
||||
success = True
|
||||
break
|
||||
except Exception, e:
|
||||
|
@ -152,9 +131,10 @@ def test_connectivity(dev1, dev2, dscp=None, tos=None, max_tries=1, dev1group=Fa
|
|||
if not success:
|
||||
raise Exception(last_err)
|
||||
|
||||
def test_connectivity_iface(dev1, ifname, dscp=None, tos=None, max_tries=1):
|
||||
test_connectivity_run(dev1.ifname, ifname, dscp=dscp, tos=tos,
|
||||
max_tries=max_tries)
|
||||
def test_connectivity_iface(dev1, dev2, ifname, dscp=None, tos=None,
|
||||
max_tries=1):
|
||||
test_connectivity(dev1, dev2, dscp, tos, ifname2=ifname,
|
||||
max_tries=max_tries)
|
||||
|
||||
def test_connectivity_p2p(dev1, dev2, dscp=None, tos=None):
|
||||
test_connectivity(dev1, dev2, dscp, tos, dev1group=True, dev2group=True)
|
||||
|
|
|
@ -115,7 +115,7 @@ def test_ap_wds_sta(dev, apdev):
|
|||
params = hostapd.wpa2_params(ssid=ssid, passphrase=passphrase)
|
||||
params['wds_sta'] = "1"
|
||||
params['wds_bridge'] = "wds-br0"
|
||||
hostapd.add_ap(apdev[0]['ifname'], params)
|
||||
hapd = hostapd.add_ap(apdev[0]['ifname'], params)
|
||||
|
||||
try:
|
||||
subprocess.call(['sudo', 'brctl', 'addbr', 'wds-br0'])
|
||||
|
@ -123,7 +123,8 @@ def test_ap_wds_sta(dev, apdev):
|
|||
subprocess.call(['sudo', 'ip', 'link', 'set', 'dev', 'wds-br0', 'up'])
|
||||
subprocess.call(['sudo', 'iw', dev[0].ifname, 'set', '4addr', 'on'])
|
||||
dev[0].connect(ssid, psk=passphrase, scan_freq="2412")
|
||||
hwsim_utils.test_connectivity_iface(dev[0], "wds-br0", max_tries=15)
|
||||
hwsim_utils.test_connectivity_iface(dev[0], hapd, "wds-br0",
|
||||
max_tries=15)
|
||||
finally:
|
||||
subprocess.call(['sudo', 'iw', dev[0].ifname, 'set', '4addr', 'off'])
|
||||
subprocess.call(['sudo', 'ip', 'link', 'set', 'dev', 'wds-br0', 'down'])
|
||||
|
|
|
@ -298,7 +298,7 @@ def test_ap_wpa2_tdls_bssid_mismatch(dev, apdev):
|
|||
passphrase = "12345678"
|
||||
params = hostapd.wpa2_params(ssid=ssid, passphrase=passphrase)
|
||||
params['bridge'] = 'ap-br0'
|
||||
hostapd.add_ap(apdev[0]['ifname'], params)
|
||||
hapd = hostapd.add_ap(apdev[0]['ifname'], params)
|
||||
hostapd.add_ap(apdev[1]['ifname'], params)
|
||||
wlantest_setup()
|
||||
subprocess.call(['sudo', 'brctl', 'setfd', 'ap-br0', '0'])
|
||||
|
@ -308,8 +308,8 @@ def test_ap_wpa2_tdls_bssid_mismatch(dev, apdev):
|
|||
dev[1].connect(ssid, psk=passphrase, scan_freq="2412",
|
||||
bssid=apdev[1]['bssid'])
|
||||
hwsim_utils.test_connectivity_sta(dev[0], dev[1])
|
||||
hwsim_utils.test_connectivity_iface(dev[0], "ap-br0")
|
||||
hwsim_utils.test_connectivity_iface(dev[1], "ap-br0")
|
||||
hwsim_utils.test_connectivity_iface(dev[0], hapd, "ap-br0")
|
||||
hwsim_utils.test_connectivity_iface(dev[1], hapd, "ap-br0")
|
||||
|
||||
addr0 = dev[0].p2p_interface_addr()
|
||||
dev[1].tdls_setup(addr0)
|
||||
|
|
|
@ -24,8 +24,8 @@ def test_ap_vlan_open(dev, apdev):
|
|||
dev[0].connect("test-vlan-open", key_mgmt="NONE", scan_freq="2412")
|
||||
dev[1].connect("test-vlan-open", key_mgmt="NONE", scan_freq="2412")
|
||||
dev[2].connect("test-vlan-open", key_mgmt="NONE", scan_freq="2412")
|
||||
hwsim_utils.test_connectivity_iface(dev[0], "brvlan1")
|
||||
hwsim_utils.test_connectivity_iface(dev[1], "brvlan2")
|
||||
hwsim_utils.test_connectivity_iface(dev[0], hapd, "brvlan1")
|
||||
hwsim_utils.test_connectivity_iface(dev[1], hapd, "brvlan2")
|
||||
hwsim_utils.test_connectivity(dev[2], hapd)
|
||||
|
||||
def test_ap_vlan_file_open(dev, apdev):
|
||||
|
@ -39,8 +39,8 @@ def test_ap_vlan_file_open(dev, apdev):
|
|||
dev[0].connect("test-vlan-open", key_mgmt="NONE", scan_freq="2412")
|
||||
dev[1].connect("test-vlan-open", key_mgmt="NONE", scan_freq="2412")
|
||||
dev[2].connect("test-vlan-open", key_mgmt="NONE", scan_freq="2412")
|
||||
hwsim_utils.test_connectivity_iface(dev[0], "brvlan1")
|
||||
hwsim_utils.test_connectivity_iface(dev[1], "brvlan2")
|
||||
hwsim_utils.test_connectivity_iface(dev[0], hapd, "brvlan1")
|
||||
hwsim_utils.test_connectivity_iface(dev[1], hapd, "brvlan2")
|
||||
hwsim_utils.test_connectivity(dev[2], hapd)
|
||||
|
||||
def test_ap_vlan_wpa2(dev, apdev):
|
||||
|
@ -54,8 +54,8 @@ def test_ap_vlan_wpa2(dev, apdev):
|
|||
dev[0].connect("test-vlan", psk="12345678", scan_freq="2412")
|
||||
dev[1].connect("test-vlan", psk="12345678", scan_freq="2412")
|
||||
dev[2].connect("test-vlan", psk="12345678", scan_freq="2412")
|
||||
hwsim_utils.test_connectivity_iface(dev[0], "brvlan1")
|
||||
hwsim_utils.test_connectivity_iface(dev[1], "brvlan2")
|
||||
hwsim_utils.test_connectivity_iface(dev[0], hapd, "brvlan1")
|
||||
hwsim_utils.test_connectivity_iface(dev[1], hapd, "brvlan2")
|
||||
hwsim_utils.test_connectivity(dev[2], hapd)
|
||||
|
||||
def test_ap_vlan_wpa2_radius(dev, apdev):
|
||||
|
@ -76,8 +76,8 @@ def test_ap_vlan_wpa2_radius(dev, apdev):
|
|||
identity="pax.user@example.com",
|
||||
password_hex="0123456789abcdef0123456789abcdef",
|
||||
scan_freq="2412")
|
||||
hwsim_utils.test_connectivity_iface(dev[0], "brvlan1")
|
||||
hwsim_utils.test_connectivity_iface(dev[1], "brvlan2")
|
||||
hwsim_utils.test_connectivity_iface(dev[0], hapd, "brvlan1")
|
||||
hwsim_utils.test_connectivity_iface(dev[1], hapd, "brvlan2")
|
||||
hwsim_utils.test_connectivity(dev[2], hapd)
|
||||
|
||||
def test_ap_vlan_wpa2_radius_required(dev, apdev):
|
||||
|
@ -112,6 +112,6 @@ def test_ap_vlan_tagged(dev, apdev):
|
|||
dev[0].connect("test-vlan-open", key_mgmt="NONE", scan_freq="2412")
|
||||
dev[1].connect("test-vlan-open", key_mgmt="NONE", scan_freq="2412")
|
||||
dev[2].connect("test-vlan-open", key_mgmt="NONE", scan_freq="2412")
|
||||
hwsim_utils.test_connectivity_iface(dev[0], "brlo.1")
|
||||
hwsim_utils.test_connectivity_iface(dev[1], "brlo.2")
|
||||
hwsim_utils.test_connectivity_iface(dev[0], hapd, "brlo.1")
|
||||
hwsim_utils.test_connectivity_iface(dev[1], hapd, "brlo.2")
|
||||
hwsim_utils.test_connectivity(dev[2], hapd)
|
||||
|
|
Loading…
Reference in a new issue