tests: Work around iw scan getting stuck
authorJohannes Berg <johannes.berg@intel.com>
Fri, 17 Jul 2015 20:24:58 +0000 (22:24 +0200)
committerJouni Malinen <j@w1.fi>
Sun, 2 Aug 2015 18:37:10 +0000 (21:37 +0300)
On recent kernels, it seems that something changed (scheduler?)
that makes hwsim send the scan done event so quickly that iw isn't
scheduled back in to listen for it, causing iw to get stuck.

Work around this by using the scan trigger command (it'll be quick
enough so that we don't really need to wait) and the scan trigger
and dump commands where the results are required (and use a small
sleep there instead of waiting for the scan results.)

I'll try to fix this separately in iw later.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
tests/hwsim/test_ap_ht.py

index e6895c5..8a8aa9f 100644 (file)
@@ -17,7 +17,7 @@ from test_ap_csa import csa_supported
 
 def clear_scan_cache(ifname):
     subprocess.call(['ifconfig', ifname, 'up'])
-    subprocess.call(['iw', ifname, 'scan', 'freq', '2412', 'flush'])
+    subprocess.call(['iw', ifname, 'scan', 'trigger', 'freq', '2412', 'flush'])
     time.sleep(0.1)
     subprocess.call(['ifconfig', ifname, 'down'])
 
@@ -144,7 +144,9 @@ def test_ap_ht40_scan_not_affected(dev, apdev):
     hostapd.add_ap(apdev[1]['ifname'], params)
 
     subprocess.call(['ifconfig', apdev[0]['ifname'], 'up'])
-    subprocess.call(['iw', apdev[0]['ifname'], 'scan', 'freq', '2462'],
+    subprocess.call(['iw', apdev[0]['ifname'], 'scan', 'trigger', 'freq', '2462'])
+    time.sleep(0.5)
+    subprocess.call(['iw', apdev[0]['ifname'], 'scan', 'dump'],
                     stdout=open('/dev/null', 'w'))
     time.sleep(0.1)
     subprocess.call(['ifconfig', apdev[0]['ifname'], 'down'])