tests: Use logger.info() instead of print to get one stream
print and logger.info() were directing output to different locations (stdout and stderr, respectively) which resulted in buildbot showing reordered entries. Use logger consistently to avoid that. Signed-hostap: Jouni Malinen <j@w1.fi>
This commit is contained in:
parent
4896ddaea1
commit
3ed2814a1e
2 changed files with 19 additions and 19 deletions
|
@ -24,8 +24,8 @@ def test_connectivity(ifname1, ifname2):
|
|||
s = subprocess.check_output(cmd)
|
||||
logger.debug(s)
|
||||
except subprocess.CalledProcessError, e:
|
||||
print "hwsim failed: " + str(e.returncode)
|
||||
print e.output
|
||||
logger.info("hwsim failed: " + str(e.returncode))
|
||||
logger.info(e.output)
|
||||
raise
|
||||
|
||||
def test_connectivity_p2p(dev1, dev2):
|
||||
|
|
|
@ -12,6 +12,7 @@ import sys
|
|||
import time
|
||||
|
||||
import logging
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
from wpasupplicant import WpaSupplicant
|
||||
from hostapd import HostapdGlobal
|
||||
|
@ -59,11 +60,11 @@ def main():
|
|||
|
||||
for d in dev:
|
||||
if not d.ping():
|
||||
print d.ifname + ": No response from wpa_supplicant"
|
||||
logger.info(d.ifname + ": No response from wpa_supplicant")
|
||||
return
|
||||
print "DEV: " + d.ifname + ": " + d.p2p_dev_addr()
|
||||
logger.info("DEV: " + d.ifname + ": " + d.p2p_dev_addr())
|
||||
for ap in apdev:
|
||||
print "APDEV: " + ap['ifname']
|
||||
logger.info("APDEV: " + ap['ifname'])
|
||||
|
||||
tests = []
|
||||
for t in os.listdir("."):
|
||||
|
@ -71,7 +72,7 @@ def main():
|
|||
if m:
|
||||
if test_file and test_file not in t:
|
||||
continue
|
||||
print "Import test cases from " + t
|
||||
logger.info("Import test cases from " + t)
|
||||
mod = __import__(m.group(1))
|
||||
for s in dir(mod):
|
||||
if s.startswith("test_"):
|
||||
|
@ -86,46 +87,45 @@ def main():
|
|||
if test_filter != t.__name__:
|
||||
continue
|
||||
reset_devs(dev, apdev)
|
||||
print "START " + t.__name__
|
||||
logger.info("START " + t.__name__)
|
||||
if t.__doc__:
|
||||
print "Test: " + t.__doc__
|
||||
logger.info("Test: " + t.__doc__)
|
||||
for d in dev:
|
||||
try:
|
||||
d.request("NOTE TEST-START " + t.__name__)
|
||||
except Exception, e:
|
||||
print "Failed to issue TEST-START before " + t.__name__ + " for " + d.ifname
|
||||
print e
|
||||
logger.info("Failed to issue TEST-START before " + t.__name__ + " for " + d.ifname)
|
||||
logger.info(e)
|
||||
try:
|
||||
if t.func_code.co_argcount > 1:
|
||||
t(dev, apdev)
|
||||
else:
|
||||
t(dev)
|
||||
passed.append(t.__name__)
|
||||
print "PASS " + t.__name__
|
||||
logger.info("PASS " + t.__name__)
|
||||
except Exception, e:
|
||||
print e
|
||||
logger.info(e)
|
||||
failed.append(t.__name__)
|
||||
print "FAIL " + t.__name__
|
||||
logger.info("FAIL " + t.__name__)
|
||||
for d in dev:
|
||||
try:
|
||||
d.request("NOTE TEST-STOP " + t.__name__)
|
||||
except Exception, e:
|
||||
print "Failed to issue TEST-STOP after " + t.__name__ + " for " + d.ifname
|
||||
print e
|
||||
logger.info("Failed to issue TEST-STOP after " + t.__name__ + " for " + d.ifname)
|
||||
logger.info(e)
|
||||
|
||||
if not test_filter:
|
||||
reset_devs(dev, apdev)
|
||||
|
||||
print
|
||||
if len(failed):
|
||||
print "passed " + str(len(passed)) + " test case(s)"
|
||||
print "failed tests: " + str(failed)
|
||||
logger.info("passed " + str(len(passed)) + " test case(s)")
|
||||
logger.info("failed tests: " + str(failed))
|
||||
if error_file:
|
||||
f = open(error_file, 'w')
|
||||
f.write(str(failed) + '\n')
|
||||
f.close()
|
||||
sys.exit(1)
|
||||
print "passed all " + str(len(passed)) + " test case(s)"
|
||||
logger.info("passed all " + str(len(passed)) + " test case(s)")
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
|
|
Loading…
Reference in a new issue