From 29bac7cb8926dee94b6c32ad4d80fd6f4b840fdc Mon Sep 17 00:00:00 2001 From: Jouni Malinen Date: Fri, 2 Jan 2015 18:21:25 +0200 Subject: [PATCH] tests: Make scan_hidden more robust under heavy CPU load It is possible for the Probe Response frame wait to time out when active scanning is used under heavy CPU load. Make this test case more robust by trying multiple times before declaring the scan for a hidden SSID to have failed. Signed-off-by: Jouni Malinen --- tests/hwsim/test_scan.py | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/tests/hwsim/test_scan.py b/tests/hwsim/test_scan.py index 4939903f3..4d32fd836 100644 --- a/tests/hwsim/test_scan.py +++ b/tests/hwsim/test_scan.py @@ -427,8 +427,16 @@ def test_scan_hidden(dev, apdev): if "test-scan" in dev[0].request("SCAN_RESULTS"): raise Exception("BSS unexpectedly found in scan") - check_scan(dev[0], "scan_id=%d,%d,%d freq=2412 use_id=1" % (id1, id2, id3)) - if "test-scan" not in dev[0].request("SCAN_RESULTS"): + # Allow multiple attempts to be more robust under heavy CPU load that can + # result in Probe Response frames getting sent only after the station has + # already stopped waiting for the response on the channel. + found = False + for i in range(10): + check_scan(dev[0], "scan_id=%d,%d,%d freq=2412 use_id=1" % (id1, id2, id3)) + if "test-scan" in dev[0].request("SCAN_RESULTS"): + found = True + break + if not found: raise Exception("BSS not found in scan") if "FAIL" not in dev[0].request("SCAN scan_id=1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17"):