try:
d.reset()
except Exception as e:
- logger.info("Failed to reset device " + d.ifname)
- print(str(e))
+ logger.exception("Failed to reset device " + d.ifname)
ok = False
wpas = None
hapd.remove(iface)
hapd.remove('as-erp')
except Exception as e:
- logger.info("Failed to remove hostapd interface")
- print(str(e))
+ logger.exception("Failed to remove hostapd interface")
ok = False
return ok
conn.execute(sql, params)
conn.commit()
except Exception as e:
- print("sqlite: " + str(e))
- print("sql: %r" % (params, ))
+ logger.exception("sqlite:")
+ logger.error("sql: %r" % (params, ))
def report(conn, prefill, build, commit, run, test, result, duration, logdir,
sql_commit=True):
if sql_commit:
conn.commit()
except Exception as e:
- print("sqlite: " + str(e))
- print("sql: %r" % (params, ))
+ logger.exception("sqlite:")
+ logger.error("sql: %r" % (params, ))
if result == "FAIL":
for log in ["log", "log0", "log1", "log2", "log3", "log5",
dev.relog()
subprocess.call(['chown', '-f', getpass.getuser(), srcname])
except Exception as e:
- logger.info("Failed to rename log files")
- logger.info(e)
+ logger.exception("Failed to rename log files")
def is_long_duration_test(t):
return hasattr(t, "long_duration_test") and t.long_duration_test
try:
conn.execute(sql, params)
except Exception as e:
- print("sqlite: " + str(e))
- print("sql: %r" % (params,))
+ logger.exception("sqlite:")
+ logger.error("sql: %r" % (params,))
if conn:
conn.commit()
conn.close()
raise Exception("Global PING failed for {}".format(d.ifname))
d.request("NOTE TEST-START " + name)
except Exception as e:
- logger.info("Failed to issue TEST-START before " + name + " for " + d.ifname)
- logger.info(e)
+ logger.exception("Failed to issue TEST-START before " + name + " for " + d.ifname)
print("FAIL " + name + " - could not start test")
if conn:
conn.close()
logger.info("Skip test case: %s" % e)
skip_reason = e
result = "SKIP"
- except NameError as e:
- import traceback
- logger.info(e)
- traceback.print_exc()
- result = "FAIL"
except Exception as e:
- import traceback
- logger.info(e)
- traceback.print_exc()
- if args.loglevel == logging.WARNING:
- print("Exception: " + str(e))
+ logger.exception(f"Exception during test execution: {str(e)}")
result = "FAIL"
# Work around some objects having __del__, we really should
d.dump_monitor()
d.request("NOTE TEST-STOP " + name)
except Exception as e:
- logger.info("Failed to issue TEST-STOP after {} for {}".format(name, d.ifname))
- logger.info(e)
+ logger.exception("Failed to issue TEST-STOP after {} for {}".format(name, d.ifname))
result = "FAIL"
if args.no_reset:
print("Leaving devices in current state")
try:
hapd = HostapdGlobal()
except Exception as e:
- print("Failed to connect to hostapd interface")
- print(str(e))
+ logger.exception("Failed to connect to hostapd interface")
reset_ok = False
result = "FAIL"
hapd = None