[PATCH 4/8] tests: Initialize hapd var for some tdls tests

Jonathan Afek jonathan at wizery.com
Thu Jun 23 10:16:32 PDT 2016


Some tdls tests reference a hapd var in the finally block
even if the test failed before assigning the value to this
var. This makes the code in the fainally block to fail on
referencing this var.
This patch assigns None to the hapd var before starting
the tests.

Signed-off-by: Jonathan Afek <jonathanx.afek at intel.com>
---
 tests/hwsim/test_ap_tdls.py | 1 +
 tests/hwsim/test_nfc_wps.py | 2 ++
 2 files changed, 3 insertions(+)

diff --git a/tests/hwsim/test_ap_tdls.py b/tests/hwsim/test_ap_tdls.py
index 138f21c..44c7b48 100644
--- a/tests/hwsim/test_ap_tdls.py
+++ b/tests/hwsim/test_ap_tdls.py
@@ -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)
diff --git a/tests/hwsim/test_nfc_wps.py b/tests/hwsim/test_nfc_wps.py
index 6cb3ecb..b65c787 100644
--- a/tests/hwsim/test_nfc_wps.py
+++ b/tests/hwsim/test_nfc_wps.py
@@ -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)
-- 
1.9.1




More information about the Hostap mailing list