From a4a15cf1f9b61d4e6de1253464daa249467be727 Mon Sep 17 00:00:00 2001 From: Jouni Malinen Date: Sat, 17 Jan 2015 13:05:34 +0200 Subject: [PATCH] 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 --- tests/hwsim/test_scan.py | 21 +++++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) diff --git a/tests/hwsim/test_scan.py b/tests/hwsim/test_scan.py index 55931081f..d5d542285 100644 --- a/tests/hwsim/test_scan.py +++ b/tests/hwsim/test_scan.py @@ -334,8 +334,11 @@ def test_scan_for_auth(dev, apdev): wait_connect=False) dev[0].dump_monitor() # Clear cfg80211 BSS table. - subprocess.call(['iw', dev[0].ifname, 'scan', 'trigger', - 'freq', '2457', 'flush']) + try: + subprocess.check_call(['iw', dev[0].ifname, 'scan', 'trigger', + '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) if ev is None: raise Exception("External flush scan timed out") @@ -362,8 +365,11 @@ def test_scan_for_auth_fail(dev, apdev): dev[0].dump_monitor() hapd.disable() # Clear cfg80211 BSS table. - subprocess.call(['iw', dev[0].ifname, 'scan', 'trigger', - 'freq', '2457', 'flush']) + try: + subprocess.check_call(['iw', dev[0].ifname, 'scan', 'trigger', + '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) if ev is None: 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) dev[0].dump_monitor() # Clear cfg80211 BSS table. - subprocess.call(['iw', dev[0].ifname, 'scan', 'trigger', - 'freq', '2457', 'flush']) + try: + subprocess.check_call(['iw', dev[0].ifname, 'scan', 'trigger', + '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) if ev is None: raise Exception("External flush scan timed out")