Handle NULL return from os_zalloc() in sta_track_add()
[mech_eap.git] / tests / hwsim / test_p2p_messages.py
index 5e4bfee..0def528 100644 (file)
@@ -4,6 +4,7 @@
 # This software may be distributed under the terms of the BSD license.
 # See README for more details.
 
+from remotehost import remote_compatible
 import binascii
 import struct
 import time
@@ -139,7 +140,7 @@ def start_p2p(dev, apdev):
         params['channel'] = '6'
     elif peer['listen_freq'] == "2462":
         params['channel'] = '11'
-    hapd = hostapd.add_ap(apdev[0]['ifname'], params)
+    hapd = hostapd.add_ap(apdev[0], params)
     hapd.set("ext_mgmt_frame_handling", "1")
     return addr0, bssid, hapd, int(params['channel'])
 
@@ -219,12 +220,14 @@ def parse_p2p_public_action(payload):
 
     return p2p
 
+@remote_compatible
 def test_p2p_msg_empty(dev, apdev):
     """P2P protocol test: empty P2P Public Action frame"""
     dst, src, hapd, channel = start_p2p(dev, apdev)
     msg = p2p_hdr(dst, src)
     hapd.mgmt_tx(msg)
 
+@remote_compatible
 def test_p2p_msg_long_ssid(dev, apdev):
     """P2P protocol test: Too long SSID in P2P Public Action frame"""
     dst, src, hapd, channel = start_p2p(dev, apdev)
@@ -240,10 +243,11 @@ def test_p2p_msg_long_ssid(dev, apdev):
     msg['payload'] += ie_p2p(attrs)
     msg['payload'] += ie_ssid(255 * 'A')
     hapd.mgmt_tx(msg)
-    ev = dev[0].wait_event(["P2P-DEVICE-FOUND"], timeout=5)
+    ev = dev[0].wait_global_event(["P2P-DEVICE-FOUND"], timeout=5)
     if ev is None:
         raise Exception("Timeout on device found event")
 
+@remote_compatible
 def test_p2p_msg_long_dev_name(dev, apdev):
     """P2P protocol test: Too long Device Name in P2P Public Action frame"""
     dst, src, hapd, channel = start_p2p(dev, apdev)
@@ -835,6 +839,7 @@ def test_p2p_msg_invitation_req_to_go(dev, apdev):
     if p2p['p2p_status'] != 7 and dev[1].get_mcc() <= 1:
         raise Exception("Unexpected status %d" % p2p['p2p_status'])
 
+@remote_compatible
 def test_p2p_msg_invitation_req_unknown(dev, apdev):
     """P2P protocol tests for invitation request from unknown peer"""
     dst, src, hapd, channel = start_p2p(dev, apdev)
@@ -857,6 +862,7 @@ def test_p2p_msg_invitation_req_unknown(dev, apdev):
     if hapd.mgmt_rx(timeout=1) is None:
         raise Exception("No invitation response " + str(dialog_token))
 
+@remote_compatible
 def test_p2p_msg_invitation_no_common_channels(dev, apdev):
     """P2P protocol tests for invitation request without common channels"""
     dst, src, hapd, channel = start_p2p(dev, apdev)
@@ -993,7 +999,7 @@ def test_p2p_msg_invitation_resp(dev, apdev):
     msg['payload'] += ie_p2p(attrs)
     mgmt_tx(dev[1], "MGMT_TX {} {} freq={} wait_time=200 no_cck=1 action={}".format(addr0, addr0, rx_msg['freq'], binascii.hexlify(msg['payload'])))
 
-    ev = dev[0].wait_global_event(["P2P-GROUP-STARTED"], timeout=15);
+    ev = dev[0].wait_global_event(["P2P-GROUP-STARTED"], timeout=15)
     if ev is None:
         raise Exception("Group was not started")
 
@@ -1025,11 +1031,11 @@ def test_p2p_msg_invitation_resend(dev, apdev):
     mgmt_tx(dev[1], "MGMT_TX {} {} freq={} wait_time=200 no_cck=1 action={}".format(addr0, addr0, rx_msg['freq'], binascii.hexlify(msg['payload'])))
     ev = dev[0].wait_global_event(["P2P-INVITATION-RESULT"], timeout=15)
     if ev is None:
-        raise Exception("Timeout on invitation result");
+        raise Exception("Timeout on invitation result")
     if "status=7" not in ev:
         raise Exception("Unexpected invitation result: " + ev)
 
-    logger.info("Any channel allowed, only preference provided in invitation");
+    logger.info("Any channel allowed, only preference provided in invitation")
     invite(dev[0], dev[1], extra="pref=2422")
     rx_msg = dev[1].mgmt_rx()
     if rx_msg is None:
@@ -1048,14 +1054,14 @@ def test_p2p_msg_invitation_resend(dev, apdev):
     mgmt_tx(dev[1], "MGMT_TX {} {} freq={} wait_time=200 no_cck=1 action={}".format(addr0, addr0, rx_msg['freq'], binascii.hexlify(msg['payload'])))
     ev = dev[0].wait_global_event(["P2P-INVITATION-RESULT"], timeout=15)
     if ev is None:
-        raise Exception("Timeout on invitation result");
+        raise Exception("Timeout on invitation result")
     if "status=0" not in ev:
         raise Exception("Unexpected invitation result: " + ev)
 
-    ev = dev[0].wait_global_event(["P2P-GROUP-STARTED"], timeout=15);
+    ev = dev[0].wait_global_event(["P2P-GROUP-STARTED"], timeout=15)
     if ev is None:
         raise Exception("Group was not started on dev0")
-    ev = dev[1].wait_global_event(["P2P-GROUP-STARTED"], timeout=15);
+    ev = dev[1].wait_global_event(["P2P-GROUP-STARTED"], timeout=15)
     if ev is None:
         raise Exception("Group was not started on dev1")
 
@@ -1070,7 +1076,7 @@ def test_p2p_msg_invitation_resend_duplicate(dev, apdev):
     if "FAIL" in dev[1].request("SET ext_mgmt_frame_handling 1"):
         raise Exception("Failed to enable external management frame handling")
 
-    logger.info("Any channel allowed, only preference provided in invitation");
+    logger.info("Any channel allowed, only preference provided in invitation")
     invite(dev[0], dev[1], extra="pref=2422")
     rx_msg = dev[1].mgmt_rx()
     if rx_msg is None:
@@ -1110,7 +1116,7 @@ def test_p2p_msg_invitation_resend_duplicate(dev, apdev):
 
     ev = dev[0].wait_global_event(["P2P-INVITATION-RESULT"], timeout=10)
     if ev is None:
-        raise Exception("Timeout on invitation result");
+        raise Exception("Timeout on invitation result")
     if "status=0" not in ev:
         raise Exception("Unexpected invitation result: " + ev)
     ev = dev[0].wait_global_event(["P2P-GROUP-STARTED"], timeout=10)
@@ -1119,6 +1125,7 @@ def test_p2p_msg_invitation_resend_duplicate(dev, apdev):
     dev[0].group_form_result(ev)
     dev[0].remove_group()
 
+@remote_compatible
 def test_p2p_msg_pd_req(dev, apdev):
     """P2P protocol tests for provision discovery request processing"""
     dst, src, hapd, channel = start_p2p(dev, apdev)
@@ -1289,10 +1296,10 @@ def test_p2p_msg_go_neg_both_start(dev, apdev):
     ev = dev[0].wait_global_event(["P2P-GO-NEG-SUCCESS"], timeout=10)
     if ev is None:
         raise Exception("GO Neg did not succeed")
-    ev = dev[0].wait_global_event(["P2P-GROUP-STARTED"], timeout=5);
+    ev = dev[0].wait_global_event(["P2P-GROUP-STARTED"], timeout=5)
     if ev is None:
         raise Exception("Group formation not succeed")
-    ev = dev[1].wait_global_event(["P2P-GROUP-STARTED"], timeout=5);
+    ev = dev[1].wait_global_event(["P2P-GROUP-STARTED"], timeout=5)
     if ev is None:
         raise Exception("Group formation not succeed")
 
@@ -1940,6 +1947,7 @@ def gas_hdr(dst, src, type, req=True, dialog_token=0):
                                      dialog_token)
     return msg
 
+@remote_compatible
 def test_p2p_msg_sd(dev, apdev):
     """P2P protocol tests for service discovery messages"""
     dst, src, hapd, channel = start_p2p(dev, apdev)