tests: Add test duration and time to PASS/FAIL reports
Signed-hostap: Jouni Malinen <j@w1.fi>
This commit is contained in:
parent
8d0825d655
commit
1fc114a16a
1 changed files with 11 additions and 4 deletions
|
@ -10,6 +10,7 @@ import os
|
||||||
import re
|
import re
|
||||||
import sys
|
import sys
|
||||||
import time
|
import time
|
||||||
|
from datetime import datetime
|
||||||
|
|
||||||
import logging
|
import logging
|
||||||
logger = logging.getLogger(__name__)
|
logger = logging.getLogger(__name__)
|
||||||
|
@ -24,6 +25,7 @@ def reset_devs(dev, apdev):
|
||||||
d.reset()
|
d.reset()
|
||||||
except Exception, e:
|
except Exception, e:
|
||||||
logger.info("Failed to reset device " + d.ifname)
|
logger.info("Failed to reset device " + d.ifname)
|
||||||
|
print str(e)
|
||||||
for ap in apdev:
|
for ap in apdev:
|
||||||
hapd.remove(ap['ifname'])
|
hapd.remove(ap['ifname'])
|
||||||
|
|
||||||
|
@ -100,6 +102,7 @@ def main():
|
||||||
print "START " + t.__name__
|
print "START " + t.__name__
|
||||||
if t.__doc__:
|
if t.__doc__:
|
||||||
logger.info("Test: " + t.__doc__)
|
logger.info("Test: " + t.__doc__)
|
||||||
|
start = datetime.now()
|
||||||
for d in dev:
|
for d in dev:
|
||||||
try:
|
try:
|
||||||
d.request("NOTE TEST-START " + t.__name__)
|
d.request("NOTE TEST-START " + t.__name__)
|
||||||
|
@ -112,15 +115,19 @@ def main():
|
||||||
else:
|
else:
|
||||||
t(dev)
|
t(dev)
|
||||||
passed.append(t.__name__)
|
passed.append(t.__name__)
|
||||||
logger.info("PASS " + t.__name__)
|
end = datetime.now()
|
||||||
|
diff = end - start
|
||||||
|
logger.info("PASS " + t.__name__ + " " + str(diff.total_seconds()) + " " + str(end))
|
||||||
if log_file:
|
if log_file:
|
||||||
print "PASS " + t.__name__
|
print "PASS " + t.__name__ + " " + str(diff.total_seconds()) + " " + str(end)
|
||||||
except Exception, e:
|
except Exception, e:
|
||||||
|
end = datetime.now()
|
||||||
|
diff = end - start
|
||||||
logger.info(e)
|
logger.info(e)
|
||||||
failed.append(t.__name__)
|
failed.append(t.__name__)
|
||||||
logger.info("FAIL " + t.__name__)
|
logger.info("FAIL " + t.__name__ + " " + str(diff.total_seconds()) + " " + str(end))
|
||||||
if log_file:
|
if log_file:
|
||||||
print "FAIL " + t.__name__
|
print "FAIL " + t.__name__ + " " + str(diff.total_seconds()) + " " + str(end)
|
||||||
for d in dev:
|
for d in dev:
|
||||||
try:
|
try:
|
||||||
d.request("NOTE TEST-STOP " + t.__name__)
|
d.request("NOTE TEST-STOP " + t.__name__)
|
||||||
|
|
Loading…
Reference in a new issue