]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
tests: Initialize hapd variable before try-finally uses
authorJonathan Afek <jonathan@wizery.com>
Thu, 23 Jun 2016 17:16:32 +0000 (20:16 +0300)
committerJouni Malinen <j@w1.fi>
Mon, 27 Jun 2016 16:04:15 +0000 (19:04 +0300)
Some TDLS and WPS test cases reference the hapd variable in the finally
block even if the test failed before assigning the value to this
variable. This makes the code in the finally block to fail on
referencing this variable. Assign None to the hapd variable before
starting the tests to avoid this.

Signed-off-by: Jonathan Afek <jonathanx.afek@intel.com>
tests/hwsim/test_ap_tdls.py
tests/hwsim/test_nfc_wps.py

index 138f21cbc5fb9eb40dd5acba53a8cce174e6bbb7..44c7b48d5bc56cb094c06793e79f38bd90a522b6 100644 (file)
@@ -361,6 +361,7 @@ def test_ap_open_tdls_vht(dev, apdev):
                "vht_capab": "",
                "vht_oper_chwidth": "0",
                "vht_oper_centr_freq_seg0_idx": "0" }
+    hapd = None
     try:
         hapd = hostapd.add_ap(apdev[0], params)
         wlantest_setup(hapd)
index 6cb3ecb429766285e4d1f25c6e62c2d0d2619371..b65c7877f78745e91f563c029767ad61a8a1156c 100644 (file)
@@ -233,6 +233,7 @@ def test_nfc_wps_handover(dev, apdev):
 
 def test_nfc_wps_handover_5ghz(dev, apdev):
     """Connect to WPS AP with NFC connection handover on 5 GHz band"""
+    hapd = None
     try:
         ssid = "test-wps-nfc-handover"
         params = ap_wps_params(ssid)
@@ -265,6 +266,7 @@ def test_nfc_wps_handover_5ghz(dev, apdev):
 
 def test_nfc_wps_handover_chan14(dev, apdev):
     """Connect to WPS AP with NFC connection handover on channel 14"""
+    hapd = None
     try:
         ssid = "test-wps-nfc-handover"
         params = ap_wps_params(ssid)