Change how tempest debug logs are displayed
This commit cleans up how tempest failure logs are displayed. We'll no longer dump the failure information to the console as a test fails. Instead all the failure logs will be printed after the tests are run. Change-Id: I7ecdc349d913b43f4fb0505d5c17c66f811774b4
This commit is contained in:
parent
dfbceca69b
commit
1d5f32b48e
@ -3,4 +3,4 @@
|
|||||||
set -o pipefail
|
set -o pipefail
|
||||||
|
|
||||||
TESTRARGS=$1
|
TESTRARGS=$1
|
||||||
python setup.py testr --slowest --testr-args="--subunit $TESTRARGS" | $(dirname $0)/subunit-trace.py
|
python setup.py testr --slowest --testr-args="--subunit $TESTRARGS" | $(dirname $0)/subunit-trace.py --no-failure-debug -f
|
||||||
|
@ -7,7 +7,8 @@ TESTRARGS=$@
|
|||||||
if [ ! -d .testrepository ]; then
|
if [ ! -d .testrepository ]; then
|
||||||
testr init
|
testr init
|
||||||
fi
|
fi
|
||||||
testr run --subunit $TESTRARGS | $(dirname $0)/subunit-trace.py
|
testr run --subunit $TESTRARGS | $(dirname $0)/subunit-trace.py -f -n
|
||||||
retval=$?
|
retval=$?
|
||||||
testr slowest
|
testr slowest
|
||||||
|
|
||||||
exit $retval
|
exit $retval
|
||||||
|
@ -18,6 +18,7 @@
|
|||||||
|
|
||||||
"""Trace a subunit stream in reasonable detail and high accuracy."""
|
"""Trace a subunit stream in reasonable detail and high accuracy."""
|
||||||
|
|
||||||
|
import argparse
|
||||||
import functools
|
import functools
|
||||||
import re
|
import re
|
||||||
import sys
|
import sys
|
||||||
@ -151,7 +152,7 @@ def print_attachments(stream, test, all_channels=False):
|
|||||||
stream.write(" %s\n" % line)
|
stream.write(" %s\n" % line)
|
||||||
|
|
||||||
|
|
||||||
def show_outcome(stream, test):
|
def show_outcome(stream, test, print_failures=False):
|
||||||
global RESULTS
|
global RESULTS
|
||||||
status = test['status']
|
status = test['status']
|
||||||
# TODO(sdague): ask lifeless why on this?
|
# TODO(sdague): ask lifeless why on this?
|
||||||
@ -178,14 +179,16 @@ def show_outcome(stream, test):
|
|||||||
FAILS.append(test)
|
FAILS.append(test)
|
||||||
stream.write('{%s} %s [%s] ... FAILED\n' % (
|
stream.write('{%s} %s [%s] ... FAILED\n' % (
|
||||||
worker, name, duration))
|
worker, name, duration))
|
||||||
print_attachments(stream, test, all_channels=True)
|
if not print_failures:
|
||||||
|
print_attachments(stream, test, all_channels=True)
|
||||||
elif status == 'skip':
|
elif status == 'skip':
|
||||||
stream.write('{%s} %s ... SKIPPED: %s\n' % (
|
stream.write('{%s} %s ... SKIPPED: %s\n' % (
|
||||||
worker, name, test['details']['reason'].as_text()))
|
worker, name, test['details']['reason'].as_text()))
|
||||||
else:
|
else:
|
||||||
stream.write('{%s} %s [%s] ... %s\n' % (
|
stream.write('{%s} %s [%s] ... %s\n' % (
|
||||||
worker, name, duration, test['status']))
|
worker, name, duration, test['status']))
|
||||||
print_attachments(stream, test, all_channels=True)
|
if not print_failures:
|
||||||
|
print_attachments(stream, test, all_channels=True)
|
||||||
|
|
||||||
stream.flush()
|
stream.flush()
|
||||||
|
|
||||||
@ -247,12 +250,25 @@ def print_summary(stream):
|
|||||||
(w, num, time))
|
(w, num, time))
|
||||||
|
|
||||||
|
|
||||||
|
def parse_args():
|
||||||
|
parser = argparse.ArgumentParser()
|
||||||
|
parser.add_argument('--no-failure-debug', '-n', action='store_true',
|
||||||
|
dest='print_failures', help='Disable printing failure '
|
||||||
|
'debug infomation in realtime')
|
||||||
|
parser.add_argument('--fails', '-f', action='store_true',
|
||||||
|
dest='post_fails', help='Print failure debug '
|
||||||
|
'information after the stream is proccesed')
|
||||||
|
return parser.parse_args()
|
||||||
|
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
|
args = parse_args()
|
||||||
stream = subunit.ByteStreamToStreamResult(
|
stream = subunit.ByteStreamToStreamResult(
|
||||||
sys.stdin, non_subunit_name='stdout')
|
sys.stdin, non_subunit_name='stdout')
|
||||||
starts = Starts(sys.stdout)
|
starts = Starts(sys.stdout)
|
||||||
outcomes = testtools.StreamToDict(
|
outcomes = testtools.StreamToDict(
|
||||||
functools.partial(show_outcome, sys.stdout))
|
functools.partial(show_outcome, sys.stdout,
|
||||||
|
print_failures=args.print_failures))
|
||||||
summary = testtools.StreamSummary()
|
summary = testtools.StreamSummary()
|
||||||
result = testtools.CopyStreamResult([starts, outcomes, summary])
|
result = testtools.CopyStreamResult([starts, outcomes, summary])
|
||||||
result.startTestRun()
|
result.startTestRun()
|
||||||
@ -260,6 +276,8 @@ def main():
|
|||||||
stream.run(result)
|
stream.run(result)
|
||||||
finally:
|
finally:
|
||||||
result.stopTestRun()
|
result.stopTestRun()
|
||||||
|
if args.post_fails:
|
||||||
|
print_fails(sys.stdout)
|
||||||
print_summary(sys.stdout)
|
print_summary(sys.stdout)
|
||||||
return (0 if summary.wasSuccessful() else 1)
|
return (0 if summary.wasSuccessful() else 1)
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user