tests: Use cmd_execute() for iw scan
The hwsim tests used to execute shell commands in the tests using the subprocess python module. Use the cmd_execute() general function for executing "iw scan .." so that this would also work on remote setups. Signed-off-by: Jonathan Afek <jonathanx.afek@intel.com>
This commit is contained in:
parent
a548c37bad
commit
2d588c6578
1 changed files with 10 additions and 13 deletions
|
@ -138,7 +138,7 @@ def test_scan_external_trigger(dev, apdev):
|
||||||
"""Avoid operations during externally triggered scan"""
|
"""Avoid operations during externally triggered scan"""
|
||||||
hostapd.add_ap(apdev[0], { "ssid": "test-scan" })
|
hostapd.add_ap(apdev[0], { "ssid": "test-scan" })
|
||||||
bssid = apdev[0]['bssid']
|
bssid = apdev[0]['bssid']
|
||||||
subprocess.call(['iw', dev[0].ifname, 'scan', 'trigger'])
|
dev[0].cmd_execute(['iw', dev[0].ifname, 'scan', 'trigger'])
|
||||||
check_scan(dev[0], "use_id=1", other_started=True)
|
check_scan(dev[0], "use_id=1", other_started=True)
|
||||||
|
|
||||||
def test_scan_bss_expiration_count(dev, apdev):
|
def test_scan_bss_expiration_count(dev, apdev):
|
||||||
|
@ -362,10 +362,9 @@ def test_scan_for_auth(dev, apdev):
|
||||||
wait_connect=False)
|
wait_connect=False)
|
||||||
dev[0].dump_monitor()
|
dev[0].dump_monitor()
|
||||||
# Clear cfg80211 BSS table.
|
# Clear cfg80211 BSS table.
|
||||||
try:
|
res, data = dev[0].cmd_execute(['iw', dev[0].ifname, 'scan', 'trigger',
|
||||||
subprocess.check_call(['iw', dev[0].ifname, 'scan', 'trigger',
|
|
||||||
'freq', '2457', 'flush'])
|
'freq', '2457', 'flush'])
|
||||||
except subprocess.CalledProcessError, e:
|
if res != 0:
|
||||||
raise HwsimSkip("iw scan trigger flush not supported")
|
raise HwsimSkip("iw scan trigger flush not supported")
|
||||||
ev = dev[0].wait_event(["CTRL-EVENT-SCAN-RESULTS"], 5)
|
ev = dev[0].wait_event(["CTRL-EVENT-SCAN-RESULTS"], 5)
|
||||||
if ev is None:
|
if ev is None:
|
||||||
|
@ -393,10 +392,9 @@ def test_scan_for_auth_fail(dev, apdev):
|
||||||
dev[0].dump_monitor()
|
dev[0].dump_monitor()
|
||||||
hapd.disable()
|
hapd.disable()
|
||||||
# Clear cfg80211 BSS table.
|
# Clear cfg80211 BSS table.
|
||||||
try:
|
res, data = dev[0].cmd_execute(['iw', dev[0].ifname, 'scan', 'trigger',
|
||||||
subprocess.check_call(['iw', dev[0].ifname, 'scan', 'trigger',
|
|
||||||
'freq', '2457', 'flush'])
|
'freq', '2457', 'flush'])
|
||||||
except subprocess.CalledProcessError, e:
|
if res != 0:
|
||||||
raise HwsimSkip("iw scan trigger flush not supported")
|
raise HwsimSkip("iw scan trigger flush not supported")
|
||||||
ev = dev[0].wait_event(["CTRL-EVENT-SCAN-RESULTS"], 5)
|
ev = dev[0].wait_event(["CTRL-EVENT-SCAN-RESULTS"], 5)
|
||||||
if ev is None:
|
if ev is None:
|
||||||
|
@ -432,10 +430,9 @@ def test_scan_for_auth_wep(dev, apdev):
|
||||||
auth_alg="SHARED", scan_freq="2412", wait_connect=False)
|
auth_alg="SHARED", scan_freq="2412", wait_connect=False)
|
||||||
dev[0].dump_monitor()
|
dev[0].dump_monitor()
|
||||||
# Clear cfg80211 BSS table.
|
# Clear cfg80211 BSS table.
|
||||||
try:
|
res, data = dev[0].cmd_execute(['iw', dev[0].ifname, 'scan', 'trigger',
|
||||||
subprocess.check_call(['iw', dev[0].ifname, 'scan', 'trigger',
|
|
||||||
'freq', '2457', 'flush'])
|
'freq', '2457', 'flush'])
|
||||||
except subprocess.CalledProcessError, e:
|
if res != 0:
|
||||||
raise HwsimSkip("iw scan trigger flush not supported")
|
raise HwsimSkip("iw scan trigger flush not supported")
|
||||||
ev = dev[0].wait_event(["CTRL-EVENT-SCAN-RESULTS"], 5)
|
ev = dev[0].wait_event(["CTRL-EVENT-SCAN-RESULTS"], 5)
|
||||||
if ev is None:
|
if ev is None:
|
||||||
|
|
Loading…
Reference in a new issue