tests: Skip some scan tests if iw does not support scan flush

The external cfg80211 scan flushing operation requires a relatively
recent iw version and not all distributions include that. Avoid false
failure reports by marking these test cases skipped if the iw command
fails.

Signed-off-by: Jouni Malinen <j@w1.fi>
This commit is contained in:
Jouni Malinen 2015-01-17 13:05:34 +02:00
parent e246d7d5b3
commit a4a15cf1f9

View file

@ -334,8 +334,11 @@ 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.
subprocess.call(['iw', dev[0].ifname, 'scan', 'trigger', try:
subprocess.check_call(['iw', dev[0].ifname, 'scan', 'trigger',
'freq', '2457', 'flush']) 'freq', '2457', 'flush'])
except subprocess.CalledProcessError, e:
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:
raise Exception("External flush scan timed out") raise Exception("External flush scan timed out")
@ -362,8 +365,11 @@ 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.
subprocess.call(['iw', dev[0].ifname, 'scan', 'trigger', try:
subprocess.check_call(['iw', dev[0].ifname, 'scan', 'trigger',
'freq', '2457', 'flush']) 'freq', '2457', 'flush'])
except subprocess.CalledProcessError, e:
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:
raise Exception("External flush scan timed out") raise Exception("External flush scan timed out")
@ -398,8 +404,11 @@ 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.
subprocess.call(['iw', dev[0].ifname, 'scan', 'trigger', try:
subprocess.check_call(['iw', dev[0].ifname, 'scan', 'trigger',
'freq', '2457', 'flush']) 'freq', '2457', 'flush'])
except subprocess.CalledProcessError, e:
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:
raise Exception("External flush scan timed out") raise Exception("External flush scan timed out")