From 3eb29b7b475f9607998caea8fb97fddd0c4fcce3 Mon Sep 17 00:00:00 2001 From: Jouni Malinen Date: Sat, 2 Mar 2013 11:38:56 +0200 Subject: [PATCH] tests: Check connectivity in the P2P group Use hwsim_test to verify that the formed group has working data connectivity. Signed-hostap: Jouni Malinen --- tests/hwsim/p2p-group-formation.py | 19 +++++++++++++++++++ tests/hwsim/wpasupplicant.py | 4 ++++ 2 files changed, 23 insertions(+) diff --git a/tests/hwsim/p2p-group-formation.py b/tests/hwsim/p2p-group-formation.py index 37f6709f4..ba53c94d6 100755 --- a/tests/hwsim/p2p-group-formation.py +++ b/tests/hwsim/p2p-group-formation.py @@ -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() diff --git a/tests/hwsim/wpasupplicant.py b/tests/hwsim/wpasupplicant.py index eca3fae60..ecc6416f5 100644 --- a/tests/hwsim/wpasupplicant.py +++ b/tests/hwsim/wpasupplicant.py @@ -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")