test/py: drain console log at the end of any failed test

Tests may fail for a number of reasons, and in particular for reasons
other than a timeout waiting for U-Boot to print expected data. If the
last operation that a failed test performs is not waiting for U-Boot to
print something, then any trailing output from U-Boot during that test's
operation will not be logged as part of that test, but rather either
along with the next test, or even thrown away, potentiall hiding clues
re: the test failure reason.

Solve this by explicitly draining (and hence logging) the U-Boot output
in the case of failed tests.

Signed-off-by: Stephen Warren <swarren@nvidia.com>
Acked-by: Simon Glass <sjg@chromium.org>
This commit is contained in:
Stephen Warren 2016-01-22 12:30:09 -07:00 committed by Simon Glass
parent 636f38d83a
commit c10eb9d39f
2 changed files with 39 additions and 0 deletions

View file

@ -386,6 +386,7 @@ def pytest_runtest_protocol(item, nextitem):
skipped = report
if failed:
console.drain_console()
tests_failed.add(item.name)
elif skipped:
tests_skipped.add(item.name)