tests: Check connectivity in the P2P group
authorJouni Malinen <j@w1.fi>
Sat, 2 Mar 2013 09:38:56 +0000 (11:38 +0200)
committerJouni Malinen <j@w1.fi>
Sat, 2 Mar 2013 09:38:56 +0000 (11:38 +0200)
Use hwsim_test to verify that the formed group has working data
connectivity.

Signed-hostap: Jouni Malinen <j@w1.fi>

tests/hwsim/p2p-group-formation.py
tests/hwsim/wpasupplicant.py

index 37f6709..ba53c94 100755 (executable)
@@ -9,12 +9,20 @@
 import os
 import sys
 import time
+import subprocess
 
 import logging
 
 from wpasupplicant import WpaSupplicant
 
 
+def test_connectivity(ifname1, ifname2):
+    cmd = ["sudo",
+           "../../mac80211_hwsim/tools/hwsim_test",
+           ifname1,
+           ifname2]
+    subprocess.check_call(cmd)
+
 def main():
     if len(sys.argv) > 1 and sys.argv[1] == '-d':
         logging.basicConfig(level=logging.DEBUG)
@@ -43,6 +51,17 @@ def main():
     dev1.p2p_go_neg_init(addr0, pin, "enter", timeout=15)
     dev0.dump_monitor()
     dev1.dump_monitor()
+    print "Group formed"
+
+    test_connectivity('wlan0', 'wlan1')
+
+    dev0.remove_group('wlan0')
+    try:
+        dev1.remove_group('wlan1')
+    except:
+        pass
+
+    print "Test passed"
 
 if __name__ == "__main__":
     main()
index eca3fae..ecc6416 100644 (file)
@@ -120,3 +120,7 @@ class WpaSupplicant:
         while self.mon.pending():
             ev = self.mon.recv()
             logger.debug(self.ifname + ": " + ev)
+
+    def remove_group(self, ifname):
+        if "OK" not in self.request("P2P_GROUP_REMOVE " + ifname):
+            raise Exception("Group could not be removed")