From: Jouni Malinen Date: Sun, 26 Nov 2017 10:57:27 +0000 (+0200) Subject: tests: Split dfs_radar into two test cases (dfs_radar1 and dfs_radar2) X-Git-Tag: hostap_2_7~776 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=32452fd2aaa85f34cd11ece69fe5b422ebcbbc0d;p=thirdparty%2Fhostap.git tests: Split dfs_radar into two test cases (dfs_radar1 and dfs_radar2) These DFS radar detection cases were in a single test case to optimize test execution time with parallel wait for the 60 second CAC. However, this design has become difficult to support with the kernel changes that allow radar events to be shared between interfaces. To avoid need for more workarounds here just for testing purposes, split this into two test cases so that conflicting events from another interface do not cause the test case to fail. Signed-off-by: Jouni Malinen --- diff --git a/tests/hwsim/test_dfs.py b/tests/hwsim/test_dfs.py index 91c780881..bf9af8f8b 100644 --- a/tests/hwsim/test_dfs.py +++ b/tests/hwsim/test_dfs.py @@ -203,18 +203,15 @@ def test_dfs_etsi(dev, apdev, params): subprocess.call(['iw', 'reg', 'set', '00']) dev[0].flush_scan_cache() -def test_dfs_radar(dev, apdev): - """DFS CAC functionality with radar detected""" +def test_dfs_radar1(dev, apdev): + """DFS CAC functionality with radar detected during initial CAC""" try: hapd = None - hapd2 = None hapd = start_dfs_ap(apdev[0], allow_failure=True) time.sleep(1) dfs_simulate_radar(hapd) - hapd2 = start_dfs_ap(apdev[1], ssid="dfs2", ht40=True) - ev = wait_dfs_event(hapd, "DFS-CAC-COMPLETED", 5) if ev is None: raise Exception("Timeout on DFS aborted event") @@ -258,30 +255,38 @@ def test_dfs_radar(dev, apdev): raise Exception("Unexpected frequency: " + freq) dev[0].connect("dfs", key_mgmt="NONE") + finally: + dev[0].request("DISCONNECT") + if hapd: + hapd.request("DISABLE") + subprocess.call(['iw', 'reg', 'set', '00']) + dev[0].flush_scan_cache() - ev = hapd2.wait_event(["AP-ENABLED"], timeout=70) +def test_dfs_radar2(dev, apdev): + """DFS CAC functionality with radar detected after initial CAC""" + try: + hapd = None + hapd = start_dfs_ap(apdev[0], ssid="dfs2", ht40=True) + + ev = hapd.wait_event(["AP-ENABLED"], timeout=70) if not ev: raise Exception("AP2 setup timed out") - dfs_simulate_radar(hapd2) + dfs_simulate_radar(hapd) - ev = wait_dfs_event(hapd2, "DFS-RADAR-DETECTED", 5) + ev = wait_dfs_event(hapd, "DFS-RADAR-DETECTED", 5) if "freq=5260 ht_enabled=1 chan_offset=1 chan_width=2" not in ev: raise Exception("Unexpected DFS radar detection freq from AP2") - ev = wait_dfs_event(hapd2, "DFS-NEW-CHANNEL", 5) + ev = wait_dfs_event(hapd, "DFS-NEW-CHANNEL", 5) if "freq=5260" in ev: raise Exception("Unexpected DFS new freq for AP2") - wait_dfs_event(hapd2, None, 5) + wait_dfs_event(hapd, None, 5) finally: - dev[0].request("DISCONNECT") if hapd: hapd.request("DISABLE") - if hapd2: - hapd2.request("DISABLE") subprocess.call(['iw', 'reg', 'set', '00']) - dev[0].flush_scan_cache() @remote_compatible def test_dfs_radar_on_non_dfs_channel(dev, apdev):