]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
tests: Clear p2p_go_intent explicitly in test cases where it is used
authorJouni Malinen <jouni@qca.qualcomm.com>
Mon, 28 Dec 2015 15:40:25 +0000 (17:40 +0200)
committerJouni Malinen <j@w1.fi>
Mon, 28 Dec 2015 15:40:25 +0000 (17:40 +0200)
This parameter is used only in couple of test cases and there is no need
to maintain the code to reset it in WpaSupplicant::reset().

Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
tests/hwsim/test_nfc_p2p.py
tests/hwsim/wpasupplicant.py

index 7b5ddae3d6cfa2eb4ed245ea83bbe3348fc6c2e3..e069e40c85c44a2317be954113f2f9000d8e52ac 100644 (file)
@@ -41,6 +41,12 @@ def check_ip_addr(res):
 
 def test_nfc_p2p_go_neg(dev):
     """NFC connection handover to form a new P2P group (initiator becomes GO)"""
+    try:
+        _test_nfc_p2p_go_neg(dev)
+    finally:
+        dev[0].global_request("SET p2p_go_intent 7")
+
+def _test_nfc_p2p_go_neg(dev):
     set_ip_addr_info(dev[0])
     ip = dev[0].request("GET ip_addr_go")
     if ip != "192.168.42.1":
@@ -86,6 +92,12 @@ def test_nfc_p2p_go_neg(dev):
 
 def test_nfc_p2p_go_neg_ip_pool_oom(dev):
     """NFC connection handover to form a new P2P group and IP pool OOM"""
+    try:
+        _test_nfc_p2p_go_neg_ip_pool_oom(dev)
+    finally:
+        dev[0].global_request("SET p2p_go_intent 7")
+
+def _test_nfc_p2p_go_neg_ip_pool_oom(dev):
     set_ip_addr_info(dev[0])
     ip = dev[0].request("GET ip_addr_go")
     if ip != "192.168.42.1":
@@ -132,6 +144,12 @@ def test_nfc_p2p_go_neg_ip_pool_oom(dev):
 
 def test_nfc_p2p_go_neg_reverse(dev):
     """NFC connection handover to form a new P2P group (responder becomes GO)"""
+    try:
+        _test_nfc_p2p_go_neg_reverse(dev)
+    finally:
+        dev[0].global_request("SET p2p_go_intent 7")
+
+def _test_nfc_p2p_go_neg_reverse(dev):
     set_ip_addr_info(dev[1])
     dev[0].global_request("SET p2p_go_intent 3")
     logger.info("Perform NFC connection handover")
@@ -311,7 +329,12 @@ def test_nfc_p2p_client(dev):
 
 def test_nfc_p2p_static_handover_tagdev_client(dev):
     """NFC static handover to form a new P2P group (NFC Tag device becomes P2P Client)"""
+    try:
+        _test_nfc_p2p_static_handover_tagdev_client(dev)
+    finally:
+        dev[0].global_request("SET p2p_go_intent 7")
 
+def _test_nfc_p2p_static_handover_tagdev_client(dev):
     set_ip_addr_info(dev[0])
 
     logger.info("Perform NFC connection handover")
@@ -358,7 +381,12 @@ def test_nfc_p2p_static_handover_tagdev_client(dev):
 
 def test_nfc_p2p_static_handover_tagdev_client_group_iface(dev):
     """NFC static handover to form a new P2P group (NFC Tag device becomes P2P Client with group iface)"""
+    try:
+        _test_nfc_p2p_static_handover_tagdev_client_group_iface(dev)
+    finally:
+        dev[0].global_request("SET p2p_go_intent 7")
 
+def _test_nfc_p2p_static_handover_tagdev_client_group_iface(dev):
     set_ip_addr_info(dev[0])
 
     logger.info("Perform NFC connection handover")
@@ -406,7 +434,12 @@ def test_nfc_p2p_static_handover_tagdev_client_group_iface(dev):
 
 def test_nfc_p2p_static_handover_tagdev_go(dev):
     """NFC static handover to form a new P2P group (NFC Tag device becomes GO)"""
+    try:
+        _test_nfc_p2p_static_handover_tagdev_go(dev)
+    finally:
+        dev[0].global_request("SET p2p_go_intent 7")
 
+def _test_nfc_p2p_static_handover_tagdev_go(dev):
     set_ip_addr_info(dev[1])
 
     logger.info("Perform NFC connection handover")
@@ -453,7 +486,12 @@ def test_nfc_p2p_static_handover_tagdev_go(dev):
 
 def test_nfc_p2p_static_handover_tagdev_go_forced_freq(dev):
     """NFC static handover to form a new P2P group on forced channel (NFC Tag device becomes GO)"""
+    try:
+        _test_nfc_p2p_static_handover_tagdev_go_forced_freq(dev)
+    finally:
+        dev[0].global_request("SET p2p_go_intent 7")
 
+def _test_nfc_p2p_static_handover_tagdev_go_forced_freq(dev):
     set_ip_addr_info(dev[1])
 
     logger.info("Perform NFC connection handover")
@@ -643,6 +681,12 @@ def test_nfc_p2p_go_legacy_handover(dev):
 
 def test_nfc_p2p_ip_addr_assignment(dev):
     """NFC connection handover and legacy station IP address assignment"""
+    try:
+        _test_nfc_p2p_ip_addr_assignment(dev)
+    finally:
+        dev[0].global_request("SET p2p_go_intent 7")
+
+def _test_nfc_p2p_ip_addr_assignment(dev):
     set_ip_addr_info(dev[1])
     dev[0].global_request("SET p2p_go_intent 3")
     logger.info("Perform NFC connection handover")
@@ -698,6 +742,12 @@ def test_nfc_p2p_ip_addr_assignment(dev):
 
 def test_nfc_p2p_ip_addr_assignment2(dev):
     """NFC connection handover and IP address assignment for two clients"""
+    try:
+        _test_nfc_p2p_ip_addr_assignment2(dev)
+    finally:
+        dev[0].global_request("SET p2p_go_intent 7")
+
+def _test_nfc_p2p_ip_addr_assignment2(dev):
     set_ip_addr_info(dev[1])
     dev[0].global_request("SET p2p_go_intent 3")
     logger.info("Perform NFC connection handover")
index 3da8a5ceb2a8134e09740b8f4f6c3f3e45d149e0..e5c33206cdb29e43c7e6c54dcb1d65f51665e9c9 100644 (file)
@@ -124,7 +124,6 @@ class WpaSupplicant:
         self.global_request("REMOVE_NETWORK all")
         self.global_request("SET p2p_pref_chan ")
         self.global_request("SET p2p_no_group_iface 1")
-        self.global_request("SET p2p_go_intent 7")
         self.global_request("P2P_FLUSH")
         self.request("SET ignore_old_scan_res 0")
         if self.gctrl_mon: