tests: Check connectivity in the P2P group

Use hwsim_test to verify that the formed group has working data
connectivity.

Signed-hostap: Jouni Malinen <j@w1.fi>
This commit is contained in:
Jouni Malinen 2013-03-02 11:38:56 +02:00
parent 1ae73b03be
commit 3eb29b7b47
2 changed files with 23 additions and 0 deletions

View File

@ -9,12 +9,20 @@
import os import os
import sys import sys
import time import time
import subprocess
import logging import logging
from wpasupplicant import WpaSupplicant from wpasupplicant import WpaSupplicant
def test_connectivity(ifname1, ifname2):
cmd = ["sudo",
"../../mac80211_hwsim/tools/hwsim_test",
ifname1,
ifname2]
subprocess.check_call(cmd)
def main(): def main():
if len(sys.argv) > 1 and sys.argv[1] == '-d': if len(sys.argv) > 1 and sys.argv[1] == '-d':
logging.basicConfig(level=logging.DEBUG) logging.basicConfig(level=logging.DEBUG)
@ -43,6 +51,17 @@ def main():
dev1.p2p_go_neg_init(addr0, pin, "enter", timeout=15) dev1.p2p_go_neg_init(addr0, pin, "enter", timeout=15)
dev0.dump_monitor() dev0.dump_monitor()
dev1.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__": if __name__ == "__main__":
main() main()

View File

@ -120,3 +120,7 @@ class WpaSupplicant:
while self.mon.pending(): while self.mon.pending():
ev = self.mon.recv() ev = self.mon.recv()
logger.debug(self.ifname + ": " + ev) 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")