[PATCH 14/14] tests: Autonomous GO random channel selection

Ilan Peer ilan.peer at intel.com
Tue Jun 10 13:50:42 EDT 2014


From: Avraham Stern <avraham.stern at intel.com>

Verify that a standalone GO selects a random channel from the social
channels in case no other preference is set.

Signed-off-by: Avraham Stern <avraham.stern at intel.com>
---
 tests/hwsim/test_p2p_channel.py |   18 ++++++++++++++++++
 1 file changed, 18 insertions(+)

diff --git a/tests/hwsim/test_p2p_channel.py b/tests/hwsim/test_p2p_channel.py
index 3694f59..fd9e592 100644
--- a/tests/hwsim/test_p2p_channel.py
+++ b/tests/hwsim/test_p2p_channel.py
@@ -434,3 +434,21 @@ def test_go_neg_peers_force_diff_freq(dev, apdev):
     except Exception, e:
 	return
     raise Exception("Unexpected group formation success")
+
+def test_autogo_random_channel(dev, apdev):
+    """P2P channel selection: GO instantiated on random channel 1, 6, 11"""
+    freqs = []
+    go_freqs = ["2412", "2437", "2462"]
+    for i in range(0, 20):
+        result = autogo(dev[0])
+        if result['freq'] not in go_freqs:
+           raise Exception("Unexpected frequency selected: " + result['freq'])
+	if result['freq'] not in freqs:
+		freqs.append(result['freq'])
+	if len(freqs) == 3:
+		break
+        dev[0].remove_group(result['ifname'])
+    if i == 20:
+       raise Exception("GO created 20 times and not all social channels were selected. "
+		       "freqs not selected: " +
+		       str(list(set(go_freqs) - set(freqs))))
-- 
1.7.10.4



More information about the HostAP mailing list