tests: Initialize hapd variable before try-finally uses

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>
This commit is contained in:
Jonathan Afek 2016-06-23 20:16:32 +03:00 committed by Jouni Malinen
parent 643be15d41
commit f8b9e61ef0
2 changed files with 3 additions and 0 deletions

View 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)

View 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)