Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adopt ESP32 test driver to pw_unit_test output #34114

Merged
merged 8 commits into from
Jul 1, 2024
29 changes: 15 additions & 14 deletions src/test_driver/esp32/run_qemu_image.py
Original file line number Diff line number Diff line change
Expand Up @@ -106,31 +106,32 @@ def main(log_level, no_log_timestamps, image, file_image_list, qemu, verbose):

# Parse output of the unit test. Generally expect things like:
# I (3034) CHIP-tests: Starting CHIP tests!
# INF [==========] Running all tests.
# INF [ RUN ] TestASN1.NullWriter
# INF [ OK ] TestASN1.NullWriter
# ...
# Various test lines, none ending with "] : FAILED"
# ...
# Failed Tests: 0 / 5
# Failed Asserts: 0 / 77
# I (3034) CHIP-tests: CHIP test status: 0
# INF [ RUN ] TestASN1.ASN1UniversalTime
# ERR src/lib/asn1/tests/TestASN1.cpp:366: Failure
# ERR Expected: 1 == 5
# ERR Actual: 1 == 5
# ERR [ FAILED ] TestASN1.ASN1UniversalTime
# INF [==========] Done running all tests.
# INF [ PASSED ] 5 test(s).
# ERR [ FAILED ] 1 test(s).
# I (3034) CHIP-tests: CHIP test status: 1
in_test = False
for line in output.split('\n'):
if line.endswith('CHIP-tests: Starting CHIP tests!'):
if 'CHIP-tests: Starting CHIP tests!' in line:
in_test = True

if line.startswith('Failed Tests:') and not line.startswith('Failed Tests: 0 /'):
raise Exception("Tests seem failed: %s" % line)

if line.startswith('Failed Asserts:') and not line.startswith('Failed Asserts: 0 /'):
raise Exception("Asserts seem failed: %s" % line)

if 'CHIP-tests: CHIP test status: 0' in line:
in_test = False
elif 'CHIP-tests: CHIP test status: ' in line:
raise Exception("CHIP test status is NOT 0: %s" % line)

# Ignore FAILED messages not in the middle of a test, to reduce
# the chance of false posisitves from other logging.
if in_test and re.match('.*] : FAILED$', line):
# the chance of false positives from other logging.
if in_test and re.search(r' \[ FAILED \] ', line):
raise Exception("Step failed: %s" % line)

# TODO: Figure out why exit(0) in man_app.cpp's tester_task is aborting and fix that.
Expand Down
Loading