mirror of
https://github.com/vanhoefm/fragattacks.git
synced 2024-11-28 10:18:21 -05:00
tests: Use python3 compatible "except" statement
This patch is made by using 2to3 command. $ find . -name *.py | xargs 2to3 -f except -w -n Signed-off-by: Masashi Honma <masashi.honma@gmail.com>
This commit is contained in:
parent
0dab477335
commit
bab493b904
@ -42,7 +42,7 @@ def wpas_connect():
|
||||
if os.path.isdir(wpas_ctrl):
|
||||
try:
|
||||
ifaces = [os.path.join(wpas_ctrl, i) for i in os.listdir(wpas_ctrl)]
|
||||
except OSError, error:
|
||||
except OSError as error:
|
||||
print "Could not find hostapd: ", error
|
||||
return None
|
||||
|
||||
@ -54,7 +54,7 @@ def wpas_connect():
|
||||
try:
|
||||
wpas = wpaspy.Ctrl(ctrl)
|
||||
return wpas
|
||||
except Exception, e:
|
||||
except Exception as e:
|
||||
pass
|
||||
return None
|
||||
|
||||
@ -134,7 +134,7 @@ class HandoverServer(nfc.handover.HandoverServer):
|
||||
summary("HandoverServer - request received")
|
||||
try:
|
||||
print "Parsed handover request: " + request.pretty()
|
||||
except Exception, e:
|
||||
except Exception as e:
|
||||
print e
|
||||
print str(request).encode("hex")
|
||||
|
||||
@ -161,7 +161,7 @@ class HandoverServer(nfc.handover.HandoverServer):
|
||||
print "Handover select:"
|
||||
try:
|
||||
print sel.pretty()
|
||||
except Exception, e:
|
||||
except Exception as e:
|
||||
print e
|
||||
print str(sel).encode("hex")
|
||||
|
||||
@ -236,7 +236,7 @@ def rdwr_connected(tag):
|
||||
print "NDEF tag: " + tag.type
|
||||
try:
|
||||
print tag.ndef.message.pretty()
|
||||
except Exception, e:
|
||||
except Exception as e:
|
||||
print e
|
||||
success = wps_tag_read(tag)
|
||||
if only_one and success:
|
||||
@ -324,7 +324,7 @@ def main():
|
||||
llcp={'on-startup': llcp_startup,
|
||||
'on-connect': llcp_connected}):
|
||||
break
|
||||
except Exception, e:
|
||||
except Exception as e:
|
||||
print "clf.connect failed"
|
||||
|
||||
global srv
|
||||
|
@ -629,7 +629,7 @@ class FstAP (FstDevice):
|
||||
self.remove_all_sessions()
|
||||
try:
|
||||
self.send_iface_detach_request(self.iface)
|
||||
except Exception, e:
|
||||
except Exception as e:
|
||||
logger.info(str(e))
|
||||
self.reg_ctrl.stop()
|
||||
del self.global_instance
|
||||
|
@ -65,7 +65,7 @@ class HWSimRadio(object):
|
||||
raise Exception("Failed to create radio (err:%d)" % self._radio_id)
|
||||
try:
|
||||
iface = os.listdir('/sys/class/mac80211_hwsim/hwsim%d/net/' % self._radio_id)[0]
|
||||
except Exception,e:
|
||||
except Exception as e:
|
||||
self._controller.destroy_radio(self._radio_id)
|
||||
raise e
|
||||
return self._radio_id, iface
|
||||
|
@ -198,7 +198,7 @@ def test_connectivity(dev1, dev2, dscp=None, tos=None, max_tries=1,
|
||||
broadcast=broadcast, send_len=send_len)
|
||||
success = True
|
||||
break
|
||||
except Exception, e:
|
||||
except Exception as e:
|
||||
last_err = e
|
||||
if i + 1 < max_tries:
|
||||
time.sleep(1)
|
||||
|
@ -227,7 +227,7 @@ def go_neg_init(i_dev, r_dev, pin, i_method, i_intent, res):
|
||||
try:
|
||||
i_res = i_dev.p2p_go_neg_init(r_dev.p2p_dev_addr(), pin, i_method, timeout=20, go_intent=i_intent)
|
||||
logger.debug("i_res: " + str(i_res))
|
||||
except Exception, e:
|
||||
except Exception as e:
|
||||
i_res = None
|
||||
logger.info("go_neg_init thread caught an exception from p2p_go_neg_init: " + str(e))
|
||||
res.put(i_res)
|
||||
@ -305,7 +305,7 @@ def go_neg_init_pbc(i_dev, r_dev, i_intent, res, freq, provdisc):
|
||||
timeout=20, go_intent=i_intent, freq=freq,
|
||||
provdisc=provdisc)
|
||||
logger.debug("i_res: " + str(i_res))
|
||||
except Exception, e:
|
||||
except Exception as e:
|
||||
i_res = None
|
||||
logger.info("go_neg_init_pbc thread caught an exception from p2p_go_neg_init: " + str(e))
|
||||
res.put(i_res)
|
||||
|
@ -47,7 +47,7 @@ def reset_devs(dev, apdev):
|
||||
for d in dev:
|
||||
try:
|
||||
d.reset()
|
||||
except Exception, e:
|
||||
except Exception as e:
|
||||
logger.info("Failed to reset device " + d.ifname)
|
||||
print str(e)
|
||||
ok = False
|
||||
@ -59,7 +59,7 @@ def reset_devs(dev, apdev):
|
||||
for iface in ifaces:
|
||||
if iface.startswith("wlan"):
|
||||
wpas.interface_remove(iface)
|
||||
except Exception, e:
|
||||
except Exception as e:
|
||||
pass
|
||||
if wpas:
|
||||
wpas.close_ctrl()
|
||||
@ -74,7 +74,7 @@ def reset_devs(dev, apdev):
|
||||
hapd.remove('wlan3-2')
|
||||
for ap in apdev:
|
||||
hapd.remove(ap['ifname'])
|
||||
except Exception, e:
|
||||
except Exception as e:
|
||||
logger.info("Failed to remove hostapd interface")
|
||||
print str(e)
|
||||
ok = False
|
||||
@ -93,7 +93,7 @@ def add_log_file(conn, test, run, type, path):
|
||||
try:
|
||||
conn.execute(sql, params)
|
||||
conn.commit()
|
||||
except Exception, e:
|
||||
except Exception as e:
|
||||
print "sqlite: " + str(e)
|
||||
print "sql: %r" % (params, )
|
||||
|
||||
@ -112,7 +112,7 @@ def report(conn, prefill, build, commit, run, test, result, duration, logdir,
|
||||
conn.execute(sql, params)
|
||||
if sql_commit:
|
||||
conn.commit()
|
||||
except Exception, e:
|
||||
except Exception as e:
|
||||
print "sqlite: " + str(e)
|
||||
print "sql: %r" % (params, )
|
||||
|
||||
@ -180,7 +180,7 @@ def rename_log(logdir, basename, testname, dev):
|
||||
if dev:
|
||||
dev.relog()
|
||||
subprocess.call(['chown', '-f', getpass.getuser(), srcname])
|
||||
except Exception, e:
|
||||
except Exception as e:
|
||||
logger.info("Failed to rename log files")
|
||||
logger.info(e)
|
||||
|
||||
@ -303,7 +303,7 @@ def main():
|
||||
params = (name, t.__doc__)
|
||||
try:
|
||||
conn.execute(sql, params)
|
||||
except Exception, e:
|
||||
except Exception as e:
|
||||
print "sqlite: " + str(e)
|
||||
print "sql: %r" % (params,)
|
||||
if conn:
|
||||
@ -477,7 +477,7 @@ def main():
|
||||
if not d.global_ping():
|
||||
raise Exception("Global PING failed for {}".format(d.ifname))
|
||||
d.request("NOTE TEST-START " + name)
|
||||
except Exception, e:
|
||||
except Exception as e:
|
||||
logger.info("Failed to issue TEST-START before " + name + " for " + d.ifname)
|
||||
logger.info(e)
|
||||
print "FAIL " + name + " - could not start test"
|
||||
@ -522,15 +522,15 @@ def main():
|
||||
print "Country code remains set - expect following test cases to fail"
|
||||
logger.info("Country code remains set - expect following test cases to fail")
|
||||
break
|
||||
except HwsimSkip, e:
|
||||
except HwsimSkip as e:
|
||||
logger.info("Skip test case: %s" % e)
|
||||
result = "SKIP"
|
||||
except NameError, e:
|
||||
except NameError as e:
|
||||
import traceback
|
||||
logger.info(e)
|
||||
traceback.print_exc()
|
||||
result = "FAIL"
|
||||
except Exception, e:
|
||||
except Exception as e:
|
||||
import traceback
|
||||
logger.info(e)
|
||||
traceback.print_exc()
|
||||
@ -542,7 +542,7 @@ def main():
|
||||
try:
|
||||
d.dump_monitor()
|
||||
d.request("NOTE TEST-STOP " + name)
|
||||
except Exception, e:
|
||||
except Exception as e:
|
||||
logger.info("Failed to issue TEST-STOP after {} for {}".format(name, d.ifname))
|
||||
logger.info(e)
|
||||
result = "FAIL"
|
||||
@ -556,7 +556,7 @@ def main():
|
||||
rename_log(args.logdir, 'log5', name, wpas)
|
||||
if not args.no_reset:
|
||||
wpas.remove_ifname()
|
||||
except Exception, e:
|
||||
except Exception as e:
|
||||
pass
|
||||
if wpas:
|
||||
wpas.close_ctrl()
|
||||
@ -565,7 +565,7 @@ def main():
|
||||
rename_log(args.logdir, 'log' + str(i), name, dev[i])
|
||||
try:
|
||||
hapd = HostapdGlobal()
|
||||
except Exception, e:
|
||||
except Exception as e:
|
||||
print "Failed to connect to hostapd interface"
|
||||
print str(e)
|
||||
reset_ok = False
|
||||
|
@ -485,7 +485,7 @@ def get_rx_spec(phy, gtk=False):
|
||||
continue
|
||||
with open(keydir + "/rx_spec") as f:
|
||||
return f.read()
|
||||
except OSError, e:
|
||||
except OSError as e:
|
||||
raise HwsimSkip("debugfs not supported in mac80211")
|
||||
return None
|
||||
|
||||
@ -501,7 +501,7 @@ def get_tk_replay_counter(phy, gtk=False):
|
||||
continue
|
||||
with open(keydir + "/replays") as f:
|
||||
return int(f.read())
|
||||
except OSError, e:
|
||||
except OSError as e:
|
||||
raise HwsimSkip("debugfs not supported in mac80211")
|
||||
return None
|
||||
|
||||
|
@ -206,7 +206,7 @@ def invalid_ap(ap):
|
||||
try:
|
||||
hapd.enable()
|
||||
started = True
|
||||
except Exception, e:
|
||||
except Exception as e:
|
||||
started = False
|
||||
if started:
|
||||
raise Exception("ENABLE command succeeded unexpectedly")
|
||||
@ -516,7 +516,7 @@ def test_ap_duplicate_bssid(dev, apdev):
|
||||
try:
|
||||
hostapd.add_bss(apdev[0], ifname2, 'bss-2-dup.conf')
|
||||
raise Exception("BSS add succeeded unexpectedly")
|
||||
except Exception, e:
|
||||
except Exception as e:
|
||||
if "Could not add hostapd BSS" in str(e):
|
||||
pass
|
||||
else:
|
||||
|
@ -2881,7 +2881,7 @@ def test_ap_wpa2_eap_eke_server_oom(dev, apdev):
|
||||
if hapd.request("GET_ALLOC_FAIL").startswith('0'):
|
||||
break
|
||||
dev[0].request("REMOVE_NETWORK all")
|
||||
except Exception, e:
|
||||
except Exception as e:
|
||||
if str(e) == "Allocation failure did not trigger":
|
||||
if count < 30:
|
||||
raise Exception("Too few allocation failures")
|
||||
@ -3699,7 +3699,7 @@ def test_ap_wpa2_eap_fast_cipher_suites(dev, apdev):
|
||||
ca_cert="auth_serv/ca.pem", phase2="auth=GTC",
|
||||
pac_file="blob://fast_pac_ciphers",
|
||||
report_failure=True)
|
||||
except Exception, e:
|
||||
except Exception as e:
|
||||
if cipher == "RC4-SHA" and \
|
||||
("Could not select EAP method" in str(e) or \
|
||||
"EAP failed" in str(e)):
|
||||
|
@ -446,7 +446,7 @@ def test_ap_ft_ocv(dev, apdev):
|
||||
params["ocv"] = "1"
|
||||
try:
|
||||
hapd0 = hostapd.add_ap(apdev[0], params)
|
||||
except Exception, e:
|
||||
except Exception as e:
|
||||
if "Failed to set hostapd parameter ocv" in str(e):
|
||||
raise HwsimSkip("OCV not supported")
|
||||
raise
|
||||
@ -582,7 +582,7 @@ def test_ap_ft_over_ds_ocv(dev, apdev):
|
||||
params["ocv"] = "1"
|
||||
try:
|
||||
hapd0 = hostapd.add_ap(apdev[0], params)
|
||||
except Exception, e:
|
||||
except Exception as e:
|
||||
if "Failed to set hostapd parameter ocv" in str(e):
|
||||
raise HwsimSkip("OCV not supported")
|
||||
raise
|
||||
|
@ -4853,7 +4853,7 @@ def _test_proxyarp_open(dev, apdev, params, ebtables=False):
|
||||
|
||||
try:
|
||||
hwsim_utils.test_connectivity_iface(dev[0], hapd, "ap-br0")
|
||||
except Exception, e:
|
||||
except Exception as e:
|
||||
logger.info("test_connectibity_iface failed: " + str(e))
|
||||
raise HwsimSkip("Assume kernel did not have the required patches for proxyarp")
|
||||
hwsim_utils.test_connectivity_iface(dev[1], hapd, "ap-br0")
|
||||
@ -5110,7 +5110,7 @@ def _test_proxyarp_open_ipv6(dev, apdev, params, ebtables=False):
|
||||
|
||||
try:
|
||||
hwsim_utils.test_connectivity_iface(dev[0], hapd, "ap-br0")
|
||||
except Exception, e:
|
||||
except Exception as e:
|
||||
logger.info("test_connectibity_iface failed: " + str(e))
|
||||
raise HwsimSkip("Assume kernel did not have the required patches for proxyarp")
|
||||
hwsim_utils.test_connectivity_iface(dev[1], hapd, "ap-br0")
|
||||
|
@ -330,7 +330,7 @@ def _test_ap_open_wpas_in_bridge(dev, apdev):
|
||||
try:
|
||||
wpas.interface_add(ifname, br_ifname=br_ifname)
|
||||
raise Exception("Interface addition succeeded unexpectedly")
|
||||
except Exception, e:
|
||||
except Exception as e:
|
||||
if "Failed to add" in str(e):
|
||||
logger.info("Ignore expected interface_add failure due to missing bridge interface: " + str(e))
|
||||
else:
|
||||
|
@ -666,7 +666,7 @@ def test_ap_missing_psk(dev, apdev):
|
||||
# "WPA-PSK enabled, but PSK or passphrase is not configured."
|
||||
hostapd.add_ap(apdev[0], params)
|
||||
raise Exception("AP setup succeeded unexpectedly")
|
||||
except Exception, e:
|
||||
except Exception as e:
|
||||
if "Failed to enable hostapd" in str(e):
|
||||
pass
|
||||
else:
|
||||
|
@ -67,7 +67,7 @@ def test_ocv_sa_query(dev, apdev):
|
||||
params["ocv"] = "1"
|
||||
try:
|
||||
hapd = hostapd.add_ap(apdev[0], params)
|
||||
except Exception, e:
|
||||
except Exception as e:
|
||||
if "Failed to set hostapd parameter ocv" in str(e):
|
||||
raise HwsimSkip("OCV not supported")
|
||||
raise
|
||||
@ -104,7 +104,7 @@ def test_ocv_sa_query_csa(dev, apdev):
|
||||
params["ocv"] = "1"
|
||||
try:
|
||||
hapd = hostapd.add_ap(apdev[0], params)
|
||||
except Exception, e:
|
||||
except Exception as e:
|
||||
if "Failed to set hostapd parameter ocv" in str(e):
|
||||
raise HwsimSkip("OCV not supported")
|
||||
raise
|
||||
@ -194,7 +194,7 @@ def test_ap_pmf_negative(dev, apdev):
|
||||
scan_freq="2412")
|
||||
hwsim_utils.test_connectivity(dev[1], hapd)
|
||||
raise Exception("PMF required STA connected to no PMF AP")
|
||||
except Exception, e:
|
||||
except Exception as e:
|
||||
logger.debug("Ignore expected exception: " + str(e))
|
||||
wt.require_ap_no_pmf(apdev[0]['bssid'])
|
||||
|
||||
|
@ -428,7 +428,7 @@ def test_ap_open_tdls_vht80(dev, apdev):
|
||||
res = cmd.stdout.read()
|
||||
cmd.stdout.close()
|
||||
logger.info("Station dump on dev[%d]:\n%s" % (i, res))
|
||||
except Exception, e:
|
||||
except Exception as e:
|
||||
if isinstance(e, Exception) and str(e) == "AP startup failed":
|
||||
if not vht_supported():
|
||||
raise HwsimSkip("80/160 MHz channel not supported in regulatory information")
|
||||
@ -472,7 +472,7 @@ def test_ap_open_tdls_vht80plus80(dev, apdev):
|
||||
res = cmd.stdout.read()
|
||||
cmd.stdout.close()
|
||||
logger.info("Station dump on dev[%d]:\n%s" % (i, res))
|
||||
except Exception, e:
|
||||
except Exception as e:
|
||||
if isinstance(e, Exception) and str(e) == "AP startup failed":
|
||||
if not vht_supported():
|
||||
raise HwsimSkip("80/160 MHz channel not supported in regulatory information")
|
||||
@ -516,7 +516,7 @@ def test_ap_open_tdls_vht160(dev, apdev):
|
||||
res = cmd.stdout.read()
|
||||
cmd.stdout.close()
|
||||
logger.info("Station dump on dev[%d]:\n%s" % (i, res))
|
||||
except Exception, e:
|
||||
except Exception as e:
|
||||
if isinstance(e, Exception) and str(e) == "AP startup failed":
|
||||
if not vht_supported():
|
||||
raise HwsimSkip("80/160 MHz channel not supported in regulatory information")
|
||||
|
@ -74,7 +74,7 @@ def test_ap_vht80(dev, apdev):
|
||||
raise Exception("Missing STA flag: HT")
|
||||
if "[VHT]" not in sta['flags']:
|
||||
raise Exception("Missing STA flag: VHT")
|
||||
except Exception, e:
|
||||
except Exception as e:
|
||||
if isinstance(e, Exception) and str(e) == "AP startup failed":
|
||||
if not vht_supported():
|
||||
raise HwsimSkip("80 MHz channel not supported in regulatory information")
|
||||
@ -104,7 +104,7 @@ def vht80_test(apdev, dev, channel, ht_capab):
|
||||
|
||||
dev.connect("vht", key_mgmt="NONE", scan_freq=str(5000 + 5 * channel))
|
||||
hwsim_utils.test_connectivity(dev, hapd)
|
||||
except Exception, e:
|
||||
except Exception as e:
|
||||
if isinstance(e, Exception) and str(e) == "AP startup failed":
|
||||
if not vht_supported():
|
||||
raise HwsimSkip("80 MHz channel not supported in regulatory information")
|
||||
@ -165,7 +165,7 @@ def test_ap_vht80_params(dev, apdev):
|
||||
raise Exception("dev[0] did not support SGI")
|
||||
if capab2 & 0x60 != 0:
|
||||
raise Exception("dev[2] claimed support for SGI")
|
||||
except Exception, e:
|
||||
except Exception as e:
|
||||
if isinstance(e, Exception) and str(e) == "AP startup failed":
|
||||
if not vht_supported():
|
||||
raise HwsimSkip("80 MHz channel not supported in regulatory information")
|
||||
@ -194,7 +194,7 @@ def test_ap_vht80_invalid(dev, apdev):
|
||||
ev = hapd.wait_event(["AP-DISABLED"], timeout=5)
|
||||
if ev is None:
|
||||
raise Exception("AP-DISABLED not reported")
|
||||
except Exception, e:
|
||||
except Exception as e:
|
||||
if isinstance(e, Exception) and str(e) == "AP startup failed":
|
||||
if not vht_supported():
|
||||
raise HwsimSkip("80/160 MHz channel not supported in regulatory information")
|
||||
@ -225,7 +225,7 @@ def test_ap_vht80_invalid2(dev, apdev):
|
||||
ev = hapd.wait_event(["AP-DISABLED"], timeout=5)
|
||||
if ev is None:
|
||||
raise Exception("AP-DISABLED not reported")
|
||||
except Exception, e:
|
||||
except Exception as e:
|
||||
if isinstance(e, Exception) and str(e) == "AP startup failed":
|
||||
if not vht_supported():
|
||||
raise HwsimSkip("80/160 MHz channel not supported in regulatory information")
|
||||
@ -371,7 +371,7 @@ def test_ap_vht160(dev, apdev):
|
||||
raise Exception("Unexpected SIGNAL_POLL value(1): " + str(sig))
|
||||
if "WIDTH=160 MHz" not in sig:
|
||||
raise Exception("Unexpected SIGNAL_POLL value(2): " + str(sig))
|
||||
except Exception, e:
|
||||
except Exception as e:
|
||||
if isinstance(e, Exception) and str(e) == "AP startup failed":
|
||||
if not vht_supported():
|
||||
raise HwsimSkip("80/160 MHz channel not supported in regulatory information")
|
||||
@ -445,7 +445,7 @@ def test_ap_vht160b(dev, apdev):
|
||||
raise Exception("Unexpected SIGNAL_POLL value(1): " + str(sig))
|
||||
if "WIDTH=160 MHz" not in sig:
|
||||
raise Exception("Unexpected SIGNAL_POLL value(2): " + str(sig))
|
||||
except Exception, e:
|
||||
except Exception as e:
|
||||
if isinstance(e, Exception) and str(e) == "AP startup failed":
|
||||
if not vht_supported():
|
||||
raise HwsimSkip("80/160 MHz channel not supported in regulatory information")
|
||||
@ -525,7 +525,7 @@ def run_ap_vht160_no_dfs(dev, apdev, channel, ht_capab):
|
||||
raise Exception("Unexpected SIGNAL_POLL value(1): " + str(sig))
|
||||
if "WIDTH=160 MHz" not in sig:
|
||||
raise Exception("Unexpected SIGNAL_POLL value(2): " + str(sig))
|
||||
except Exception, e:
|
||||
except Exception as e:
|
||||
if isinstance(e, Exception) and str(e) == "AP startup failed":
|
||||
if not vht_supported():
|
||||
raise HwsimSkip("80/160 MHz channel not supported in regulatory information")
|
||||
@ -567,7 +567,7 @@ def test_ap_vht160_no_ht40(dev, apdev):
|
||||
if "AP-ENABLED" in ev:
|
||||
# This was supposed to fail due to sec_channel_offset == 0
|
||||
raise Exception("Unexpected AP-ENABLED")
|
||||
except Exception, e:
|
||||
except Exception as e:
|
||||
if isinstance(e, Exception) and str(e) == "AP startup failed":
|
||||
if not vht_supported():
|
||||
raise HwsimSkip("80/160 MHz channel not supported in regulatory information")
|
||||
@ -634,7 +634,7 @@ def test_ap_vht80plus80(dev, apdev):
|
||||
raise Exception("Unexpected SIGNAL_POLL value(3): " + str(sig))
|
||||
if "CENTER_FRQ2=5775" not in sig:
|
||||
raise Exception("Unexpected SIGNAL_POLL value(4): " + str(sig))
|
||||
except Exception, e:
|
||||
except Exception as e:
|
||||
if isinstance(e, Exception) and str(e) == "AP startup failed":
|
||||
if not vht_supported():
|
||||
raise HwsimSkip("80/160 MHz channel not supported in regulatory information")
|
||||
@ -671,7 +671,7 @@ def test_ap_vht80plus80_invalid(dev, apdev):
|
||||
ev = hapd.wait_event(["AP-DISABLED"], timeout=5)
|
||||
if ev is None:
|
||||
raise Exception("AP-DISABLED not reported")
|
||||
except Exception, e:
|
||||
except Exception as e:
|
||||
if isinstance(e, Exception) and str(e) == "AP startup failed":
|
||||
if not vht_supported():
|
||||
raise HwsimSkip("80/160 MHz channel not supported in regulatory information")
|
||||
@ -723,7 +723,7 @@ def test_ap_vht80_csa(dev, apdev):
|
||||
# extra code coverage.
|
||||
hapd.request("CHAN_SWITCH 5 5745")
|
||||
hapd.wait_event(["AP-CSA-FINISHED"], timeout=1)
|
||||
except Exception, e:
|
||||
except Exception as e:
|
||||
if isinstance(e, Exception) and str(e) == "AP startup failed":
|
||||
if not vht_supported():
|
||||
raise HwsimSkip("80 MHz channel not supported in regulatory information")
|
||||
@ -969,7 +969,7 @@ def test_ap_vht80_pwr_constraint(dev, apdev):
|
||||
|
||||
dev[0].connect("vht", key_mgmt="NONE", scan_freq="5180")
|
||||
dev[0].wait_regdom(country_ie=True)
|
||||
except Exception, e:
|
||||
except Exception as e:
|
||||
if isinstance(e, Exception) and str(e) == "AP startup failed":
|
||||
if not vht_supported():
|
||||
raise HwsimSkip("80 MHz channel not supported in regulatory information")
|
||||
@ -1003,7 +1003,7 @@ def test_ap_vht_use_sta_nsts(dev, apdev):
|
||||
|
||||
dev[0].connect("vht", key_mgmt="NONE", scan_freq="5180")
|
||||
hwsim_utils.test_connectivity(dev[0], hapd)
|
||||
except Exception, e:
|
||||
except Exception as e:
|
||||
if isinstance(e, Exception) and str(e) == "AP startup failed":
|
||||
if not vht_supported():
|
||||
raise HwsimSkip("80 MHz channel not supported in regulatory information")
|
||||
@ -1050,7 +1050,7 @@ def test_ap_vht_tkip(dev, apdev):
|
||||
raise Exception("Unexpected STATUS ieee80211ac value")
|
||||
if status["secondary_channel"] != "0":
|
||||
raise Exception("Unexpected STATUS secondary_channel value")
|
||||
except Exception, e:
|
||||
except Exception as e:
|
||||
if isinstance(e, Exception) and str(e) == "AP startup failed":
|
||||
if not vht_supported():
|
||||
raise HwsimSkip("80 MHz channel not supported in regulatory information")
|
||||
@ -1122,7 +1122,7 @@ def test_ap_vht80_to_24g_ht(dev, apdev):
|
||||
hapd.enable()
|
||||
|
||||
dev[0].connect("vht", key_mgmt="NONE", scan_freq="2412")
|
||||
except Exception, e:
|
||||
except Exception as e:
|
||||
if isinstance(e, Exception) and str(e) == "AP startup failed":
|
||||
if not vht_supported():
|
||||
raise HwsimSkip("80 MHz channel not supported in regulatory information")
|
||||
|
@ -294,7 +294,7 @@ def generic_ap_vlan_wpa2_radius_id_change(dev, apdev, tagged):
|
||||
ifname2="brvlan1")
|
||||
else:
|
||||
hwsim_utils.test_connectivity_iface(dev[0], hapd, "brvlan1")
|
||||
except Exception, e:
|
||||
except Exception as e:
|
||||
# It is possible for new bridge setup to not be ready immediately, so
|
||||
# try again to avoid reporting issues related to that.
|
||||
logger.info("First VLAN-ID 1 data test failed - try again")
|
||||
|
@ -2329,7 +2329,7 @@ def test_ap_wps_auto_setup_with_config_file(dev, apdev):
|
||||
try:
|
||||
[name,value] = l.split('=', 1)
|
||||
vals[name] = value
|
||||
except ValueError, e:
|
||||
except ValueError as e:
|
||||
if "# WPS configuration" in l:
|
||||
pass
|
||||
else:
|
||||
@ -3322,7 +3322,7 @@ def test_ap_wps_upnp_http_proto(dev, apdev):
|
||||
try:
|
||||
conn.request(cmd, "hello")
|
||||
resp = conn.getresponse()
|
||||
except Exception, e:
|
||||
except Exception as e:
|
||||
pass
|
||||
conn.close()
|
||||
|
||||
@ -3330,7 +3330,7 @@ def test_ap_wps_upnp_http_proto(dev, apdev):
|
||||
conn.request("HEAD", "hello", "\r\n\r\n", headers)
|
||||
try:
|
||||
resp = conn.getresponse()
|
||||
except Exception, e:
|
||||
except Exception as e:
|
||||
pass
|
||||
conn.close()
|
||||
|
||||
@ -3338,7 +3338,7 @@ def test_ap_wps_upnp_http_proto(dev, apdev):
|
||||
conn.request("HEAD", "hello", "\r\n\r\n", headers)
|
||||
try:
|
||||
resp = conn.getresponse()
|
||||
except Exception, e:
|
||||
except Exception as e:
|
||||
pass
|
||||
conn.close()
|
||||
|
||||
@ -3346,7 +3346,7 @@ def test_ap_wps_upnp_http_proto(dev, apdev):
|
||||
conn.request("HEAD", "hello", "\r\n\r\nhello", headers)
|
||||
try:
|
||||
resp = conn.getresponse()
|
||||
except Exception, e:
|
||||
except Exception as e:
|
||||
pass
|
||||
conn.close()
|
||||
|
||||
@ -3368,7 +3368,7 @@ def test_ap_wps_upnp_http_proto(dev, apdev):
|
||||
conn.request("HEAD", 5000 * 'A')
|
||||
try:
|
||||
resp = conn.getresponse()
|
||||
except Exception, e:
|
||||
except Exception as e:
|
||||
pass
|
||||
conn.close()
|
||||
|
||||
@ -3383,7 +3383,7 @@ def test_ap_wps_upnp_http_proto(dev, apdev):
|
||||
conn.request("POST", "hello", 10 * 'A' + "\r\n\r\n", headers)
|
||||
try:
|
||||
resp = conn.getresponse()
|
||||
except Exception, e:
|
||||
except Exception as e:
|
||||
pass
|
||||
conn.close()
|
||||
|
||||
@ -3396,7 +3396,7 @@ def test_ap_wps_upnp_http_proto(dev, apdev):
|
||||
conn.request("POST", "hello", 60000 * 'A' + "\r\n\r\n")
|
||||
try:
|
||||
resp = conn.getresponse()
|
||||
except Exception, e:
|
||||
except Exception as e:
|
||||
pass
|
||||
conn.close()
|
||||
|
||||
@ -3442,7 +3442,7 @@ def test_ap_wps_upnp_http_proto_chunked(dev, apdev):
|
||||
conn.send("0\r\n\r\n")
|
||||
resp = conn.getresponse()
|
||||
completed = True
|
||||
except Exception, e:
|
||||
except Exception as e:
|
||||
pass
|
||||
conn.close()
|
||||
if completed:
|
||||
@ -3452,14 +3452,14 @@ def test_ap_wps_upnp_http_proto_chunked(dev, apdev):
|
||||
conn.request("POST", "hello", "80000000\r\na", headers)
|
||||
try:
|
||||
resp = conn.getresponse()
|
||||
except Exception, e:
|
||||
except Exception as e:
|
||||
pass
|
||||
conn.close()
|
||||
|
||||
conn.request("POST", "hello", "10000000\r\na", headers)
|
||||
try:
|
||||
resp = conn.getresponse()
|
||||
except Exception, e:
|
||||
except Exception as e:
|
||||
pass
|
||||
conn.close()
|
||||
|
||||
@ -4203,7 +4203,7 @@ def send_wlanevent(url, uuid, data, no_response=False):
|
||||
if no_response:
|
||||
try:
|
||||
conn.getresponse()
|
||||
except Exception, e:
|
||||
except Exception as e:
|
||||
pass
|
||||
return
|
||||
resp = conn.getresponse()
|
||||
@ -5127,7 +5127,7 @@ def wps_run_pbc_fail_ap(apdev, dev, hapd):
|
||||
try:
|
||||
dev.flush_scan_cache()
|
||||
break
|
||||
except Exception, e:
|
||||
except Exception as e:
|
||||
if str(e).startswith("Failed to trigger scan"):
|
||||
# Try again
|
||||
time.sleep(1)
|
||||
|
@ -51,7 +51,7 @@ def prepare_dbus(dev):
|
||||
path = wpas.GetInterface(dev.ifname)
|
||||
if_obj = bus.get_object(WPAS_DBUS_SERVICE, path)
|
||||
return (bus,wpas_obj,path,if_obj)
|
||||
except Exception, e:
|
||||
except Exception as e:
|
||||
raise HwsimSkip("Could not connect to D-Bus: %s" % e)
|
||||
|
||||
class TestDbus(object):
|
||||
@ -182,7 +182,7 @@ def test_dbus_getall_oom(dev, apdev):
|
||||
try:
|
||||
props = net_obj.GetAll(WPAS_DBUS_NETWORK,
|
||||
dbus_interface=dbus.PROPERTIES_IFACE)
|
||||
except dbus.exceptions.DBusException, e:
|
||||
except dbus.exceptions.DBusException as e:
|
||||
pass
|
||||
|
||||
def dbus_get(dbus, wpas_obj, prop, expect=None, byte_arrays=False):
|
||||
@ -210,7 +210,7 @@ def test_dbus_properties(dev, apdev):
|
||||
try:
|
||||
dbus_set(dbus, wpas_obj, "DebugLevel", val)
|
||||
raise Exception("Invalid DebugLevel value accepted: " + str(val))
|
||||
except dbus.exceptions.DBusException, e:
|
||||
except dbus.exceptions.DBusException as e:
|
||||
if err not in str(e):
|
||||
raise Exception("Unexpected error message: " + str(e))
|
||||
dbus_set(dbus, wpas_obj, "DebugLevel", "msgdump")
|
||||
@ -222,7 +222,7 @@ def test_dbus_properties(dev, apdev):
|
||||
try:
|
||||
dbus_set(dbus, wpas_obj, "DebugTimestamp", "foo")
|
||||
raise Exception("Invalid DebugTimestamp value accepted")
|
||||
except dbus.exceptions.DBusException, e:
|
||||
except dbus.exceptions.DBusException as e:
|
||||
if "Error.Failed: wrong property type" not in str(e):
|
||||
raise Exception("Unexpected error message: " + str(e))
|
||||
dbus_set(dbus, wpas_obj, "DebugTimestamp", True)
|
||||
@ -234,7 +234,7 @@ def test_dbus_properties(dev, apdev):
|
||||
try:
|
||||
dbus_set(dbus, wpas_obj, "DebugShowKeys", "foo")
|
||||
raise Exception("Invalid DebugShowKeys value accepted")
|
||||
except dbus.exceptions.DBusException, e:
|
||||
except dbus.exceptions.DBusException as e:
|
||||
if "Error.Failed: wrong property type" not in str(e):
|
||||
raise Exception("Unexpected error message: " + str(e))
|
||||
dbus_set(dbus, wpas_obj, "DebugShowKeys", True)
|
||||
@ -261,7 +261,7 @@ def test_dbus_properties(dev, apdev):
|
||||
try:
|
||||
dbus_set(dbus, wpas_obj, "WFDIEs", dbus.ByteArray('\x00'))
|
||||
raise Exception("Invalid WFDIEs value accepted")
|
||||
except dbus.exceptions.DBusException, e:
|
||||
except dbus.exceptions.DBusException as e:
|
||||
if "InvalidArgs" not in str(e):
|
||||
raise Exception("Unexpected error message: " + str(e))
|
||||
dbus_set(dbus, wpas_obj, "WFDIEs", dbus.ByteArray(''))
|
||||
@ -275,7 +275,7 @@ def test_dbus_properties(dev, apdev):
|
||||
try:
|
||||
dbus_set(dbus, wpas_obj, "EapMethods", res)
|
||||
raise Exception("Invalid Set accepted")
|
||||
except dbus.exceptions.DBusException, e:
|
||||
except dbus.exceptions.DBusException as e:
|
||||
if "InvalidArgs: Property is read-only" not in str(e):
|
||||
raise Exception("Unexpected error message: " + str(e))
|
||||
|
||||
@ -283,7 +283,7 @@ def test_dbus_properties(dev, apdev):
|
||||
wpas_obj.SetFoo(WPAS_DBUS_SERVICE, "DebugShowKeys", True,
|
||||
dbus_interface=dbus.PROPERTIES_IFACE)
|
||||
raise Exception("Unknown method accepted")
|
||||
except dbus.exceptions.DBusException, e:
|
||||
except dbus.exceptions.DBusException as e:
|
||||
if "UnknownMethod" not in str(e):
|
||||
raise Exception("Unexpected error message: " + str(e))
|
||||
|
||||
@ -291,7 +291,7 @@ def test_dbus_properties(dev, apdev):
|
||||
wpas_obj.Get("foo", "DebugShowKeys",
|
||||
dbus_interface=dbus.PROPERTIES_IFACE)
|
||||
raise Exception("Invalid Get accepted")
|
||||
except dbus.exceptions.DBusException, e:
|
||||
except dbus.exceptions.DBusException as e:
|
||||
if "InvalidArgs: No such property" not in str(e):
|
||||
raise Exception("Unexpected error message: " + str(e))
|
||||
|
||||
@ -301,14 +301,14 @@ def test_dbus_properties(dev, apdev):
|
||||
test_obj.Get(123, "DebugShowKeys",
|
||||
dbus_interface=dbus.PROPERTIES_IFACE)
|
||||
raise Exception("Invalid Get accepted")
|
||||
except dbus.exceptions.DBusException, e:
|
||||
except dbus.exceptions.DBusException as e:
|
||||
if "InvalidArgs: Invalid arguments" not in str(e):
|
||||
raise Exception("Unexpected error message: " + str(e))
|
||||
try:
|
||||
test_obj.Get(WPAS_DBUS_SERVICE, 123,
|
||||
dbus_interface=dbus.PROPERTIES_IFACE)
|
||||
raise Exception("Invalid Get accepted")
|
||||
except dbus.exceptions.DBusException, e:
|
||||
except dbus.exceptions.DBusException as e:
|
||||
if "InvalidArgs: Invalid arguments" not in str(e):
|
||||
raise Exception("Unexpected error message: " + str(e))
|
||||
|
||||
@ -317,7 +317,7 @@ def test_dbus_properties(dev, apdev):
|
||||
dbus.ByteArray('', variant_level=2),
|
||||
dbus_interface=dbus.PROPERTIES_IFACE)
|
||||
raise Exception("Invalid Set accepted")
|
||||
except dbus.exceptions.DBusException, e:
|
||||
except dbus.exceptions.DBusException as e:
|
||||
if "InvalidArgs: invalid message format" not in str(e):
|
||||
raise Exception("Unexpected error message: " + str(e))
|
||||
|
||||
@ -351,7 +351,7 @@ def test_dbus_invalid_method(dev, apdev):
|
||||
try:
|
||||
wps.Foo()
|
||||
raise Exception("Unknown method accepted")
|
||||
except dbus.exceptions.DBusException, e:
|
||||
except dbus.exceptions.DBusException as e:
|
||||
if "UnknownMethod" not in str(e):
|
||||
raise Exception("Unexpected error message: " + str(e))
|
||||
|
||||
@ -360,7 +360,7 @@ def test_dbus_invalid_method(dev, apdev):
|
||||
try:
|
||||
test_wps.Start(123)
|
||||
raise Exception("WPS.Start with incorrect signature accepted")
|
||||
except dbus.exceptions.DBusException, e:
|
||||
except dbus.exceptions.DBusException as e:
|
||||
if "InvalidArgs: Invalid arg" not in str(e):
|
||||
raise Exception("Unexpected error message: " + str(e))
|
||||
|
||||
@ -537,7 +537,7 @@ def test_dbus_wps_invalid(dev, apdev):
|
||||
try:
|
||||
wps.Start(args)
|
||||
raise Exception("Invalid WPS.Start() arguments accepted: " + str(args))
|
||||
except dbus.exceptions.DBusException, e:
|
||||
except dbus.exceptions.DBusException as e:
|
||||
if not str(e).startswith("fi.w1.wpa_supplicant1.InvalidArgs"):
|
||||
raise Exception("Unexpected error message: " + str(e))
|
||||
|
||||
@ -571,7 +571,7 @@ def test_dbus_wps_oom(dev, apdev):
|
||||
try:
|
||||
bss_obj.Get(WPAS_DBUS_BSS, "Rates",
|
||||
dbus_interface=dbus.PROPERTIES_IFACE)
|
||||
except dbus.exceptions.DBusException, e:
|
||||
except dbus.exceptions.DBusException as e:
|
||||
pass
|
||||
|
||||
id = dev[0].add_network()
|
||||
@ -1031,7 +1031,7 @@ def test_dbus_scan_invalid(dev, apdev):
|
||||
try:
|
||||
iface.Scan(t)
|
||||
raise Exception("Invalid Scan() arguments accepted: " + str(t))
|
||||
except dbus.exceptions.DBusException, e:
|
||||
except dbus.exceptions.DBusException as e:
|
||||
if err not in str(e):
|
||||
raise Exception("Unexpected error message for invalid Scan(%s): %s" % (str(t), str(e)))
|
||||
|
||||
@ -1162,7 +1162,7 @@ def test_dbus_scan_busy(dev, apdev):
|
||||
try:
|
||||
iface.Scan({'Type': 'active', 'AllowRoam': False})
|
||||
raise Exception("Scan() accepted when busy")
|
||||
except dbus.exceptions.DBusException, e:
|
||||
except dbus.exceptions.DBusException as e:
|
||||
if "ScanError: Scan request reject" not in str(e):
|
||||
raise Exception("Unexpected error message: " + str(e))
|
||||
|
||||
@ -1436,13 +1436,13 @@ def test_dbus_connect_oom(dev, apdev):
|
||||
signature='sv')
|
||||
try:
|
||||
self.netw = iface.AddNetwork(args)
|
||||
except Exception, e:
|
||||
except Exception as e:
|
||||
logger.info("Exception on AddNetwork: " + str(e))
|
||||
self.loop.quit()
|
||||
return False
|
||||
try:
|
||||
iface.SelectNetwork(self.netw)
|
||||
except Exception, e:
|
||||
except Exception as e:
|
||||
logger.info("Exception on SelectNetwork: " + str(e))
|
||||
self.loop.quit()
|
||||
|
||||
@ -1499,14 +1499,14 @@ def test_dbus_while_not_connected(dev, apdev):
|
||||
try:
|
||||
iface.Disconnect()
|
||||
raise Exception("Disconnect() accepted when not connected")
|
||||
except dbus.exceptions.DBusException, e:
|
||||
except dbus.exceptions.DBusException as e:
|
||||
if "NotConnected" not in str(e):
|
||||
raise Exception("Unexpected error message for invalid Disconnect: " + str(e))
|
||||
|
||||
try:
|
||||
iface.Reattach()
|
||||
raise Exception("Reattach() accepted when not connected")
|
||||
except dbus.exceptions.DBusException, e:
|
||||
except dbus.exceptions.DBusException as e:
|
||||
if "NotConnected" not in str(e):
|
||||
raise Exception("Unexpected error message for invalid Reattach: " + str(e))
|
||||
|
||||
@ -1661,13 +1661,13 @@ def test_dbus_network(dev, apdev):
|
||||
try:
|
||||
iface.RemoveNetwork(netw)
|
||||
raise Exception("Invalid RemoveNetwork() accepted")
|
||||
except dbus.exceptions.DBusException, e:
|
||||
except dbus.exceptions.DBusException as e:
|
||||
if "NetworkUnknown" not in str(e):
|
||||
raise Exception("Unexpected error message for invalid RemoveNetwork: " + str(e))
|
||||
try:
|
||||
iface.SelectNetwork(netw)
|
||||
raise Exception("Invalid SelectNetwork() accepted")
|
||||
except dbus.exceptions.DBusException, e:
|
||||
except dbus.exceptions.DBusException as e:
|
||||
if "NetworkUnknown" not in str(e):
|
||||
raise Exception("Unexpected error message for invalid RemoveNetwork: " + str(e))
|
||||
|
||||
@ -1704,7 +1704,7 @@ def test_dbus_network(dev, apdev):
|
||||
net_obj.Set(WPAS_DBUS_NETWORK, "Enabled", dbus.UInt32(1),
|
||||
dbus_interface=dbus.PROPERTIES_IFACE)
|
||||
raise Exception("Invalid Set(Enabled,1) accepted")
|
||||
except dbus.exceptions.DBusException, e:
|
||||
except dbus.exceptions.DBusException as e:
|
||||
if "Error.Failed: wrong property type" not in str(e):
|
||||
raise Exception("Unexpected error message for invalid Set(Enabled,1): " + str(e))
|
||||
|
||||
@ -1734,7 +1734,7 @@ def test_dbus_network(dev, apdev):
|
||||
try:
|
||||
iface.AddNetwork(args)
|
||||
raise Exception("Invalid AddNetwork args accepted: " + str(args))
|
||||
except dbus.exceptions.DBusException, e:
|
||||
except dbus.exceptions.DBusException as e:
|
||||
if "InvalidArgs" not in str(e):
|
||||
raise Exception("Unexpected error message for invalid AddNetwork: " + str(e))
|
||||
|
||||
@ -1770,7 +1770,7 @@ def test_dbus_network_oom(dev, apdev):
|
||||
# Currently, AddNetwork() succeeds even if os_strdup() for path
|
||||
# fails, so remove the network if that occurs.
|
||||
iface.RemoveNetwork(netw)
|
||||
except dbus.exceptions.DBusException, e:
|
||||
except dbus.exceptions.DBusException as e:
|
||||
pass
|
||||
|
||||
for i in range(1, 3):
|
||||
@ -1780,7 +1780,7 @@ def test_dbus_network_oom(dev, apdev):
|
||||
# Currently, AddNetwork() succeeds even if network registration
|
||||
# fails, so remove the network if that occurs.
|
||||
iface.RemoveNetwork(netw)
|
||||
except dbus.exceptions.DBusException, e:
|
||||
except dbus.exceptions.DBusException as e:
|
||||
pass
|
||||
|
||||
with alloc_fail_dbus(dev[0], 1,
|
||||
@ -1857,7 +1857,7 @@ def _test_dbus_interface(dev, apdev):
|
||||
try:
|
||||
wpas.CreateInterface(params)
|
||||
raise Exception("Invalid CreateInterface() accepted")
|
||||
except dbus.exceptions.DBusException, e:
|
||||
except dbus.exceptions.DBusException as e:
|
||||
if "InterfaceExists" not in str(e):
|
||||
raise Exception("Unexpected error message for invalid CreateInterface: " + str(e))
|
||||
|
||||
@ -1865,7 +1865,7 @@ def _test_dbus_interface(dev, apdev):
|
||||
try:
|
||||
wpas.RemoveInterface(path)
|
||||
raise Exception("Invalid RemoveInterface() accepted")
|
||||
except dbus.exceptions.DBusException, e:
|
||||
except dbus.exceptions.DBusException as e:
|
||||
if "InterfaceUnknown" not in str(e):
|
||||
raise Exception("Unexpected error message for invalid RemoveInterface: " + str(e))
|
||||
|
||||
@ -1875,7 +1875,7 @@ def _test_dbus_interface(dev, apdev):
|
||||
try:
|
||||
wpas.CreateInterface(params)
|
||||
raise Exception("Invalid CreateInterface() accepted")
|
||||
except dbus.exceptions.DBusException, e:
|
||||
except dbus.exceptions.DBusException as e:
|
||||
if "InvalidArgs" not in str(e):
|
||||
raise Exception("Unexpected error message for invalid CreateInterface: " + str(e))
|
||||
|
||||
@ -1883,14 +1883,14 @@ def _test_dbus_interface(dev, apdev):
|
||||
try:
|
||||
wpas.CreateInterface(params)
|
||||
raise Exception("Invalid CreateInterface() accepted")
|
||||
except dbus.exceptions.DBusException, e:
|
||||
except dbus.exceptions.DBusException as e:
|
||||
if "InvalidArgs" not in str(e):
|
||||
raise Exception("Unexpected error message for invalid CreateInterface: " + str(e))
|
||||
|
||||
try:
|
||||
wpas.GetInterface("lo")
|
||||
raise Exception("Invalid GetInterface() accepted")
|
||||
except dbus.exceptions.DBusException, e:
|
||||
except dbus.exceptions.DBusException as e:
|
||||
if "InterfaceUnknown" not in str(e):
|
||||
raise Exception("Unexpected error message for invalid RemoveInterface: " + str(e))
|
||||
|
||||
@ -1920,7 +1920,7 @@ def test_dbus_interface_oom(dev, apdev):
|
||||
raise Exception("CreateInterface succeeded during out-of-memory")
|
||||
if not state.startswith('0:'):
|
||||
break
|
||||
except dbus.exceptions.DBusException, e:
|
||||
except dbus.exceptions.DBusException as e:
|
||||
pass
|
||||
|
||||
for arg in [ 'Driver', 'Ifname', 'ConfigFile', 'BridgeIfname' ]:
|
||||
@ -1939,7 +1939,7 @@ def test_dbus_blob(dev, apdev):
|
||||
try:
|
||||
iface.AddBlob('blob1', dbus.ByteArray("\x01\x02\x04"))
|
||||
raise Exception("Invalid AddBlob() accepted")
|
||||
except dbus.exceptions.DBusException, e:
|
||||
except dbus.exceptions.DBusException as e:
|
||||
if "BlobExists" not in str(e):
|
||||
raise Exception("Unexpected error message for invalid AddBlob: " + str(e))
|
||||
res = iface.GetBlob('blob1')
|
||||
@ -1956,13 +1956,13 @@ def test_dbus_blob(dev, apdev):
|
||||
try:
|
||||
iface.RemoveBlob('blob1')
|
||||
raise Exception("Invalid RemoveBlob() accepted")
|
||||
except dbus.exceptions.DBusException, e:
|
||||
except dbus.exceptions.DBusException as e:
|
||||
if "BlobUnknown" not in str(e):
|
||||
raise Exception("Unexpected error message for invalid RemoveBlob: " + str(e))
|
||||
try:
|
||||
iface.GetBlob('blob1')
|
||||
raise Exception("Invalid GetBlob() accepted")
|
||||
except dbus.exceptions.DBusException, e:
|
||||
except dbus.exceptions.DBusException as e:
|
||||
if "BlobUnknown" not in str(e):
|
||||
raise Exception("Unexpected error message for invalid GetBlob: " + str(e))
|
||||
|
||||
@ -2045,14 +2045,14 @@ def test_dbus_tdls_invalid(dev, apdev):
|
||||
try:
|
||||
iface.TDLSDiscover("foo")
|
||||
raise Exception("Invalid TDLSDiscover() accepted")
|
||||
except dbus.exceptions.DBusException, e:
|
||||
except dbus.exceptions.DBusException as e:
|
||||
if "InvalidArgs" not in str(e):
|
||||
raise Exception("Unexpected error message for invalid TDLSDiscover: " + str(e))
|
||||
|
||||
try:
|
||||
iface.TDLSStatus("foo")
|
||||
raise Exception("Invalid TDLSStatus() accepted")
|
||||
except dbus.exceptions.DBusException, e:
|
||||
except dbus.exceptions.DBusException as e:
|
||||
if "InvalidArgs" not in str(e):
|
||||
raise Exception("Unexpected error message for invalid TDLSStatus: " + str(e))
|
||||
|
||||
@ -2063,35 +2063,35 @@ def test_dbus_tdls_invalid(dev, apdev):
|
||||
try:
|
||||
iface.TDLSSetup("foo")
|
||||
raise Exception("Invalid TDLSSetup() accepted")
|
||||
except dbus.exceptions.DBusException, e:
|
||||
except dbus.exceptions.DBusException as e:
|
||||
if "InvalidArgs" not in str(e):
|
||||
raise Exception("Unexpected error message for invalid TDLSSetup: " + str(e))
|
||||
|
||||
try:
|
||||
iface.TDLSTeardown("foo")
|
||||
raise Exception("Invalid TDLSTeardown() accepted")
|
||||
except dbus.exceptions.DBusException, e:
|
||||
except dbus.exceptions.DBusException as e:
|
||||
if "InvalidArgs" not in str(e):
|
||||
raise Exception("Unexpected error message for invalid TDLSTeardown: " + str(e))
|
||||
|
||||
try:
|
||||
iface.TDLSTeardown("00:11:22:33:44:55")
|
||||
raise Exception("TDLSTeardown accepted for unknown peer")
|
||||
except dbus.exceptions.DBusException, e:
|
||||
except dbus.exceptions.DBusException as e:
|
||||
if "UnknownError: error performing TDLS teardown" not in str(e):
|
||||
raise Exception("Unexpected error message: " + str(e))
|
||||
|
||||
try:
|
||||
iface.TDLSChannelSwitch({})
|
||||
raise Exception("Invalid TDLSChannelSwitch() accepted")
|
||||
except dbus.exceptions.DBusException, e:
|
||||
except dbus.exceptions.DBusException as e:
|
||||
if "InvalidArgs" not in str(e):
|
||||
raise Exception("Unexpected error message for invalid TDLSChannelSwitch: " + str(e))
|
||||
|
||||
try:
|
||||
iface.TDLSCancelChannelSwitch("foo")
|
||||
raise Exception("Invalid TDLSCancelChannelSwitch() accepted")
|
||||
except dbus.exceptions.DBusException, e:
|
||||
except dbus.exceptions.DBusException as e:
|
||||
if "InvalidArgs" not in str(e):
|
||||
raise Exception("Unexpected error message for invalid TDLSCancelChannelSwitch: " + str(e))
|
||||
|
||||
@ -2227,7 +2227,7 @@ def test_dbus_tdls_channel_switch(dev, apdev):
|
||||
signature='sv')
|
||||
try:
|
||||
iface.TDLSChannelSwitch(args)
|
||||
except Exception, e:
|
||||
except Exception as e:
|
||||
if "InvalidArgs" not in str(e):
|
||||
raise Exception("Unexpected exception")
|
||||
|
||||
@ -2235,7 +2235,7 @@ def test_dbus_tdls_channel_switch(dev, apdev):
|
||||
args = dbus.Dictionary({}, signature='sv')
|
||||
try:
|
||||
iface.TDLSChannelSwitch(args)
|
||||
except Exception, e:
|
||||
except Exception as e:
|
||||
if "InvalidArgs" not in str(e):
|
||||
raise Exception("Unexpected exception")
|
||||
|
||||
@ -2244,7 +2244,7 @@ def test_dbus_tdls_channel_switch(dev, apdev):
|
||||
signature='sv')
|
||||
try:
|
||||
iface.TDLSChannelSwitch(args)
|
||||
except Exception, e:
|
||||
except Exception as e:
|
||||
if "InvalidArgs" not in str(e):
|
||||
raise Exception("Unexpected exception")
|
||||
|
||||
@ -2254,7 +2254,7 @@ def test_dbus_tdls_channel_switch(dev, apdev):
|
||||
signature='sv')
|
||||
try:
|
||||
iface.TDLSChannelSwitch(args)
|
||||
except Exception, e:
|
||||
except Exception as e:
|
||||
if "InvalidArgs" not in str(e):
|
||||
raise Exception("Unexpected exception")
|
||||
|
||||
@ -2295,13 +2295,13 @@ def test_dbus_pkcs11(dev, apdev):
|
||||
|
||||
try:
|
||||
iface.SetPKCS11EngineAndModulePath("foo", "bar")
|
||||
except dbus.exceptions.DBusException, e:
|
||||
except dbus.exceptions.DBusException as e:
|
||||
if "Error.Failed: Reinit of the EAPOL" not in str(e):
|
||||
raise Exception("Unexpected error message for invalid SetPKCS11EngineAndModulePath: " + str(e))
|
||||
|
||||
try:
|
||||
iface.SetPKCS11EngineAndModulePath("foo", "")
|
||||
except dbus.exceptions.DBusException, e:
|
||||
except dbus.exceptions.DBusException as e:
|
||||
if "Error.Failed: Reinit of the EAPOL" not in str(e):
|
||||
raise Exception("Unexpected error message for invalid SetPKCS11EngineAndModulePath: " + str(e))
|
||||
|
||||
@ -2352,7 +2352,7 @@ def _test_dbus_apscan(dev, apdev):
|
||||
if_obj.Set(WPAS_DBUS_IFACE, "ApScan", dbus.Int16(-1),
|
||||
dbus_interface=dbus.PROPERTIES_IFACE)
|
||||
raise Exception("Invalid Set(ApScan,-1) accepted")
|
||||
except dbus.exceptions.DBusException, e:
|
||||
except dbus.exceptions.DBusException as e:
|
||||
if "Error.Failed: wrong property type" not in str(e):
|
||||
raise Exception("Unexpected error message for invalid Set(ApScan,-1): " + str(e))
|
||||
|
||||
@ -2360,7 +2360,7 @@ def _test_dbus_apscan(dev, apdev):
|
||||
if_obj.Set(WPAS_DBUS_IFACE, "ApScan", dbus.UInt32(123),
|
||||
dbus_interface=dbus.PROPERTIES_IFACE)
|
||||
raise Exception("Invalid Set(ApScan,123) accepted")
|
||||
except dbus.exceptions.DBusException, e:
|
||||
except dbus.exceptions.DBusException as e:
|
||||
if "Error.Failed: ap_scan must be 0, 1, or 2" not in str(e):
|
||||
raise Exception("Unexpected error message for invalid Set(ApScan,123): " + str(e))
|
||||
|
||||
@ -2415,7 +2415,7 @@ def test_dbus_fastreauth(dev, apdev):
|
||||
if_obj.Set(WPAS_DBUS_IFACE, "FastReauth", dbus.Int16(-1),
|
||||
dbus_interface=dbus.PROPERTIES_IFACE)
|
||||
raise Exception("Invalid Set(FastReauth,-1) accepted")
|
||||
except dbus.exceptions.DBusException, e:
|
||||
except dbus.exceptions.DBusException as e:
|
||||
if "Error.Failed: wrong property type" not in str(e):
|
||||
raise Exception("Unexpected error message for invalid Set(ApScan,-1): " + str(e))
|
||||
|
||||
@ -2444,7 +2444,7 @@ def test_dbus_bss_expire(dev, apdev):
|
||||
if_obj.Set(WPAS_DBUS_IFACE, "BSSExpireAge", dbus.Int16(-1),
|
||||
dbus_interface=dbus.PROPERTIES_IFACE)
|
||||
raise Exception("Invalid Set(BSSExpireAge,-1) accepted")
|
||||
except dbus.exceptions.DBusException, e:
|
||||
except dbus.exceptions.DBusException as e:
|
||||
if "Error.Failed: wrong property type" not in str(e):
|
||||
raise Exception("Unexpected error message for invalid Set(BSSExpireAge,-1): " + str(e))
|
||||
|
||||
@ -2452,7 +2452,7 @@ def test_dbus_bss_expire(dev, apdev):
|
||||
if_obj.Set(WPAS_DBUS_IFACE, "BSSExpireAge", dbus.UInt32(9),
|
||||
dbus_interface=dbus.PROPERTIES_IFACE)
|
||||
raise Exception("Invalid Set(BSSExpireAge,9) accepted")
|
||||
except dbus.exceptions.DBusException, e:
|
||||
except dbus.exceptions.DBusException as e:
|
||||
if "Error.Failed: BSSExpireAge must be >= 10" not in str(e):
|
||||
raise Exception("Unexpected error message for invalid Set(BSSExpireAge,9): " + str(e))
|
||||
|
||||
@ -2460,7 +2460,7 @@ def test_dbus_bss_expire(dev, apdev):
|
||||
if_obj.Set(WPAS_DBUS_IFACE, "BSSExpireCount", dbus.Int16(-1),
|
||||
dbus_interface=dbus.PROPERTIES_IFACE)
|
||||
raise Exception("Invalid Set(BSSExpireCount,-1) accepted")
|
||||
except dbus.exceptions.DBusException, e:
|
||||
except dbus.exceptions.DBusException as e:
|
||||
if "Error.Failed: wrong property type" not in str(e):
|
||||
raise Exception("Unexpected error message for invalid Set(BSSExpireCount,-1): " + str(e))
|
||||
|
||||
@ -2468,7 +2468,7 @@ def test_dbus_bss_expire(dev, apdev):
|
||||
if_obj.Set(WPAS_DBUS_IFACE, "BSSExpireCount", dbus.UInt32(0),
|
||||
dbus_interface=dbus.PROPERTIES_IFACE)
|
||||
raise Exception("Invalid Set(BSSExpireCount,0) accepted")
|
||||
except dbus.exceptions.DBusException, e:
|
||||
except dbus.exceptions.DBusException as e:
|
||||
if "Error.Failed: BSSExpireCount must be > 0" not in str(e):
|
||||
raise Exception("Unexpected error message for invalid Set(BSSExpireCount,0): " + str(e))
|
||||
|
||||
@ -2513,7 +2513,7 @@ def _test_dbus_country(dev, apdev):
|
||||
if_obj.Set(WPAS_DBUS_IFACE, "Country", dbus.Int16(-1),
|
||||
dbus_interface=dbus.PROPERTIES_IFACE)
|
||||
raise Exception("Invalid Set(Country,-1) accepted")
|
||||
except dbus.exceptions.DBusException, e:
|
||||
except dbus.exceptions.DBusException as e:
|
||||
if "Error.Failed: wrong property type" not in str(e):
|
||||
raise Exception("Unexpected error message for invalid Set(Country,-1): " + str(e))
|
||||
|
||||
@ -2521,7 +2521,7 @@ def _test_dbus_country(dev, apdev):
|
||||
if_obj.Set(WPAS_DBUS_IFACE, "Country", "F",
|
||||
dbus_interface=dbus.PROPERTIES_IFACE)
|
||||
raise Exception("Invalid Set(Country,F) accepted")
|
||||
except dbus.exceptions.DBusException, e:
|
||||
except dbus.exceptions.DBusException as e:
|
||||
if "Error.Failed: invalid country code" not in str(e):
|
||||
raise Exception("Unexpected error message for invalid Set(Country,F): " + str(e))
|
||||
|
||||
@ -2560,7 +2560,7 @@ def _test_dbus_scan_interval(dev, apdev):
|
||||
if_obj.Set(WPAS_DBUS_IFACE, "ScanInterval", dbus.UInt16(100),
|
||||
dbus_interface=dbus.PROPERTIES_IFACE)
|
||||
raise Exception("Invalid Set(ScanInterval,100) accepted")
|
||||
except dbus.exceptions.DBusException, e:
|
||||
except dbus.exceptions.DBusException as e:
|
||||
if "Error.Failed: wrong property type" not in str(e):
|
||||
raise Exception("Unexpected error message for invalid Set(ScanInterval,100): " + str(e))
|
||||
|
||||
@ -2568,7 +2568,7 @@ def _test_dbus_scan_interval(dev, apdev):
|
||||
if_obj.Set(WPAS_DBUS_IFACE, "ScanInterval", dbus.Int32(-1),
|
||||
dbus_interface=dbus.PROPERTIES_IFACE)
|
||||
raise Exception("Invalid Set(ScanInterval,-1) accepted")
|
||||
except dbus.exceptions.DBusException, e:
|
||||
except dbus.exceptions.DBusException as e:
|
||||
if "Error.Failed: scan_interval must be >= 0" not in str(e):
|
||||
raise Exception("Unexpected error message for invalid Set(ScanInterval,-1): " + str(e))
|
||||
|
||||
@ -2626,7 +2626,7 @@ def test_dbus_probe_req_reporting(dev, apdev):
|
||||
try:
|
||||
t.iface.UnsubscribeProbeReq()
|
||||
raise Exception("Invalid UnsubscribeProbeReq() accepted")
|
||||
except dbus.exceptions.DBusException, e:
|
||||
except dbus.exceptions.DBusException as e:
|
||||
if "NoSubscription" not in str(e):
|
||||
raise Exception("Unexpected error message for invalid UnsubscribeProbeReq(): " + str(e))
|
||||
t.group_p2p.Disconnect()
|
||||
@ -2650,7 +2650,7 @@ def test_dbus_probe_req_reporting_oom(dev, apdev):
|
||||
try:
|
||||
iface.UnsubscribeProbeReq()
|
||||
was_subscribed = True
|
||||
except dbus.exceptions.DBusException, e:
|
||||
except dbus.exceptions.DBusException as e:
|
||||
was_subscribed = False
|
||||
pass
|
||||
|
||||
@ -2671,14 +2671,14 @@ def test_dbus_p2p_invalid(dev, apdev):
|
||||
try:
|
||||
p2p.RejectPeer(path + "/Peers/00112233445566")
|
||||
raise Exception("Invalid RejectPeer accepted")
|
||||
except dbus.exceptions.DBusException, e:
|
||||
except dbus.exceptions.DBusException as e:
|
||||
if "UnknownError: Failed to call wpas_p2p_reject" not in str(e):
|
||||
raise Exception("Unexpected error message for invalid RejectPeer(): " + str(e))
|
||||
|
||||
try:
|
||||
p2p.RejectPeer("/foo")
|
||||
raise Exception("Invalid RejectPeer accepted")
|
||||
except dbus.exceptions.DBusException, e:
|
||||
except dbus.exceptions.DBusException as e:
|
||||
if "InvalidArgs" not in str(e):
|
||||
raise Exception("Unexpected error message for invalid RejectPeer(): " + str(e))
|
||||
|
||||
@ -2691,7 +2691,7 @@ def test_dbus_p2p_invalid(dev, apdev):
|
||||
try:
|
||||
p2p.RemoveClient(t)
|
||||
raise Exception("Invalid RemoveClient accepted")
|
||||
except dbus.exceptions.DBusException, e:
|
||||
except dbus.exceptions.DBusException as e:
|
||||
if "InvalidArgs" not in str(e):
|
||||
raise Exception("Unexpected error message for invalid RemoveClient(): " + str(e))
|
||||
|
||||
@ -2717,7 +2717,7 @@ def test_dbus_p2p_invalid(dev, apdev):
|
||||
try:
|
||||
p2p.Find(dbus.Dictionary(t))
|
||||
raise Exception("Invalid Find accepted")
|
||||
except dbus.exceptions.DBusException, e:
|
||||
except dbus.exceptions.DBusException as e:
|
||||
if "InvalidArgs" not in str(e):
|
||||
raise Exception("Unexpected error message for invalid Find(): " + str(e))
|
||||
|
||||
@ -2727,7 +2727,7 @@ def test_dbus_p2p_invalid(dev, apdev):
|
||||
try:
|
||||
p2p.RemovePersistentGroup(dbus.ObjectPath(p))
|
||||
raise Exception("Invalid RemovePersistentGroup accepted")
|
||||
except dbus.exceptions.DBusException, e:
|
||||
except dbus.exceptions.DBusException as e:
|
||||
if "InvalidArgs" not in str(e):
|
||||
raise Exception("Unexpected error message for invalid RemovePersistentGroup: " + str(e))
|
||||
|
||||
@ -2735,7 +2735,7 @@ def test_dbus_p2p_invalid(dev, apdev):
|
||||
dev[0].request("P2P_SET disabled 1")
|
||||
p2p.Listen(5)
|
||||
raise Exception("Invalid Listen accepted")
|
||||
except dbus.exceptions.DBusException, e:
|
||||
except dbus.exceptions.DBusException as e:
|
||||
if "UnknownError: Could not start P2P listen" not in str(e):
|
||||
raise Exception("Unexpected error message for invalid Listen: " + str(e))
|
||||
finally:
|
||||
@ -2746,7 +2746,7 @@ def test_dbus_p2p_invalid(dev, apdev):
|
||||
try:
|
||||
test_p2p.Listen("foo")
|
||||
raise Exception("Invalid Listen accepted")
|
||||
except dbus.exceptions.DBusException, e:
|
||||
except dbus.exceptions.DBusException as e:
|
||||
if "InvalidArgs" not in str(e):
|
||||
raise Exception("Unexpected error message for invalid Listen: " + str(e))
|
||||
|
||||
@ -2754,7 +2754,7 @@ def test_dbus_p2p_invalid(dev, apdev):
|
||||
dev[0].request("P2P_SET disabled 1")
|
||||
p2p.ExtendedListen(dbus.Dictionary({}))
|
||||
raise Exception("Invalid ExtendedListen accepted")
|
||||
except dbus.exceptions.DBusException, e:
|
||||
except dbus.exceptions.DBusException as e:
|
||||
if "UnknownError: failed to initiate a p2p_ext_listen" not in str(e):
|
||||
raise Exception("Unexpected error message for invalid ExtendedListen: " + str(e))
|
||||
finally:
|
||||
@ -2766,7 +2766,7 @@ def test_dbus_p2p_invalid(dev, apdev):
|
||||
'duration2': 20000, 'interval2': 102400 }
|
||||
p2p.PresenceRequest(args)
|
||||
raise Exception("Invalid PresenceRequest accepted")
|
||||
except dbus.exceptions.DBusException, e:
|
||||
except dbus.exceptions.DBusException as e:
|
||||
if "UnknownError: Failed to invoke presence request" not in str(e):
|
||||
raise Exception("Unexpected error message for invalid PresenceRequest: " + str(e))
|
||||
finally:
|
||||
@ -2776,7 +2776,7 @@ def test_dbus_p2p_invalid(dev, apdev):
|
||||
params = dbus.Dictionary({'frequency': dbus.Int32(-1)})
|
||||
p2p.GroupAdd(params)
|
||||
raise Exception("Invalid GroupAdd accepted")
|
||||
except dbus.exceptions.DBusException, e:
|
||||
except dbus.exceptions.DBusException as e:
|
||||
if "InvalidArgs" not in str(e):
|
||||
raise Exception("Unexpected error message for invalid GroupAdd: " + str(e))
|
||||
|
||||
@ -2786,14 +2786,14 @@ def test_dbus_p2p_invalid(dev, apdev):
|
||||
'frequency': 2412})
|
||||
p2p.GroupAdd(params)
|
||||
raise Exception("Invalid GroupAdd accepted")
|
||||
except dbus.exceptions.DBusException, e:
|
||||
except dbus.exceptions.DBusException as e:
|
||||
if "InvalidArgs" not in str(e):
|
||||
raise Exception("Unexpected error message for invalid GroupAdd: " + str(e))
|
||||
|
||||
try:
|
||||
p2p.Disconnect()
|
||||
raise Exception("Invalid Disconnect accepted")
|
||||
except dbus.exceptions.DBusException, e:
|
||||
except dbus.exceptions.DBusException as e:
|
||||
if "UnknownError: failed to disconnect" not in str(e):
|
||||
raise Exception("Unexpected error message for invalid Disconnect: " + str(e))
|
||||
|
||||
@ -2801,7 +2801,7 @@ def test_dbus_p2p_invalid(dev, apdev):
|
||||
dev[0].request("P2P_SET disabled 1")
|
||||
p2p.Flush()
|
||||
raise Exception("Invalid Flush accepted")
|
||||
except dbus.exceptions.DBusException, e:
|
||||
except dbus.exceptions.DBusException as e:
|
||||
if "Error.Failed: P2P is not available for this interface" not in str(e):
|
||||
raise Exception("Unexpected error message for invalid Flush: " + str(e))
|
||||
finally:
|
||||
@ -2815,7 +2815,7 @@ def test_dbus_p2p_invalid(dev, apdev):
|
||||
'frequency': 2412 }
|
||||
pin = p2p.Connect(args)
|
||||
raise Exception("Invalid Connect accepted")
|
||||
except dbus.exceptions.DBusException, e:
|
||||
except dbus.exceptions.DBusException as e:
|
||||
if "Error.Failed: P2P is not available for this interface" not in str(e):
|
||||
raise Exception("Unexpected error message for invalid Connect: " + str(e))
|
||||
finally:
|
||||
@ -2828,7 +2828,7 @@ def test_dbus_p2p_invalid(dev, apdev):
|
||||
try:
|
||||
pin = p2p.Connect(args)
|
||||
raise Exception("Invalid Connect accepted")
|
||||
except dbus.exceptions.DBusException, e:
|
||||
except dbus.exceptions.DBusException as e:
|
||||
if "InvalidArgs" not in str(e):
|
||||
raise Exception("Unexpected error message for invalid Connect: " + str(e))
|
||||
|
||||
@ -2837,7 +2837,7 @@ def test_dbus_p2p_invalid(dev, apdev):
|
||||
args = { 'peer': path }
|
||||
pin = p2p.Invite(args)
|
||||
raise Exception("Invalid Invite accepted")
|
||||
except dbus.exceptions.DBusException, e:
|
||||
except dbus.exceptions.DBusException as e:
|
||||
if "Error.Failed: P2P is not available for this interface" not in str(e):
|
||||
raise Exception("Unexpected error message for invalid Invite: " + str(e))
|
||||
finally:
|
||||
@ -2847,7 +2847,7 @@ def test_dbus_p2p_invalid(dev, apdev):
|
||||
args = { 'foo': 'bar' }
|
||||
pin = p2p.Invite(args)
|
||||
raise Exception("Invalid Invite accepted")
|
||||
except dbus.exceptions.DBusException, e:
|
||||
except dbus.exceptions.DBusException as e:
|
||||
if "InvalidArgs" not in str(e):
|
||||
raise Exception("Unexpected error message for invalid Connect: " + str(e))
|
||||
|
||||
@ -2870,7 +2870,7 @@ def test_dbus_p2p_invalid(dev, apdev):
|
||||
try:
|
||||
p2p.ProvisionDiscoveryRequest(p, method)
|
||||
raise Exception("Invalid ProvisionDiscoveryRequest accepted")
|
||||
except dbus.exceptions.DBusException, e:
|
||||
except dbus.exceptions.DBusException as e:
|
||||
if err not in str(e):
|
||||
raise Exception("Unexpected error message for invalid ProvisionDiscoveryRequest: " + str(e))
|
||||
|
||||
@ -2879,7 +2879,7 @@ def test_dbus_p2p_invalid(dev, apdev):
|
||||
if_obj.Get(WPAS_DBUS_IFACE_P2PDEVICE, "Peers",
|
||||
dbus_interface=dbus.PROPERTIES_IFACE)
|
||||
raise Exception("Invalid Get(Peers) accepted")
|
||||
except dbus.exceptions.DBusException, e:
|
||||
except dbus.exceptions.DBusException as e:
|
||||
if "Error.Failed: P2P is not available for this interface" not in str(e):
|
||||
raise Exception("Unexpected error message for invalid Get(Peers): " + str(e))
|
||||
finally:
|
||||
@ -3075,7 +3075,7 @@ def run_dbus_p2p_discovery(dev, apdev):
|
||||
try:
|
||||
p2p.RejectPeer(path)
|
||||
raise Exception("Invalid RejectPeer accepted")
|
||||
except dbus.exceptions.DBusException, e:
|
||||
except dbus.exceptions.DBusException as e:
|
||||
if "UnknownError: Failed to call wpas_p2p_reject" not in str(e):
|
||||
raise Exception("Unexpected error message for invalid RejectPeer(): " + str(e))
|
||||
self.loop.quit()
|
||||
@ -3121,7 +3121,7 @@ def run_dbus_p2p_discovery(dev, apdev):
|
||||
try:
|
||||
p2p.ExtendedListen(dbus.Dictionary({'foo': 100}))
|
||||
raise Exception("Invalid ExtendedListen accepted")
|
||||
except dbus.exceptions.DBusException, e:
|
||||
except dbus.exceptions.DBusException as e:
|
||||
if "InvalidArgs" not in str(e):
|
||||
raise Exception("Unexpected error message for invalid ExtendedListen(): " + str(e))
|
||||
|
||||
@ -3191,7 +3191,7 @@ def test_dbus_p2p_service_discovery(dev, apdev):
|
||||
try:
|
||||
p2p.DeleteService(args)
|
||||
raise Exception("Invalid DeleteService() accepted")
|
||||
except dbus.exceptions.DBusException, e:
|
||||
except dbus.exceptions.DBusException as e:
|
||||
if "InvalidArgs" not in str(e):
|
||||
raise Exception("Unexpected error message for invalid DeleteService(): " + str(e))
|
||||
|
||||
@ -3201,7 +3201,7 @@ def test_dbus_p2p_service_discovery(dev, apdev):
|
||||
try:
|
||||
p2p.DeleteService(args)
|
||||
raise Exception("Invalid DeleteService() accepted")
|
||||
except dbus.exceptions.DBusException, e:
|
||||
except dbus.exceptions.DBusException as e:
|
||||
if "InvalidArgs" not in str(e):
|
||||
raise Exception("Unexpected error message for invalid DeleteService(): " + str(e))
|
||||
|
||||
@ -3213,7 +3213,7 @@ def test_dbus_p2p_service_discovery(dev, apdev):
|
||||
try:
|
||||
p2p.DeleteService(args)
|
||||
raise Exception("Invalid DeleteService() accepted")
|
||||
except dbus.exceptions.DBusException, e:
|
||||
except dbus.exceptions.DBusException as e:
|
||||
if "InvalidArgs" not in str(e):
|
||||
raise Exception("Unexpected error message for invalid DeleteService(): " + str(e))
|
||||
|
||||
@ -3233,7 +3233,7 @@ def test_dbus_p2p_service_discovery(dev, apdev):
|
||||
try:
|
||||
p2p.DeleteService(args)
|
||||
raise Exception("Invalid DeleteService() accepted")
|
||||
except dbus.exceptions.DBusException, e:
|
||||
except dbus.exceptions.DBusException as e:
|
||||
if "InvalidArgs" not in str(e):
|
||||
raise Exception("Unexpected error message for invalid DeleteService(): " + str(e))
|
||||
|
||||
@ -3256,7 +3256,7 @@ def test_dbus_p2p_service_discovery(dev, apdev):
|
||||
try:
|
||||
p2p.AddService(args)
|
||||
raise Exception("Invalid AddService() accepted")
|
||||
except dbus.exceptions.DBusException, e:
|
||||
except dbus.exceptions.DBusException as e:
|
||||
if "InvalidArgs" not in str(e):
|
||||
raise Exception("Unexpected error message for invalid AddService(): " + str(e))
|
||||
|
||||
@ -3266,13 +3266,13 @@ def test_dbus_p2p_service_discovery(dev, apdev):
|
||||
try:
|
||||
p2p.ServiceDiscoveryCancelRequest(ref)
|
||||
raise Exception("Invalid ServiceDiscoveryCancelRequest() accepted")
|
||||
except dbus.exceptions.DBusException, e:
|
||||
except dbus.exceptions.DBusException as e:
|
||||
if "InvalidArgs" not in str(e):
|
||||
raise Exception("Unexpected error message for invalid AddService(): " + str(e))
|
||||
try:
|
||||
p2p.ServiceDiscoveryCancelRequest(dbus.UInt64(0))
|
||||
raise Exception("Invalid ServiceDiscoveryCancelRequest() accepted")
|
||||
except dbus.exceptions.DBusException, e:
|
||||
except dbus.exceptions.DBusException as e:
|
||||
if "InvalidArgs" not in str(e):
|
||||
raise Exception("Unexpected error message for invalid AddService(): " + str(e))
|
||||
|
||||
@ -3307,7 +3307,7 @@ def test_dbus_p2p_service_discovery(dev, apdev):
|
||||
try:
|
||||
p2p.ServiceDiscoveryRequest(args)
|
||||
raise Exception("Invalid ServiceDiscoveryRequest accepted")
|
||||
except dbus.exceptions.DBusException, e:
|
||||
except dbus.exceptions.DBusException as e:
|
||||
if "InvalidArgs" not in str(e):
|
||||
raise Exception("Unexpected error message for invalid ServiceDiscoveryRequest(): " + str(e))
|
||||
|
||||
@ -3315,7 +3315,7 @@ def test_dbus_p2p_service_discovery(dev, apdev):
|
||||
try:
|
||||
p2p.ServiceDiscoveryResponse(dbus.Dictionary(args, signature='sv'))
|
||||
raise Exception("Invalid ServiceDiscoveryResponse accepted")
|
||||
except dbus.exceptions.DBusException, e:
|
||||
except dbus.exceptions.DBusException as e:
|
||||
if "InvalidArgs" not in str(e):
|
||||
raise Exception("Unexpected error message for invalid ServiceDiscoveryResponse(): " + str(e))
|
||||
|
||||
@ -3564,7 +3564,7 @@ def test_dbus_p2p_autogo(dev, apdev):
|
||||
wps.Start(params)
|
||||
self.exceptions = True
|
||||
raise Exception("Invalid WPS.Start() accepted")
|
||||
except dbus.exceptions.DBusException, e:
|
||||
except dbus.exceptions.DBusException as e:
|
||||
if "InvalidArgs" not in str(e):
|
||||
self.exceptions = True
|
||||
raise Exception("Unexpected error message: " + str(e))
|
||||
@ -3641,7 +3641,7 @@ def test_dbus_p2p_autogo(dev, apdev):
|
||||
dbus_interface=dbus.PROPERTIES_IFACE)
|
||||
self.exceptions = True
|
||||
raise Exception("Invalid Set(WPSVendorExtensions) accepted")
|
||||
except dbus.exceptions.DBusException, e:
|
||||
except dbus.exceptions.DBusException as e:
|
||||
if "Error.Failed" not in str(e):
|
||||
self.exceptions = True
|
||||
raise Exception("Unexpected error message for invalid Set(WPSVendorExtensions): " + str(e))
|
||||
@ -3652,7 +3652,7 @@ def test_dbus_p2p_autogo(dev, apdev):
|
||||
dbus_interface=dbus.PROPERTIES_IFACE)
|
||||
self.exceptions = True
|
||||
raise Exception("Invalid Set(WPSVendorExtensions) accepted")
|
||||
except dbus.exceptions.DBusException, e:
|
||||
except dbus.exceptions.DBusException as e:
|
||||
if "InvalidArgs" not in str(e):
|
||||
self.exceptions = True
|
||||
raise Exception("Unexpected error message for invalid Set(WPSVendorExtensions): " + str(e))
|
||||
@ -3663,7 +3663,7 @@ def test_dbus_p2p_autogo(dev, apdev):
|
||||
dbus_interface=dbus.PROPERTIES_IFACE)
|
||||
self.exceptions = True
|
||||
raise Exception("Invalid Set(WPSVendorExtensions) accepted")
|
||||
except dbus.exceptions.DBusException, e:
|
||||
except dbus.exceptions.DBusException as e:
|
||||
if "Error.Failed" not in str(e):
|
||||
self.exceptions = True
|
||||
raise Exception("Unexpected error message for invalid Set(WPSVendorExtensions): " + str(e))
|
||||
@ -3674,7 +3674,7 @@ def test_dbus_p2p_autogo(dev, apdev):
|
||||
dbus_interface=dbus.PROPERTIES_IFACE)
|
||||
self.exceptions = True
|
||||
raise Exception("Invalid Set(WPSVendorExtensions) accepted")
|
||||
except dbus.exceptions.DBusException, e:
|
||||
except dbus.exceptions.DBusException as e:
|
||||
if "Error.Failed" not in str(e):
|
||||
self.exceptions = True
|
||||
raise Exception("Unexpected error message for invalid Set(WPSVendorExtensions): " + str(e))
|
||||
@ -3953,7 +3953,7 @@ def test_dbus_p2p_join(dev, apdev):
|
||||
g_obj.Set(WPAS_DBUS_GROUP, 'WPSVendorExtensions', res,
|
||||
dbus_interface=dbus.PROPERTIES_IFACE)
|
||||
raise Exception("Invalid Set(WPSVendorExtensions) accepted")
|
||||
except dbus.exceptions.DBusException, e:
|
||||
except dbus.exceptions.DBusException as e:
|
||||
if "Error.Failed: Failed to set property" not in str(e):
|
||||
raise Exception("Unexpected error message for invalid Set(WPSVendorExtensions): " + str(e))
|
||||
|
||||
@ -4105,7 +4105,7 @@ def _test_dbus_p2p_config(dev, apdev):
|
||||
dbus_interface=dbus.PROPERTIES_IFACE,
|
||||
byte_arrays=True)
|
||||
raise Exception("Invalid Get(P2PDeviceConfig) accepted")
|
||||
except dbus.exceptions.DBusException, e:
|
||||
except dbus.exceptions.DBusException as e:
|
||||
if "Error.Failed: P2P is not available for this interface" not in str(e):
|
||||
raise Exception("Unexpected error message for invalid Invite: " + str(e))
|
||||
finally:
|
||||
@ -4118,7 +4118,7 @@ def _test_dbus_p2p_config(dev, apdev):
|
||||
dbus.Dictionary(changes, signature='sv'),
|
||||
dbus_interface=dbus.PROPERTIES_IFACE)
|
||||
raise Exception("Invalid Set(P2PDeviceConfig) accepted")
|
||||
except dbus.exceptions.DBusException, e:
|
||||
except dbus.exceptions.DBusException as e:
|
||||
if "Error.Failed: P2P is not available for this interface" not in str(e):
|
||||
raise Exception("Unexpected error message for invalid Invite: " + str(e))
|
||||
finally:
|
||||
@ -4133,7 +4133,7 @@ def _test_dbus_p2p_config(dev, apdev):
|
||||
dbus.Dictionary(changes, signature='sv'),
|
||||
dbus_interface=dbus.PROPERTIES_IFACE)
|
||||
raise Exception("Invalid Set(P2PDeviceConfig) accepted")
|
||||
except dbus.exceptions.DBusException, e:
|
||||
except dbus.exceptions.DBusException as e:
|
||||
if "InvalidArgs" not in str(e):
|
||||
raise Exception("Unexpected error message for invalid Invite: " + str(e))
|
||||
|
||||
@ -4226,7 +4226,7 @@ def test_dbus_p2p_persistent(dev, apdev):
|
||||
try:
|
||||
p2p.RemovePersistentGroup(persistent)
|
||||
raise Exception("Invalid RemovePersistentGroup accepted")
|
||||
except dbus.exceptions.DBusException, e:
|
||||
except dbus.exceptions.DBusException as e:
|
||||
if "NetworkUnknown: There is no such persistent group" not in str(e):
|
||||
raise Exception("Unexpected error message for invalid RemovePersistentGroup: " + str(e))
|
||||
|
||||
@ -4295,7 +4295,7 @@ def test_dbus_p2p_reinvoke_persistent(dev, apdev):
|
||||
try:
|
||||
pin = p2p.Invite(args)
|
||||
raise Exception("Invalid Invite accepted")
|
||||
except dbus.exceptions.DBusException, e:
|
||||
except dbus.exceptions.DBusException as e:
|
||||
if "InvalidArgs" not in str(e):
|
||||
raise Exception("Unexpected error message for invalid Invite: " + str(e))
|
||||
|
||||
@ -4412,7 +4412,7 @@ def test_dbus_p2p_go_neg_rx(dev, apdev):
|
||||
try:
|
||||
p2p.Connect(args)
|
||||
raise Exception("Invalid Connect accepted")
|
||||
except dbus.exceptions.DBusException, e:
|
||||
except dbus.exceptions.DBusException as e:
|
||||
if "ConnectChannelUnsupported" not in str(e):
|
||||
raise Exception("Unexpected error message for invalid Connect: " + str(e))
|
||||
|
||||
@ -4494,7 +4494,7 @@ def test_dbus_p2p_go_neg_auth(dev, apdev):
|
||||
try:
|
||||
p2p.Connect(args)
|
||||
raise Exception("Invalid Connect accepted")
|
||||
except dbus.exceptions.DBusException, e:
|
||||
except dbus.exceptions.DBusException as e:
|
||||
if "InvalidArgs" not in str(e):
|
||||
raise Exception("Unexpected error message for invalid Connect: " + str(e))
|
||||
|
||||
@ -5113,7 +5113,7 @@ def test_dbus_p2p_cancel(dev, apdev):
|
||||
try:
|
||||
p2p.Cancel()
|
||||
raise Exception("Unexpected p2p.Cancel() success")
|
||||
except dbus.exceptions.DBusException, e:
|
||||
except dbus.exceptions.DBusException as e:
|
||||
pass
|
||||
|
||||
addr0 = dev[0].p2p_dev_addr()
|
||||
@ -5536,7 +5536,7 @@ def test_dbus_save_config(dev, apdev):
|
||||
try:
|
||||
iface.SaveConfig()
|
||||
raise Exception("SaveConfig() accepted unexpectedly")
|
||||
except dbus.exceptions.DBusException, e:
|
||||
except dbus.exceptions.DBusException as e:
|
||||
if not str(e).startswith("fi.w1.wpa_supplicant1.UnknownError: Not allowed to update configuration"):
|
||||
raise Exception("Unexpected error message for SaveConfig(): " + str(e))
|
||||
|
||||
@ -5557,7 +5557,7 @@ def _test_dbus_vendor_elem(dev, apdev):
|
||||
ie = dbus.ByteArray("\x00\x00")
|
||||
iface.VendorElemAdd(-1, ie)
|
||||
raise Exception("Invalid VendorElemAdd() accepted")
|
||||
except dbus.exceptions.DBusException, e:
|
||||
except dbus.exceptions.DBusException as e:
|
||||
if "InvalidArgs" not in str(e) or "Invalid ID" not in str(e):
|
||||
raise Exception("Unexpected error message for invalid VendorElemAdd[1]: " + str(e))
|
||||
|
||||
@ -5565,7 +5565,7 @@ def _test_dbus_vendor_elem(dev, apdev):
|
||||
ie = dbus.ByteArray("")
|
||||
iface.VendorElemAdd(1, ie)
|
||||
raise Exception("Invalid VendorElemAdd() accepted")
|
||||
except dbus.exceptions.DBusException, e:
|
||||
except dbus.exceptions.DBusException as e:
|
||||
if "InvalidArgs" not in str(e) or "Invalid value" not in str(e):
|
||||
raise Exception("Unexpected error message for invalid VendorElemAdd[2]: " + str(e))
|
||||
|
||||
@ -5573,21 +5573,21 @@ def _test_dbus_vendor_elem(dev, apdev):
|
||||
ie = dbus.ByteArray("\x00\x01")
|
||||
iface.VendorElemAdd(1, ie)
|
||||
raise Exception("Invalid VendorElemAdd() accepted")
|
||||
except dbus.exceptions.DBusException, e:
|
||||
except dbus.exceptions.DBusException as e:
|
||||
if "InvalidArgs" not in str(e) or "Parse error" not in str(e):
|
||||
raise Exception("Unexpected error message for invalid VendorElemAdd[3]: " + str(e))
|
||||
|
||||
try:
|
||||
iface.VendorElemGet(-1)
|
||||
raise Exception("Invalid VendorElemGet() accepted")
|
||||
except dbus.exceptions.DBusException, e:
|
||||
except dbus.exceptions.DBusException as e:
|
||||
if "InvalidArgs" not in str(e) or "Invalid ID" not in str(e):
|
||||
raise Exception("Unexpected error message for invalid VendorElemGet[1]: " + str(e))
|
||||
|
||||
try:
|
||||
iface.VendorElemGet(1)
|
||||
raise Exception("Invalid VendorElemGet() accepted")
|
||||
except dbus.exceptions.DBusException, e:
|
||||
except dbus.exceptions.DBusException as e:
|
||||
if "InvalidArgs" not in str(e) or "ID value does not exist" not in str(e):
|
||||
raise Exception("Unexpected error message for invalid VendorElemGet[2]: " + str(e))
|
||||
|
||||
@ -5595,7 +5595,7 @@ def _test_dbus_vendor_elem(dev, apdev):
|
||||
ie = dbus.ByteArray("\x00\x00")
|
||||
iface.VendorElemRem(-1, ie)
|
||||
raise Exception("Invalid VendorElemRemove() accepted")
|
||||
except dbus.exceptions.DBusException, e:
|
||||
except dbus.exceptions.DBusException as e:
|
||||
if "InvalidArgs" not in str(e) or "Invalid ID" not in str(e):
|
||||
raise Exception("Unexpected error message for invalid VendorElemRemove[1]: " + str(e))
|
||||
|
||||
@ -5603,7 +5603,7 @@ def _test_dbus_vendor_elem(dev, apdev):
|
||||
ie = dbus.ByteArray("")
|
||||
iface.VendorElemRem(1, ie)
|
||||
raise Exception("Invalid VendorElemRemove() accepted")
|
||||
except dbus.exceptions.DBusException, e:
|
||||
except dbus.exceptions.DBusException as e:
|
||||
if "InvalidArgs" not in str(e) or "Invalid value" not in str(e):
|
||||
raise Exception("Unexpected error message for invalid VendorElemRemove[1]: " + str(e))
|
||||
|
||||
@ -5634,7 +5634,7 @@ def _test_dbus_vendor_elem(dev, apdev):
|
||||
test_ie = dbus.ByteArray("\x01\x01")
|
||||
iface.VendorElemRem(1, test_ie)
|
||||
raise Exception("Invalid VendorElemRemove() accepted")
|
||||
except dbus.exceptions.DBusException, e:
|
||||
except dbus.exceptions.DBusException as e:
|
||||
if "InvalidArgs" not in str(e) or "Parse error" not in str(e):
|
||||
raise Exception("Unexpected error message for invalid VendorElemRemove[1]: " + str(e))
|
||||
|
||||
@ -5647,7 +5647,7 @@ def _test_dbus_vendor_elem(dev, apdev):
|
||||
try:
|
||||
iface.VendorElemGet(1)
|
||||
raise Exception("Invalid VendorElemGet() accepted after removal")
|
||||
except dbus.exceptions.DBusException, e:
|
||||
except dbus.exceptions.DBusException as e:
|
||||
if "InvalidArgs" not in str(e) or "ID value does not exist" not in str(e):
|
||||
raise Exception("Unexpected error message for invalid VendorElemGet after removal: " + str(e))
|
||||
|
||||
|
@ -36,7 +36,7 @@ def prepare_dbus(dev):
|
||||
path = wpas.getInterface(dev.ifname)
|
||||
if_obj = bus.get_object(WPAS_DBUS_OLD_SERVICE, path)
|
||||
return (bus,wpas_obj,path,if_obj)
|
||||
except Exception, e:
|
||||
except Exception as e:
|
||||
raise HwsimSkip("Could not connect to D-Bus: %s" % e)
|
||||
|
||||
class TestDbusOldWps(TestDbus):
|
||||
@ -83,7 +83,7 @@ def test_dbus_old(dev, apdev):
|
||||
try:
|
||||
if_obj.setAPScan(t, dbus_interface=WPAS_DBUS_OLD_IFACE)
|
||||
raise Exception("Invalid setAPScan() accepted")
|
||||
except dbus.exceptions.DBusException, e:
|
||||
except dbus.exceptions.DBusException as e:
|
||||
if "InvalidOptions" not in str(e):
|
||||
raise Exception("Unexpected error message for invalid setAPScan: " + str(e))
|
||||
|
||||
@ -93,7 +93,7 @@ def test_dbus_old(dev, apdev):
|
||||
try:
|
||||
obj.disable(dbus_interface=WPAS_DBUS_OLD_NETWORK)
|
||||
raise Exception("Invalid disable() accepted")
|
||||
except dbus.exceptions.DBusException, e:
|
||||
except dbus.exceptions.DBusException as e:
|
||||
if "InvalidNetwork" not in str(e):
|
||||
raise Exception("Unexpected error message for invalid disable: " + str(e))
|
||||
|
||||
@ -103,7 +103,7 @@ def test_dbus_old(dev, apdev):
|
||||
try:
|
||||
obj.properties(dbus_interface=WPAS_DBUS_OLD_BSSID)
|
||||
raise Exception("Invalid properties() accepted")
|
||||
except dbus.exceptions.DBusException, e:
|
||||
except dbus.exceptions.DBusException as e:
|
||||
if "InvalidBSSID" not in str(e):
|
||||
raise Exception("Unexpected error message for invalid properties: " + str(e))
|
||||
|
||||
@ -162,7 +162,7 @@ def test_dbus_old_scan(dev, apdev):
|
||||
try:
|
||||
bss_obj.properties2(dbus_interface=WPAS_DBUS_OLD_BSSID)
|
||||
raise Exception("Unknown BSSID method accepted")
|
||||
except Exception, e:
|
||||
except Exception as e:
|
||||
logger.debug("Unknown BSSID method exception: " + str(e))
|
||||
|
||||
if not if_obj.flush(0, dbus_interface=WPAS_DBUS_OLD_IFACE):
|
||||
@ -175,13 +175,13 @@ def test_dbus_old_scan(dev, apdev):
|
||||
try:
|
||||
if_obj.flush("foo", dbus_interface=WPAS_DBUS_OLD_IFACE)
|
||||
raise Exception("Invalid flush arguments accepted")
|
||||
except dbus.exceptions.DBusException, e:
|
||||
except dbus.exceptions.DBusException as e:
|
||||
if not str(e).startswith("fi.epitest.hostap.WPASupplicant.InvalidOptions"):
|
||||
raise Exception("Unexpected error message for invalid flush: " + str(e))
|
||||
try:
|
||||
bss_obj.properties(dbus_interface=WPAS_DBUS_OLD_BSSID,
|
||||
byte_arrays=True)
|
||||
except dbus.exceptions.DBusException, e:
|
||||
except dbus.exceptions.DBusException as e:
|
||||
if not str(e).startswith("fi.epitest.hostap.WPASupplicant.Interface.InvalidBSSID"):
|
||||
raise Exception("Unexpected error message for invalid BSS: " + str(e))
|
||||
|
||||
@ -193,14 +193,14 @@ def test_dbus_old_debug(dev, apdev):
|
||||
try:
|
||||
wpas.setDebugParams(123)
|
||||
raise Exception("Invalid setDebugParams accepted")
|
||||
except dbus.exceptions.DBusException, e:
|
||||
except dbus.exceptions.DBusException as e:
|
||||
if "InvalidOptions" not in str(e):
|
||||
raise Exception("Unexpected error message for invalid setDebugParam: " + str(e))
|
||||
|
||||
try:
|
||||
wpas.setDebugParams(123, True, True)
|
||||
raise Exception("Invalid setDebugParams accepted")
|
||||
except dbus.exceptions.DBusException, e:
|
||||
except dbus.exceptions.DBusException as e:
|
||||
if "InvalidOptions" not in str(e):
|
||||
raise Exception("Unexpected error message for invalid setDebugParam: " + str(e))
|
||||
|
||||
@ -233,7 +233,7 @@ def test_dbus_old_smartcard(dev, apdev):
|
||||
try:
|
||||
if_obj.setSmartcardModules(t, dbus_interface=WPAS_DBUS_OLD_IFACE)
|
||||
raise Exception("Invalid setSmartcardModules accepted: " + str(t))
|
||||
except dbus.exceptions.DBusException, e:
|
||||
except dbus.exceptions.DBusException as e:
|
||||
if not str(e).startswith("fi.epitest.hostap.WPASupplicant.InvalidOptions"):
|
||||
raise Exception("Unexpected error message for invalid setSmartcardModules(%s): %s" % (str(t), str(e)))
|
||||
|
||||
@ -266,7 +266,7 @@ def test_dbus_old_interface(dev, apdev):
|
||||
try:
|
||||
wpas.getInterface(ifname)
|
||||
raise Exception("Invalid getInterface accepted")
|
||||
except dbus.exceptions.DBusException, e:
|
||||
except dbus.exceptions.DBusException as e:
|
||||
if err not in str(e):
|
||||
raise Exception("Unexpected error message for invalid getInterface: " + str(e))
|
||||
|
||||
@ -278,7 +278,7 @@ def test_dbus_old_interface(dev, apdev):
|
||||
try:
|
||||
wpas.removeInterface(path)
|
||||
raise Exception("Invalid removeInterface() accepted")
|
||||
except dbus.exceptions.DBusException, e:
|
||||
except dbus.exceptions.DBusException as e:
|
||||
if "InvalidInterface" not in str(e):
|
||||
raise Exception("Unexpected error message for invalid removeInterface: " + str(e))
|
||||
|
||||
@ -302,14 +302,14 @@ def test_dbus_old_interface(dev, apdev):
|
||||
else:
|
||||
wpas.addInterface(ifname, params)
|
||||
raise Exception("Invalid addInterface accepted: " + str(params))
|
||||
except dbus.exceptions.DBusException, e:
|
||||
except dbus.exceptions.DBusException as e:
|
||||
if err not in str(e):
|
||||
raise Exception("Unexpected error message for invalid addInterface(%s): %s" % (str(params), str(e)))
|
||||
|
||||
try:
|
||||
wpas.removeInterface(123)
|
||||
raise Exception("Invalid removeInterface accepted")
|
||||
except dbus.exceptions.DBusException, e:
|
||||
except dbus.exceptions.DBusException as e:
|
||||
if not str(e).startswith("fi.epitest.hostap.WPASupplicant.InvalidOptions"):
|
||||
raise Exception("Unexpected error message for invalid removeInterface: " + str(e))
|
||||
|
||||
@ -345,7 +345,7 @@ def test_dbus_old_blob(dev, apdev):
|
||||
try:
|
||||
if_obj.setBlobs(arg, dbus_interface=WPAS_DBUS_OLD_IFACE)
|
||||
raise Exception("Invalid setBlobs() accepted: " + str(arg))
|
||||
except dbus.exceptions.DBusException, e:
|
||||
except dbus.exceptions.DBusException as e:
|
||||
logger.debug("setBlobs(%s): %s" % (str(arg), str(e)))
|
||||
if err not in str(e):
|
||||
raise Exception("Unexpected error message for invalid setBlobs: " + str(e))
|
||||
@ -358,7 +358,7 @@ def test_dbus_old_blob(dev, apdev):
|
||||
try:
|
||||
if_obj.removeBlobs(arg, dbus_interface=WPAS_DBUS_OLD_IFACE)
|
||||
raise Exception("Invalid removeBlobs() accepted: " + str(arg))
|
||||
except dbus.exceptions.DBusException, e:
|
||||
except dbus.exceptions.DBusException as e:
|
||||
logger.debug("removeBlobs(%s): %s" % (str(arg), str(e)))
|
||||
if err not in str(e):
|
||||
raise Exception("Unexpected error message for invalid removeBlobs: " + str(e))
|
||||
@ -412,21 +412,21 @@ def test_dbus_old_connect(dev, apdev):
|
||||
try:
|
||||
if_obj.removeNetwork(obj, dbus_interface=WPAS_DBUS_OLD_IFACE)
|
||||
raise Exception("Invalid removeNetwork accepted: " + p)
|
||||
except dbus.exceptions.DBusException, e:
|
||||
except dbus.exceptions.DBusException as e:
|
||||
if not str(e).startswith("fi.epitest.hostap.WPASupplicant.Interface.InvalidNetwork"):
|
||||
raise Exception("Unexpected error message for invalid removeNetwork: " + str(e))
|
||||
|
||||
try:
|
||||
if_obj.removeNetwork("foo", dbus_interface=WPAS_DBUS_OLD_IFACE)
|
||||
raise Exception("Invalid removeNetwork accepted")
|
||||
except dbus.exceptions.DBusException, e:
|
||||
except dbus.exceptions.DBusException as e:
|
||||
if not str(e).startswith("fi.epitest.hostap.WPASupplicant.InvalidOptions"):
|
||||
raise Exception("Unexpected error message for invalid removeNetwork: " + str(e))
|
||||
|
||||
try:
|
||||
if_obj.removeNetwork(path, dbus_interface=WPAS_DBUS_OLD_IFACE)
|
||||
raise Exception("Invalid removeNetwork accepted")
|
||||
except dbus.exceptions.DBusException, e:
|
||||
except dbus.exceptions.DBusException as e:
|
||||
if not str(e).startswith("fi.epitest.hostap.WPASupplicant.Interface.InvalidNetwork"):
|
||||
raise Exception("Unexpected error message for invalid removeNetwork: " + str(e))
|
||||
|
||||
@ -442,7 +442,7 @@ def test_dbus_old_connect(dev, apdev):
|
||||
try:
|
||||
if_obj.selectNetwork(t, dbus_interface=WPAS_DBUS_OLD_IFACE)
|
||||
raise Exception("Invalid selectNetwork accepted: " + str(t))
|
||||
except dbus.exceptions.DBusException, e:
|
||||
except dbus.exceptions.DBusException as e:
|
||||
if err not in str(e):
|
||||
raise Exception("Unexpected error message for invalid selectNetwork(%s): %s" % (str(t), str(e)))
|
||||
|
||||
@ -456,7 +456,7 @@ def test_dbus_old_connect(dev, apdev):
|
||||
try:
|
||||
netw_obj.set(t, dbus_interface=WPAS_DBUS_OLD_NETWORK)
|
||||
raise Exception("Invalid set() accepted: " + str(t))
|
||||
except dbus.exceptions.DBusException, e:
|
||||
except dbus.exceptions.DBusException as e:
|
||||
if "InvalidOptions" not in str(e):
|
||||
raise Exception("Unexpected error message for invalid set: " + str(e))
|
||||
params = dbus.Dictionary({ 'ssid': ssid,
|
||||
@ -521,7 +521,7 @@ def test_dbus_old_connect(dev, apdev):
|
||||
if_obj.removeNetwork(self.path,
|
||||
dbus_interface=WPAS_DBUS_OLD_IFACE)
|
||||
raise Exception("Invalid removeNetwork accepted")
|
||||
except dbus.exceptions.DBusException, e:
|
||||
except dbus.exceptions.DBusException as e:
|
||||
if not str(e).startswith("fi.epitest.hostap.WPASupplicant.Interface.InvalidNetwork"):
|
||||
raise Exception("Unexpected error message for invalid wpsPbc: " + str(e))
|
||||
|
||||
@ -637,7 +637,7 @@ def test_dbus_old_network_set(dev, apdev):
|
||||
try:
|
||||
netw_obj.set(params, dbus_interface=WPAS_DBUS_OLD_NETWORK)
|
||||
raise Exception("set succeeded with unexpected type")
|
||||
except dbus.exceptions.DBusException, e:
|
||||
except dbus.exceptions.DBusException as e:
|
||||
if "InvalidOptions" not in str(e):
|
||||
raise Exception("Unexpected error message for unexpected type: " + str(e))
|
||||
|
||||
@ -662,7 +662,7 @@ def _test_dbus_old_wps_pbc(dev, apdev):
|
||||
try:
|
||||
if_obj.wpsPbc(arg, dbus_interface=WPAS_DBUS_OLD_IFACE)
|
||||
raise Exception("Invalid wpsPbc arguments accepted: " + str(arg))
|
||||
except dbus.exceptions.DBusException, e:
|
||||
except dbus.exceptions.DBusException as e:
|
||||
if not str(e).startswith("fi.epitest.hostap.WPASupplicant.InvalidOptions"):
|
||||
raise Exception("Unexpected error message for invalid wpsPbc: " + str(e))
|
||||
|
||||
@ -730,7 +730,7 @@ def _test_dbus_old_wps_pin(dev, apdev):
|
||||
try:
|
||||
if_obj.wpsPin(arg[0], arg[1], dbus_interface=WPAS_DBUS_OLD_IFACE)
|
||||
raise Exception("Invalid wpsPin arguments accepted: " + str(arg))
|
||||
except dbus.exceptions.DBusException, e:
|
||||
except dbus.exceptions.DBusException as e:
|
||||
if not str(e).startswith("fi.epitest.hostap.WPASupplicant.InvalidOptions"):
|
||||
raise Exception("Unexpected error message for invalid wpsPbc: " + str(e))
|
||||
|
||||
@ -784,7 +784,7 @@ def _test_dbus_old_wps_reg(dev, apdev):
|
||||
try:
|
||||
if_obj.wpsReg(arg[0], arg[1], dbus_interface=WPAS_DBUS_OLD_IFACE)
|
||||
raise Exception("Invalid wpsReg arguments accepted: " + str(arg))
|
||||
except dbus.exceptions.DBusException, e:
|
||||
except dbus.exceptions.DBusException as e:
|
||||
if not str(e).startswith("fi.epitest.hostap.WPASupplicant.InvalidOptions"):
|
||||
raise Exception("Unexpected error message for invalid wpsPbc: " + str(e))
|
||||
|
||||
|
@ -198,7 +198,7 @@ def test_fils_sk_pmksa_caching_ocv(dev, apdev, params):
|
||||
params['ocv'] = '1'
|
||||
try:
|
||||
hapd = hostapd.add_ap(apdev[0]['ifname'], params)
|
||||
except Exception, e:
|
||||
except Exception as e:
|
||||
if "Failed to set hostapd parameter ocv" in str(e):
|
||||
raise HwsimSkip("OCV not supported")
|
||||
raise
|
||||
|
@ -243,7 +243,7 @@ class FstLauncher:
|
||||
try:
|
||||
pid = int(pidtxt)
|
||||
break
|
||||
except Exception, e:
|
||||
except Exception as e:
|
||||
self.logger.debug("kill_pid: No valid PID found: %s" % str(e))
|
||||
time.sleep(1)
|
||||
self.logger.debug("kill_pid %s --> pid %d" % (pidfile, pid))
|
||||
@ -257,7 +257,7 @@ class FstLauncher:
|
||||
break
|
||||
# Wait and check again
|
||||
time.sleep(1)
|
||||
except Exception, e:
|
||||
except Exception as e:
|
||||
self.logger.debug("Didn't stop the pid=%d. Was it stopped already? (%s)" % (pid, str(e)))
|
||||
|
||||
|
||||
|
@ -142,7 +142,7 @@ def fst_start_session(apdev, test_params, bad_param_type, start_on_ap,
|
||||
sid = '-1'
|
||||
initiator.set_fst_parameters(llt=llt)
|
||||
initiator.configure_session(sid, new_iface, old_iface)
|
||||
except Exception, e:
|
||||
except Exception as e:
|
||||
if e.args[0].startswith("Cannot add FST session with groupid"):
|
||||
if bad_param_type == bad_param_group_id or bad_param_type == bad_param_session_add_no_params:
|
||||
bad_parameter_detected = True
|
||||
@ -302,7 +302,7 @@ def fst_initiate_session(apdev, test_params, bad_param_type, init_on_ap):
|
||||
bad_parameter_detected = True
|
||||
else:
|
||||
initiator.initiate_session(sid, "accept")
|
||||
except Exception, e:
|
||||
except Exception as e:
|
||||
if e.args[0].startswith("Cannot initiate fst session"):
|
||||
if bad_param_type != bad_param_none:
|
||||
bad_parameter_detected = True
|
||||
@ -364,7 +364,7 @@ def fst_transfer_session(apdev, test_params, bad_param_type, init_on_ap,
|
||||
elif bad_param_type == bad_param_session_transfer_bad_session_id:
|
||||
sid = '-1'
|
||||
initiator.transfer_session(sid)
|
||||
except Exception, e:
|
||||
except Exception as e:
|
||||
if e.args[0].startswith("Cannot transfer fst session"):
|
||||
if bad_param_type != bad_param_none:
|
||||
bad_parameter_detected = True
|
||||
@ -427,7 +427,7 @@ def fst_tear_down_session(apdev, test_params, bad_param_type, init_on_ap):
|
||||
elif bad_param_type == bad_param_session_teardown_bad_session_id:
|
||||
sid = '-1'
|
||||
initiator.teardown_session(sid)
|
||||
except Exception, e:
|
||||
except Exception as e:
|
||||
if e.args[0].startswith("Cannot tear down fst session"):
|
||||
if (bad_param_type == bad_param_session_teardown_no_params or
|
||||
bad_param_type == bad_param_session_teardown_bad_session_id or
|
||||
@ -503,7 +503,7 @@ def fst_remove_session(apdev, test_params, remove_session_scenario, init_on_ap):
|
||||
elif remove_session_scenario == remove_scenario_bad_session_id:
|
||||
sid = '-1'
|
||||
initiator.remove_session(sid)
|
||||
except Exception, e:
|
||||
except Exception as e:
|
||||
if e.args[0].startswith("Cannot remove fst session"):
|
||||
if (remove_session_scenario == remove_scenario_no_params or
|
||||
remove_session_scenario == remove_scenario_bad_session_id):
|
||||
@ -592,7 +592,7 @@ def fst_send_unexpected_frame(apdev, test_params, frame_type, send_from_ap, addi
|
||||
#fsts_id doesn't matter, no actual session exists
|
||||
sender.send_test_tear_down('0')
|
||||
receiver.wait_for_session_event(5)
|
||||
except Exception, e:
|
||||
except Exception as e:
|
||||
if e.args[0].startswith("No FST-EVENT-SESSION received"):
|
||||
if frame_type != frame_type_session_request:
|
||||
frame_receive_timeout = True
|
||||
@ -716,7 +716,7 @@ def fst_bad_transfer(apdev, test_params, bad_scenario_type, init_on_ap):
|
||||
responder.wait_for_session_event(5, ["EVENT_FST_SESSION_STATE"])
|
||||
else:
|
||||
raise Exception("Unknown bad scenario identifier")
|
||||
except Exception, e:
|
||||
except Exception as e:
|
||||
if e.args[0].startswith("No FST-EVENT-SESSION received"):
|
||||
bad_parameter_detected = True
|
||||
if not bad_parameter_detected:
|
||||
@ -753,7 +753,7 @@ def test_fst_sta_connect_to_non_fst_ap(dev, apdev, test_params):
|
||||
res_sta1_mbies.startswith("FAIL") or
|
||||
res_sta2_mbies.startswith("FAIL")):
|
||||
raise Exception("Failure. MB IEs must be present on the stations")
|
||||
except Exception, e:
|
||||
except Exception as e:
|
||||
logger.info(e)
|
||||
raise
|
||||
finally:
|
||||
@ -773,7 +773,7 @@ def test_fst_sta_connect_to_fst_ap(dev, apdev, test_params):
|
||||
res_sta2_mbies = sta2.get_local_mbies()
|
||||
if res_sta2_mbies == orig_sta2_mbies:
|
||||
raise Exception("Failure. MB IEs have not been updated")
|
||||
except Exception, e:
|
||||
except Exception as e:
|
||||
logger.info(e)
|
||||
raise
|
||||
finally:
|
||||
@ -792,7 +792,7 @@ def test_fst_ap_connect_to_fst_sta(dev, apdev, test_params):
|
||||
res_ap_mbies = ap1.get_local_mbies()
|
||||
if res_ap_mbies != orig_ap_mbies:
|
||||
raise Exception("Failure. MB IEs have been unexpectedly updated on the AP")
|
||||
except Exception, e:
|
||||
except Exception as e:
|
||||
logger.info(e)
|
||||
raise
|
||||
finally:
|
||||
@ -811,7 +811,7 @@ def test_fst_ap_connect_to_non_fst_sta(dev, apdev, test_params):
|
||||
res_ap_mbies = ap2.get_local_mbies()
|
||||
if res_ap_mbies != orig_ap_mbies:
|
||||
raise Exception("Failure. MB IEs have been unexpectedly updated on the AP")
|
||||
except Exception, e:
|
||||
except Exception as e:
|
||||
logger.info(e)
|
||||
raise
|
||||
finally:
|
||||
@ -839,7 +839,7 @@ def test_fst_second_sta_connect_to_non_fst_ap(dev, apdev, test_params):
|
||||
res_sta1_mbies.startswith("FAIL") or
|
||||
res_sta2_mbies.startswith("FAIL")):
|
||||
raise Exception("Failure. MB IEs must be present on the stations")
|
||||
except Exception, e:
|
||||
except Exception as e:
|
||||
logger.info(e)
|
||||
raise
|
||||
finally:
|
||||
@ -869,7 +869,7 @@ def test_fst_second_sta_connect_to_fst_ap(dev, apdev, test_params):
|
||||
res_sta1_mbies.startswith("FAIL") or
|
||||
res_sta2_mbies.startswith("FAIL")):
|
||||
raise Exception("Failure. MB IEs must be present on the stations")
|
||||
except Exception, e:
|
||||
except Exception as e:
|
||||
logger.info(e)
|
||||
raise
|
||||
finally:
|
||||
@ -900,7 +900,7 @@ def test_fst_disconnect_1_of_2_stas_from_non_fst_ap(dev, apdev, test_params):
|
||||
res_sta1_mbies.startswith("FAIL") or
|
||||
res_sta2_mbies.startswith("FAIL")):
|
||||
raise Exception("Failure. MB IEs must be present on the stations")
|
||||
except Exception, e:
|
||||
except Exception as e:
|
||||
logger.info(e)
|
||||
raise
|
||||
finally:
|
||||
@ -931,7 +931,7 @@ def test_fst_disconnect_1_of_2_stas_from_fst_ap(dev, apdev, test_params):
|
||||
res_sta1_mbies.startswith("FAIL") or
|
||||
res_sta2_mbies.startswith("FAIL")):
|
||||
raise Exception("Failure. MB IEs must be present on the stations")
|
||||
except Exception, e:
|
||||
except Exception as e:
|
||||
logger.info(e)
|
||||
raise
|
||||
finally:
|
||||
@ -964,7 +964,7 @@ def test_fst_disconnect_2_of_2_stas_from_non_fst_ap(dev, apdev, test_params):
|
||||
res_sta1_mbies.startswith("FAIL") or
|
||||
res_sta2_mbies.startswith("FAIL")):
|
||||
raise Exception("Failure. MB IEs must be present on the stations")
|
||||
except Exception, e:
|
||||
except Exception as e:
|
||||
logger.info(e)
|
||||
raise
|
||||
finally:
|
||||
@ -1014,7 +1014,7 @@ def test_fst_disconnect_2_of_2_stas_from_fst_ap(dev, apdev, test_params):
|
||||
addr_sta2_mbie1 != addr_sta2_mbie2 or
|
||||
addr_sta2_mbie1 != addr_sta1_str):
|
||||
raise Exception("Failure. STA Address in MB IEs should have been same as the other STA's")
|
||||
except Exception, e:
|
||||
except Exception as e:
|
||||
logger.info(e)
|
||||
raise
|
||||
finally:
|
||||
@ -1045,7 +1045,7 @@ def test_fst_disconnect_non_fst_sta(dev, apdev, test_params):
|
||||
res_ap_mbies = ap2.get_local_mbies()
|
||||
if res_ap_mbies != orig_ap_mbies:
|
||||
raise Exception("Failure. MB IEs have been unexpectedly updated on the AP")
|
||||
except Exception, e:
|
||||
except Exception as e:
|
||||
logger.info(e)
|
||||
raise
|
||||
finally:
|
||||
@ -1076,7 +1076,7 @@ def test_fst_disconnect_fst_sta(dev, apdev, test_params):
|
||||
res_ap_mbies = ap2.get_local_mbies()
|
||||
if res_ap_mbies != orig_ap_mbies:
|
||||
raise Exception("Failure. MB IEs have been unexpectedly updated on the AP")
|
||||
except Exception, e:
|
||||
except Exception as e:
|
||||
logger.info(e)
|
||||
raise
|
||||
finally:
|
||||
@ -1137,7 +1137,7 @@ def test_fst_dynamic_iface_attach(dev, apdev, test_params):
|
||||
res_sta2_mbies.startswith("FAIL") or
|
||||
res_ap2_mbies.startswith("FAIL")):
|
||||
raise Exception("Failure. MB IEs should have appeared on the station and on the AP")
|
||||
except Exception, e:
|
||||
except Exception as e:
|
||||
logger.info(e)
|
||||
raise
|
||||
finally:
|
||||
@ -1498,13 +1498,13 @@ def test_fst_ap_ctrl_iface(dev, apdev, test_params):
|
||||
ap1.send_iface_attach_request(ap1.iface, ap1.fst_group,
|
||||
ap1.fst_llt, ap1.fst_pri)
|
||||
raise Exception("Duplicate FST-ATTACH succeeded")
|
||||
except Exception, e:
|
||||
except Exception as e:
|
||||
if not str(e).startswith("Cannot attach"):
|
||||
raise
|
||||
|
||||
try:
|
||||
ap1.get_fsts_id_by_sid("123")
|
||||
except Exception, e:
|
||||
except Exception as e:
|
||||
if not str(e).startswith("Cannot get fsts_id for sid"):
|
||||
raise
|
||||
finally:
|
||||
@ -2537,7 +2537,7 @@ def _test_fst_setup_mbie_diff(dev, apdev, test_params):
|
||||
with alloc_fail(hapd, 1, "mb_ies_by_info"):
|
||||
fst_setup_req(wpas, hglobal, 5180, apdev[0]['bssid'], req, stie,
|
||||
mbie, no_wait=True)
|
||||
except HwsimSkip, e:
|
||||
except HwsimSkip as e:
|
||||
# Skip exception to allow proper cleanup
|
||||
pass
|
||||
|
||||
|
@ -35,7 +35,7 @@ def hostapd_oom_loop(apdev, params, start_func="main"):
|
||||
count += 1
|
||||
if count == 5:
|
||||
break
|
||||
except Exception, e:
|
||||
except Exception as e:
|
||||
logger.info("Iteration %d - %s" % (i, str(e)))
|
||||
|
||||
@remote_compatible
|
||||
@ -57,7 +57,7 @@ def test_hostapd_oom_wpa2_psk(dev, apdev):
|
||||
try:
|
||||
hostapd.add_ap(apdev[1], params, timeout=2.5)
|
||||
raise Exception("Unexpected add_ap() success during OOM")
|
||||
except Exception, e:
|
||||
except Exception as e:
|
||||
if "Failed to enable hostapd" in str(e):
|
||||
pass
|
||||
else:
|
||||
|
@ -240,15 +240,15 @@ def test_ibss_wpa_none(dev):
|
||||
# mac80211 currently..
|
||||
try:
|
||||
hwsim_utils.test_connectivity(dev[0], dev[1])
|
||||
except Exception, e:
|
||||
except Exception as e:
|
||||
logger.info("Ignoring known connectivity failure: " + str(e))
|
||||
try:
|
||||
hwsim_utils.test_connectivity(dev[0], dev[2])
|
||||
except Exception, e:
|
||||
except Exception as e:
|
||||
logger.info("Ignoring known connectivity failure: " + str(e))
|
||||
try:
|
||||
hwsim_utils.test_connectivity(dev[1], dev[2])
|
||||
except Exception, e:
|
||||
except Exception as e:
|
||||
logger.info("Ignoring known connectivity failure: " + str(e))
|
||||
|
||||
key_mgmt = dev[0].get_status_field("key_mgmt")
|
||||
@ -291,7 +291,7 @@ def test_ibss_wpa_none_ccmp(dev):
|
||||
# mac80211 currently..
|
||||
try:
|
||||
hwsim_utils.test_connectivity(dev[0], dev[1])
|
||||
except Exception, e:
|
||||
except Exception as e:
|
||||
logger.info("Ignoring known connectivity failure: " + str(e))
|
||||
|
||||
def test_ibss_open(dev):
|
||||
|
@ -164,7 +164,7 @@ def add_wpas_interfaces(count=2):
|
||||
wpas = WpaSupplicant(global_iface='/tmp/wpas-wlan5')
|
||||
wpas.interface_add("veth%d" % i, driver="macsec_linux")
|
||||
wpa.append(wpas)
|
||||
except Exception, e:
|
||||
except Exception as e:
|
||||
if "Failed to add a dynamic wpa_supplicant interface" in str(e):
|
||||
raise HwsimSkip("macsec supported (wpa_supplicant CONFIG_MACSEC, CONFIG_MACSEC_LINUX; kernel CONFIG_MACSEC)")
|
||||
raise
|
||||
|
@ -528,7 +528,7 @@ def test_mbo_without_pmf(dev, apdev):
|
||||
# "MBO: PMF needs to be enabled whenever using WPA2 with MBO"
|
||||
hostapd.add_ap(apdev[0], params)
|
||||
raise Exception("AP setup succeeded unexpectedly")
|
||||
except Exception, e:
|
||||
except Exception as e:
|
||||
if "Failed to enable hostapd" in str(e):
|
||||
pass
|
||||
else:
|
||||
|
@ -35,7 +35,7 @@ def ocv_setup_ap(apdev, params):
|
||||
params.update(hostapd.wpa2_params(ssid=ssid, passphrase=passphrase))
|
||||
try:
|
||||
hapd = hostapd.add_ap(apdev, params)
|
||||
except Exception, e:
|
||||
except Exception as e:
|
||||
if "Failed to set hostapd parameter ocv" in str(e):
|
||||
raise HwsimSkip("OCV not supported")
|
||||
raise
|
||||
@ -371,7 +371,7 @@ class APConnection:
|
||||
params["ocv"] = ap_ocv
|
||||
try:
|
||||
self.hapd = hostapd.add_ap(apdev, params)
|
||||
except Exception, e:
|
||||
except Exception as e:
|
||||
if "Failed to set hostapd parameter ocv" in str(e):
|
||||
raise HwsimSkip("OCV not supported")
|
||||
raise
|
||||
@ -598,7 +598,7 @@ def test_wpa2_ocv_ap_retransmit_msg3(dev, apdev):
|
||||
params['wpa_disable_eapol_key_retries'] = "1"
|
||||
try:
|
||||
hapd = hostapd.add_ap(apdev[0], params)
|
||||
except Exception, e:
|
||||
except Exception as e:
|
||||
if "Failed to set hostapd parameter ocv" in str(e):
|
||||
raise HwsimSkip("OCV not supported")
|
||||
raise
|
||||
@ -731,7 +731,7 @@ class STAConnection:
|
||||
|
||||
try:
|
||||
self.hapd = hostapd.add_ap(apdev, params)
|
||||
except Exception, e:
|
||||
except Exception as e:
|
||||
if "Failed to set hostapd parameter ocv" in str(e):
|
||||
raise HwsimSkip("OCV not supported")
|
||||
raise
|
||||
|
@ -551,7 +551,7 @@ def test_go_neg_peers_force_diff_freq(dev, apdev):
|
||||
try:
|
||||
[i_res2, r_res2] = go_neg_pbc(i_dev=dev[0], i_intent=14, i_freq=5180,
|
||||
r_dev=dev[1], r_intent=0, r_freq=5200)
|
||||
except Exception, e:
|
||||
except Exception as e:
|
||||
return
|
||||
raise Exception("Unexpected group formation success")
|
||||
|
||||
|
@ -22,7 +22,7 @@ def get_rfkill(dev):
|
||||
for r, s, h in RFKill.list():
|
||||
if r.name == phy:
|
||||
return r
|
||||
except Exception, e:
|
||||
except Exception as e:
|
||||
raise HwsimSkip("No rfkill available: " + str(e))
|
||||
raise HwsimSkip("No rfkill match found for the interface")
|
||||
|
||||
|
@ -1247,7 +1247,7 @@ def test_rrm_beacon_req_table_vht(dev, apdev):
|
||||
elif report.bssid_str == apdev[1]['bssid']:
|
||||
if report.opclass != 117 or report.channel != 48:
|
||||
raise Exception("Incorrect opclass/channel for AP1")
|
||||
except Exception, e:
|
||||
except Exception as e:
|
||||
if isinstance(e, Exception) and str(e) == "AP startup failed":
|
||||
if not vht_supported():
|
||||
raise HwsimSkip("80 MHz channel not supported in regulatory information")
|
||||
@ -1662,7 +1662,7 @@ def test_rrm_beacon_req_passive_scan_vht(dev, apdev):
|
||||
logger.info("Received beacon report: " + str(report))
|
||||
if report.opclass != 128 or report.channel != 36:
|
||||
raise Exception("Incorrect opclass/channel for AP")
|
||||
except Exception, e:
|
||||
except Exception as e:
|
||||
if isinstance(e, Exception) and str(e) == "AP startup failed":
|
||||
if not vht_supported():
|
||||
raise HwsimSkip("80 MHz channel not supported in regulatory information")
|
||||
@ -1712,7 +1712,7 @@ def test_rrm_beacon_req_passive_scan_vht160(dev, apdev):
|
||||
logger.info("Received beacon report: " + str(report))
|
||||
if report.opclass != 129 or report.channel != 104:
|
||||
raise Exception("Incorrect opclass/channel for AP")
|
||||
except Exception, e:
|
||||
except Exception as e:
|
||||
if isinstance(e, Exception) and str(e) == "AP startup failed":
|
||||
raise HwsimSkip("ZA regulatory rule likely did not have DFS requirement removed")
|
||||
raise
|
||||
|
@ -21,7 +21,7 @@ def get_wext_interface():
|
||||
wpas = WpaSupplicant(global_iface='/tmp/wpas-wlan5')
|
||||
try:
|
||||
wpas.interface_add("wlan5", driver="wext")
|
||||
except Exception, e:
|
||||
except Exception as e:
|
||||
wpas.close_ctrl()
|
||||
raise HwsimSkip("WEXT driver support not included in wpa_supplicant")
|
||||
return wpas
|
||||
|
@ -70,7 +70,7 @@ def get_wmediumd_version():
|
||||
|
||||
try:
|
||||
verstr = subprocess.check_output(['wmediumd', '-V'])
|
||||
except OSError, e:
|
||||
except OSError as e:
|
||||
if e.errno == errno.ENOENT:
|
||||
raise HwsimSkip('wmediumd not available')
|
||||
raise
|
||||
@ -101,7 +101,7 @@ def start_wmediumd(fn, params):
|
||||
p = subprocess.Popen(['wmediumd', '-c', fn],
|
||||
stdout=subprocess.PIPE,
|
||||
stderr=subprocess.STDOUT)
|
||||
except OSError, e:
|
||||
except OSError as e:
|
||||
if e.errno == errno.ENOENT:
|
||||
raise HwsimSkip('wmediumd not available')
|
||||
raise
|
||||
|
@ -310,7 +310,7 @@ def test_wnm_sleep_mode_rsn_ocv(dev, apdev):
|
||||
params["bss_transition"] = "1"
|
||||
try:
|
||||
hapd = hostapd.add_ap(apdev[0], params)
|
||||
except Exception, e:
|
||||
except Exception as e:
|
||||
if "Failed to set hostapd parameter ocv" in str(e):
|
||||
raise HwsimSkip("OCV not supported")
|
||||
raise
|
||||
@ -343,7 +343,7 @@ def test_wnm_sleep_mode_rsn_badocv(dev, apdev):
|
||||
params['wnm_sleep_mode'] = '1'
|
||||
try:
|
||||
hapd = hostapd.add_ap(apdev[0], params)
|
||||
except Exception, e:
|
||||
except Exception as e:
|
||||
if "Failed to set hostapd parameter ocv" in str(e):
|
||||
raise HwsimSkip("OCV not supported")
|
||||
raise
|
||||
|
@ -94,7 +94,7 @@ def test_wpas_ctrl_network(dev):
|
||||
res = dev[0].get_network(id, "key_mgmt")
|
||||
if res != value:
|
||||
raise Exception("Unexpected response for key_mgmt")
|
||||
except Exception, e:
|
||||
except Exception as e:
|
||||
if str(e).startswith("Unexpected"):
|
||||
raise
|
||||
else:
|
||||
@ -1827,7 +1827,7 @@ def test_wpas_ctrl_socket_full(dev, apdev, test_params):
|
||||
logger.debug("Command %d" % i)
|
||||
try:
|
||||
s.send("MIB")
|
||||
except Exception, e:
|
||||
except Exception as e:
|
||||
logger.info("Could not send command %d: %s" % (i, str(e)))
|
||||
break
|
||||
# Close without receiving response
|
||||
@ -1846,7 +1846,7 @@ def test_wpas_ctrl_socket_full(dev, apdev, test_params):
|
||||
logger.debug("Command %d [2]" % i)
|
||||
try:
|
||||
s2.send("MIB")
|
||||
except Exception, e:
|
||||
except Exception as e:
|
||||
logger.info("Could not send command %d [2]: %s" % (i, str(e)))
|
||||
break
|
||||
# Close without receiving response
|
||||
@ -1859,7 +1859,7 @@ def test_wpas_ctrl_socket_full(dev, apdev, test_params):
|
||||
logger.debug("Command %d [3]" % i)
|
||||
try:
|
||||
s2.send("MIB")
|
||||
except Exception, e:
|
||||
except Exception as e:
|
||||
logger.info("Could not send command %d [3]: %s" % (i, str(e)))
|
||||
break
|
||||
# Close without receiving response
|
||||
|
@ -303,7 +303,7 @@ def add_mesh_secure_net(dev, psk=True, pmf=False, pairwise=None, group=None,
|
||||
if ocv:
|
||||
try:
|
||||
dev.set_network(id, "ocv", "1")
|
||||
except Exception, e:
|
||||
except Exception as e:
|
||||
if "SET_NETWORK failed" in str(e):
|
||||
raise HwsimSkip("OCV not supported")
|
||||
raise
|
||||
@ -1264,7 +1264,7 @@ def test_wpas_mesh_password_mismatch(dev, apdev):
|
||||
try:
|
||||
hwsim_utils.test_connectivity(dev[i], dev[2], timeout=1)
|
||||
raise Exception("Data connectivity test passed unexpectedly")
|
||||
except Exception, e:
|
||||
except Exception as e:
|
||||
if "data delivery failed" not in str(e):
|
||||
raise
|
||||
|
||||
@ -1713,7 +1713,7 @@ def test_mesh_oom(dev, apdev):
|
||||
"MESH-GROUP-STARTED"])
|
||||
if ev is None:
|
||||
raise Exception("Init failure not reported")
|
||||
except Exception, e:
|
||||
except Exception as e:
|
||||
if i < 15:
|
||||
raise
|
||||
logger.info("Ignore no-oom for i=%d" % i)
|
||||
|
@ -60,7 +60,7 @@ def test_tspec(dev, apdev):
|
||||
try:
|
||||
dev[0].add_ts(tsid, 3)
|
||||
raise Exception("ADDTS succeeded although it should have failed")
|
||||
except Exception, e:
|
||||
except Exception as e:
|
||||
if not str(e).startswith("ADDTS failed"):
|
||||
raise
|
||||
status = dev[0].request("WMM_AC_STATUS")
|
||||
@ -77,7 +77,7 @@ def test_tspec(dev, apdev):
|
||||
try:
|
||||
dev[0].add_ts(tsid, 5)
|
||||
raise Exception("ADDTS succeeded although it should have failed")
|
||||
except Exception, e:
|
||||
except Exception as e:
|
||||
if not str(e).startswith("ADDTS failed"):
|
||||
raise
|
||||
|
||||
@ -93,13 +93,13 @@ def test_tspec(dev, apdev):
|
||||
try:
|
||||
dev[0].add_ts(tsid, 7, direction="uplink")
|
||||
raise Exception("ADDTS succeeded although it should have failed")
|
||||
except Exception, e:
|
||||
except Exception as e:
|
||||
if not str(e).startswith("ADDTS failed"):
|
||||
raise
|
||||
try:
|
||||
dev[0].add_ts(tsid, 7, direction="bidi")
|
||||
raise Exception("ADDTS succeeded although it should have failed")
|
||||
except Exception, e:
|
||||
except Exception as e:
|
||||
if not str(e).startswith("ADDTS failed"):
|
||||
raise
|
||||
|
||||
@ -107,7 +107,7 @@ def test_tspec(dev, apdev):
|
||||
try:
|
||||
dev[0].del_ts(tsid)
|
||||
raise Exception("DELTS succeeded although it should have failed")
|
||||
except Exception, e:
|
||||
except Exception as e:
|
||||
if not str(e).startswith("DELTS failed"):
|
||||
raise
|
||||
|
||||
@ -231,7 +231,7 @@ def test_tspec_not_enabled(dev, apdev):
|
||||
try:
|
||||
dev[0].add_ts(5, 6)
|
||||
raise Exception("ADDTS succeeded although it should have failed")
|
||||
except Exception, e:
|
||||
except Exception as e:
|
||||
if not str(e).startswith("ADDTS failed"):
|
||||
raise
|
||||
|
||||
@ -239,7 +239,7 @@ def test_tspec_not_enabled(dev, apdev):
|
||||
try:
|
||||
dev[0].del_ts(5)
|
||||
raise Exception("DELTS succeeded although it should have failed")
|
||||
except Exception, e:
|
||||
except Exception as e:
|
||||
if not str(e).startswith("DELTS failed"):
|
||||
raise
|
||||
|
||||
|
@ -39,7 +39,7 @@ def _run_tshark(filename, filter, display=None, wait=True):
|
||||
arg.append('-V')
|
||||
cmd = subprocess.Popen(arg, stdout=subprocess.PIPE,
|
||||
stderr=subprocess.PIPE)
|
||||
except Exception, e:
|
||||
except Exception as e:
|
||||
logger.info("Could run run tshark check: " + str(e))
|
||||
cmd = None
|
||||
return None
|
||||
@ -88,7 +88,7 @@ def run_tshark(filename, filter, display=None, wait=True):
|
||||
if display is None: display = []
|
||||
try:
|
||||
return _run_tshark(filename, filter, display, wait)
|
||||
except UnknownFieldsException, e:
|
||||
except UnknownFieldsException as e:
|
||||
all_wlan_mgt = True
|
||||
for f in e.fields:
|
||||
if not f.startswith('wlan_mgt.'):
|
||||
@ -108,7 +108,7 @@ def run_tshark_json(filename, filter):
|
||||
try:
|
||||
cmd = subprocess.Popen(arg, stdout=subprocess.PIPE,
|
||||
stderr=subprocess.PIPE)
|
||||
except Exception, e:
|
||||
except Exception as e:
|
||||
logger.info("Could run run tshark: " + str(e))
|
||||
return None
|
||||
output = cmd.communicate()
|
||||
|
@ -142,7 +142,7 @@ class Wlantest:
|
||||
def get_bss_counter(self, field, bssid):
|
||||
try:
|
||||
res = self.cli_cmd(["get_bss_counter", field, bssid])
|
||||
except Exception, e:
|
||||
except Exception as e:
|
||||
return 0
|
||||
if "FAIL" in res:
|
||||
return 0
|
||||
|
@ -438,7 +438,7 @@ class WpaSupplicant:
|
||||
try:
|
||||
[name,value] = l.split('=', 1)
|
||||
vals[name] = value
|
||||
except ValueError, e:
|
||||
except ValueError as e:
|
||||
logger.info(self.ifname + ": Ignore unexpected STATUS line: " + l)
|
||||
return vals
|
||||
|
||||
@ -507,7 +507,7 @@ class WpaSupplicant:
|
||||
try:
|
||||
[name,value] = l.split('=', 1)
|
||||
vals[name] = value
|
||||
except ValueError, e:
|
||||
except ValueError as e:
|
||||
logger.info(self.ifname + ": Ignore unexpected MIB line: " + l)
|
||||
return vals
|
||||
|
||||
|
@ -265,7 +265,7 @@ def main():
|
||||
# lock devices
|
||||
try:
|
||||
get_devices(devices, duts, refs, monitors)
|
||||
except Exception, e:
|
||||
except Exception as e:
|
||||
logger.warning("get devices failed: " + str(e))
|
||||
logger.info(traceback.format_exc())
|
||||
put_devices(devices, duts, refs, monitors)
|
||||
@ -288,7 +288,7 @@ def main():
|
||||
logger.warning("RUN check_devices")
|
||||
try:
|
||||
check_devices(devices, setup_params, refs, duts, monitors)
|
||||
except Exception, e:
|
||||
except Exception as e:
|
||||
logger.warning("FAILED: " + str(e))
|
||||
logger.info(traceback.format_exc())
|
||||
put_devices(devices, duts, refs, monitors)
|
||||
@ -317,10 +317,10 @@ def main():
|
||||
except KeyboardInterrupt:
|
||||
put_devices(devices, duts, refs, monitors)
|
||||
raise
|
||||
except TestSkip, e:
|
||||
except TestSkip as e:
|
||||
end = datetime.now()
|
||||
logger.warning("SKIP (" + str(e) + ") - " + str((end - start).total_seconds()) + "s")
|
||||
except Exception, e:
|
||||
except Exception as e:
|
||||
end = datetime.now()
|
||||
logger.warning("FAILED (" + str(e) + ") - " + str((end - start).total_seconds()) + "s")
|
||||
logger.info(traceback.format_exc())
|
||||
@ -344,11 +344,11 @@ def main():
|
||||
except KeyboardInterrupt:
|
||||
put_devices(devices, duts, refs, monitors)
|
||||
raise
|
||||
except HwsimSkip,e:
|
||||
except HwsimSkip as e:
|
||||
end = datetime.now()
|
||||
logger.warning("SKIP (" + str(e) + ") - " + str((end - start).total_seconds()) + "s")
|
||||
failed.append(hwsim_test.__name__.replace('test_', '', 1))
|
||||
except Exception, e:
|
||||
except Exception as e:
|
||||
end = datetime.now()
|
||||
logger.warning("FAILED (" + str(e) + ") - " + str((end - start).total_seconds()) + "s")
|
||||
logger.info(traceback.format_exc())
|
||||
|
@ -24,7 +24,7 @@ def wpas_connect():
|
||||
if os.path.isdir(wpas_ctrl):
|
||||
try:
|
||||
ifaces = [os.path.join(wpas_ctrl, i) for i in os.listdir(wpas_ctrl)]
|
||||
except OSError, error:
|
||||
except OSError as error:
|
||||
print "Could not find wpa_supplicant: ", error
|
||||
return None
|
||||
|
||||
@ -36,7 +36,7 @@ def wpas_connect():
|
||||
try:
|
||||
wpas = wpaspy.Ctrl(ctrl)
|
||||
return wpas
|
||||
except Exception, e:
|
||||
except Exception as e:
|
||||
pass
|
||||
return None
|
||||
|
||||
|
@ -53,7 +53,7 @@ def wpas_connect():
|
||||
if os.path.isdir(wpas_ctrl):
|
||||
try:
|
||||
ifaces = [os.path.join(wpas_ctrl, i) for i in os.listdir(wpas_ctrl)]
|
||||
except OSError, error:
|
||||
except OSError as error:
|
||||
print "Could not find wpa_supplicant: ", error
|
||||
return None
|
||||
|
||||
@ -69,7 +69,7 @@ def wpas_connect():
|
||||
print "Trying to use control interface " + ctrl
|
||||
wpas = wpaspy.Ctrl(ctrl)
|
||||
return wpas
|
||||
except Exception, e:
|
||||
except Exception as e:
|
||||
pass
|
||||
return None
|
||||
|
||||
@ -169,7 +169,7 @@ def p2p_handover_client(llc):
|
||||
print "Handover request (pre-WPS):"
|
||||
try:
|
||||
print message.pretty()
|
||||
except Exception, e:
|
||||
except Exception as e:
|
||||
print e
|
||||
|
||||
data = wpas_get_handover_req_wps()
|
||||
@ -181,7 +181,7 @@ def p2p_handover_client(llc):
|
||||
print "Handover request:"
|
||||
try:
|
||||
print message.pretty()
|
||||
except Exception, e:
|
||||
except Exception as e:
|
||||
print e
|
||||
print str(message).encode("hex")
|
||||
|
||||
@ -194,7 +194,7 @@ def p2p_handover_client(llc):
|
||||
summary("Handover connection refused")
|
||||
client.close()
|
||||
return
|
||||
except Exception, e:
|
||||
except Exception as e:
|
||||
summary("Other exception: " + str(e))
|
||||
client.close()
|
||||
return
|
||||
@ -220,14 +220,14 @@ def p2p_handover_client(llc):
|
||||
print "Received message"
|
||||
try:
|
||||
print message.pretty()
|
||||
except Exception, e:
|
||||
except Exception as e:
|
||||
print e
|
||||
print str(message).encode("hex")
|
||||
message = nfc.ndef.HandoverSelectMessage(message)
|
||||
summary("Handover select received")
|
||||
try:
|
||||
print message.pretty()
|
||||
except Exception, e:
|
||||
except Exception as e:
|
||||
print e
|
||||
|
||||
for carrier in message.carriers:
|
||||
@ -286,7 +286,7 @@ class HandoverServer(nfc.handover.HandoverServer):
|
||||
print "HandoverServer - request received"
|
||||
try:
|
||||
print "Parsed handover request: " + request.pretty()
|
||||
except Exception, e:
|
||||
except Exception as e:
|
||||
print e
|
||||
|
||||
sel = nfc.ndef.HandoverSelectMessage(version="1.2")
|
||||
@ -302,7 +302,7 @@ class HandoverServer(nfc.handover.HandoverServer):
|
||||
print "Carrier record:"
|
||||
try:
|
||||
print carrier.record.pretty()
|
||||
except Exception, e:
|
||||
except Exception as e:
|
||||
print e
|
||||
data = wpas_get_handover_sel()
|
||||
if data is None:
|
||||
@ -332,7 +332,7 @@ class HandoverServer(nfc.handover.HandoverServer):
|
||||
print "Carrier record:"
|
||||
try:
|
||||
print carrier.record.pretty()
|
||||
except Exception, e:
|
||||
except Exception as e:
|
||||
print e
|
||||
data = wpas_get_handover_sel_wps()
|
||||
if data is None:
|
||||
@ -355,7 +355,7 @@ class HandoverServer(nfc.handover.HandoverServer):
|
||||
print "Handover select:"
|
||||
try:
|
||||
print sel.pretty()
|
||||
except Exception, e:
|
||||
except Exception as e:
|
||||
print e
|
||||
print str(sel).encode("hex")
|
||||
|
||||
@ -443,7 +443,7 @@ def wps_write_p2p_handover_sel(clf, wait_remove=True):
|
||||
print "Handover select:"
|
||||
try:
|
||||
print p2p_sel_data.pretty()
|
||||
except Exception, e:
|
||||
except Exception as e:
|
||||
print e
|
||||
print str(p2p_sel_data).encode("hex")
|
||||
|
||||
@ -459,7 +459,7 @@ def rdwr_connected(tag):
|
||||
print "NDEF tag: " + tag.type
|
||||
try:
|
||||
print tag.ndef.message.pretty()
|
||||
except Exception, e:
|
||||
except Exception as e:
|
||||
print e
|
||||
success = p2p_tag_read(tag)
|
||||
if only_one and success:
|
||||
@ -636,7 +636,7 @@ def main():
|
||||
'on-connect': llcp_connected},
|
||||
terminate=terminate_loop):
|
||||
break
|
||||
except Exception, e:
|
||||
except Exception as e:
|
||||
print "clf.connect failed"
|
||||
|
||||
global srv
|
||||
|
@ -118,7 +118,7 @@ class P2P_Connect():
|
||||
{'Ifname': ifname, 'Driver': 'test'})
|
||||
time.sleep(1)
|
||||
|
||||
except dbus.DBusException, exc:
|
||||
except dbus.DBusException as exc:
|
||||
if not str(exc).startswith(
|
||||
self.wpas_dbus_interface + \
|
||||
".InterfaceExists:"):
|
||||
@ -209,7 +209,7 @@ class P2P_Connect():
|
||||
result_pin = self.p2p_interface.Connect(
|
||||
self.p2p_connect_arguements)
|
||||
|
||||
except dbus.DBusException, exc:
|
||||
except dbus.DBusException as exc:
|
||||
raise exc
|
||||
|
||||
if (self.wps_method == 'pin' and \
|
||||
|
@ -81,7 +81,7 @@ class P2P_Disconnect (threading.Thread):
|
||||
try:
|
||||
self.path = self.wpas.GetInterface(
|
||||
self.interface_name)
|
||||
except dbus.DBusException, exc:
|
||||
except dbus.DBusException as exc:
|
||||
error = 'Error:\n Interface ' + self.interface_name \
|
||||
+ ' was not found'
|
||||
print error
|
||||
|
@ -85,7 +85,7 @@ class P2P_Find (threading.Thread):
|
||||
try:
|
||||
self.path = self.wpas.GetInterface(
|
||||
self.interface_name)
|
||||
except dbus.DBusException, exc:
|
||||
except dbus.DBusException as exc:
|
||||
error = 'Error:\n Interface ' + self.interface_name \
|
||||
+ ' was not found'
|
||||
print error
|
||||
|
@ -81,7 +81,7 @@ class P2P_Flush (threading.Thread):
|
||||
try:
|
||||
self.path = self.wpas.GetInterface(
|
||||
self.interface_name)
|
||||
except dbus.DBusException, exc:
|
||||
except dbus.DBusException as exc:
|
||||
error = 'Error:\n Interface ' + self.interface_name \
|
||||
+ ' was not found'
|
||||
print error
|
||||
|
@ -99,7 +99,7 @@ class P2P_Group_Add (threading.Thread):
|
||||
try:
|
||||
self.path = self.wpas.GetInterface(
|
||||
self.interface_name)
|
||||
except dbus.DBusException, exc:
|
||||
except dbus.DBusException as exc:
|
||||
error = 'Error:\n Interface ' + self.interface_name \
|
||||
+ ' was not found'
|
||||
print error
|
||||
|
@ -96,7 +96,7 @@ class P2P_Invite (threading.Thread):
|
||||
try:
|
||||
self.path = self.wpas.GetInterface(
|
||||
self.interface_name)
|
||||
except dbus.DBusException, exc:
|
||||
except dbus.DBusException as exc:
|
||||
error = 'Error:\n Interface ' + self.interface_name \
|
||||
+ ' was not found'
|
||||
print error
|
||||
|
@ -82,7 +82,7 @@ class P2P_Listen(threading.Thread):
|
||||
try:
|
||||
self.path = self.wpas.GetInterface(
|
||||
self.interface_name)
|
||||
except dbus.DBusException, exc:
|
||||
except dbus.DBusException as exc:
|
||||
error = 'Error:\n Interface ' + self.interface_name \
|
||||
+ ' was not found'
|
||||
print error
|
||||
|
@ -83,7 +83,7 @@ class P2P_Stop_Find (threading.Thread):
|
||||
try:
|
||||
self.path = self.wpas.GetInterface(
|
||||
self.interface_name)
|
||||
except dbus.DBusException, exc:
|
||||
except dbus.DBusException as exc:
|
||||
error = 'Error:\n Interface ' + self.interface_name \
|
||||
+ ' was not found'
|
||||
print error
|
||||
|
@ -123,14 +123,14 @@ def main():
|
||||
path = None
|
||||
try:
|
||||
path = wpas.GetInterface(ifname)
|
||||
except dbus.DBusException, exc:
|
||||
except dbus.DBusException as exc:
|
||||
if not str(exc).startswith("fi.w1.wpa_supplicant1.InterfaceUnknown:"):
|
||||
raise exc
|
||||
try:
|
||||
path = wpas.CreateInterface({'Ifname': ifname, 'Driver': 'test'})
|
||||
time.sleep(1)
|
||||
|
||||
except dbus.DBusException, exc:
|
||||
except dbus.DBusException as exc:
|
||||
if not str(exc).startswith("fi.w1.wpa_supplicant1.InterfaceExists:"):
|
||||
raise exc
|
||||
|
||||
|
@ -37,12 +37,12 @@ def main():
|
||||
path = None
|
||||
try:
|
||||
path = wpas.getInterface(ifname)
|
||||
except dbus.dbus_bindings.DBusException, exc:
|
||||
except dbus.dbus_bindings.DBusException as exc:
|
||||
if str(exc) != "wpa_supplicant knows nothing about this interface.":
|
||||
raise exc
|
||||
try:
|
||||
path = wpas.addInterface(ifname, {'driver': dbus.Variant('wext')})
|
||||
except dbus.dbus_bindings.DBusException, exc:
|
||||
except dbus.dbus_bindings.DBusException as exc:
|
||||
if str(exc) != "wpa_supplicant already controls this interface.":
|
||||
raise exc
|
||||
|
||||
|
@ -46,7 +46,7 @@ def wpas_connect():
|
||||
if os.path.isdir(wpas_ctrl):
|
||||
try:
|
||||
ifaces = [os.path.join(wpas_ctrl, i) for i in os.listdir(wpas_ctrl)]
|
||||
except OSError, error:
|
||||
except OSError as error:
|
||||
print "Could not find wpa_supplicant: ", error
|
||||
return None
|
||||
|
||||
@ -58,7 +58,7 @@ def wpas_connect():
|
||||
try:
|
||||
wpas = wpaspy.Ctrl(ctrl)
|
||||
return wpas
|
||||
except Exception, e:
|
||||
except Exception as e:
|
||||
pass
|
||||
return None
|
||||
|
||||
@ -164,7 +164,7 @@ class HandoverServer(nfc.handover.HandoverServer):
|
||||
summary("HandoverServer - request received")
|
||||
try:
|
||||
print "Parsed handover request: " + request.pretty()
|
||||
except Exception, e:
|
||||
except Exception as e:
|
||||
print e
|
||||
|
||||
sel = nfc.ndef.HandoverSelectMessage(version="1.2")
|
||||
@ -191,7 +191,7 @@ class HandoverServer(nfc.handover.HandoverServer):
|
||||
print "Handover select:"
|
||||
try:
|
||||
print sel.pretty()
|
||||
except Exception, e:
|
||||
except Exception as e:
|
||||
print e
|
||||
print str(sel).encode("hex")
|
||||
|
||||
@ -217,7 +217,7 @@ def wps_handover_init(llc):
|
||||
print "Handover request:"
|
||||
try:
|
||||
print message.pretty()
|
||||
except Exception, e:
|
||||
except Exception as e:
|
||||
print e
|
||||
print str(message).encode("hex")
|
||||
|
||||
@ -230,7 +230,7 @@ def wps_handover_init(llc):
|
||||
summary("Handover connection refused")
|
||||
client.close()
|
||||
return
|
||||
except Exception, e:
|
||||
except Exception as e:
|
||||
summary("Other exception: " + str(e))
|
||||
client.close()
|
||||
return
|
||||
@ -256,14 +256,14 @@ def wps_handover_init(llc):
|
||||
print "Received message"
|
||||
try:
|
||||
print message.pretty()
|
||||
except Exception, e:
|
||||
except Exception as e:
|
||||
print e
|
||||
print str(message).encode("hex")
|
||||
message = nfc.ndef.HandoverSelectMessage(message)
|
||||
summary("Handover select received")
|
||||
try:
|
||||
print message.pretty()
|
||||
except Exception, e:
|
||||
except Exception as e:
|
||||
print e
|
||||
|
||||
for carrier in message.carriers:
|
||||
@ -376,7 +376,7 @@ def rdwr_connected(tag):
|
||||
print "NDEF tag: " + tag.type
|
||||
try:
|
||||
print tag.ndef.message.pretty()
|
||||
except Exception, e:
|
||||
except Exception as e:
|
||||
print e
|
||||
success = wps_tag_read(tag, not only_one)
|
||||
if only_one and success:
|
||||
@ -507,7 +507,7 @@ def main():
|
||||
'on-connect': llcp_connected},
|
||||
terminate=terminate_loop):
|
||||
break
|
||||
except Exception, e:
|
||||
except Exception as e:
|
||||
print "clf.connect failed"
|
||||
|
||||
global srv
|
||||
|
@ -27,7 +27,7 @@ def wpas_connect(host=None, port=9877):
|
||||
if os.path.isdir(wpas_ctrl):
|
||||
try:
|
||||
ifaces = [os.path.join(wpas_ctrl, i) for i in os.listdir(wpas_ctrl)]
|
||||
except OSError, error:
|
||||
except OSError as error:
|
||||
print "Could not find wpa_supplicant: ", error
|
||||
return None
|
||||
|
||||
@ -39,7 +39,7 @@ def wpas_connect(host=None, port=9877):
|
||||
try:
|
||||
wpas = wpaspy.Ctrl(ctrl)
|
||||
return wpas
|
||||
except Exception, e:
|
||||
except Exception as e:
|
||||
pass
|
||||
return None
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user