]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
tests: Fix ACS freqlist testing
authorJouni Malinen <j@w1.fi>
Sat, 16 May 2020 21:59:00 +0000 (00:59 +0300)
committerJouni Malinen <j@w1.fi>
Sat, 16 May 2020 22:31:19 +0000 (01:31 +0300)
The freqlist parameter uses comma, not space, separated values. Add
another test case for checking freqlist values that do not use the
preferred channel numbers to make sure the frequency list is actually
used as a constraint for selecting the channel.

Signed-off-by: Jouni Malinen <j@w1.fi>
tests/hwsim/test_ap_acs.py

index 2bd979de425be72862ab3863574d46ca1cc51b71..0f547cc135a59f572f940cf88ba3d24e43ea5771 100644 (file)
@@ -90,16 +90,23 @@ def test_ap_acs_chanlist(dev, apdev):
 
 def test_ap_acs_freqlist(dev, apdev):
     """Automatic channel selection with freqlist set"""
+    run_ap_acs_freqlist(dev, apdev, [2412, 2437, 2462])
+
+def test_ap_acs_freqlist2(dev, apdev):
+    """Automatic channel selection with freqlist set"""
+    run_ap_acs_freqlist(dev, apdev, [2417, 2432, 2457])
+
+def run_ap_acs_freqlist(dev, apdev, freqlist):
     force_prev_ap_on_24g(apdev[0])
     params = hostapd.wpa2_params(ssid="test-acs", passphrase="12345678")
     params['channel'] = '0'
-    params['freqlist'] = '2412 2437 2462'
+    params['freqlist'] = ','.join([str(x) for x in freqlist])
     hapd = hostapd.add_ap(apdev[0], params, wait_enabled=False)
     wait_acs(hapd)
 
     freq = int(hapd.get_status_field("freq"))
-    if freq not in [2412, 2437, 2462]:
-        raise Exception("Unexpected frequency: " + freq)
+    if freq not in freqlist:
+        raise Exception("Unexpected frequency: %d" % freq)
 
     dev[0].connect("test-acs", psk="12345678", scan_freq=str(freq))