Unit test runner shows PASSED in summary when there are failing tests
I'm seeing the summary showing as passing when there are failures. Many tests pass, then there's a few failures, and my end-of-test summary looks like this (most names are removed for brevity):
...
test/test_math/test_main.cpp:518:PASS
test/test_math/test_main.cpp:519:PASS
test/test_math/test_main.cpp:520:PASS
test/test_math/test_main.cpp:521:PASS
test/test_math/test_main.cpp:522:PASS
test/test_math/test_main.cpp:414:FAIL
test/test_math/test_main.cpp:414:FAIL
test/test_math/test_main.cpp:414:FAIL
test/test_math/test_main.cpp:414:FAIL
test/test_math/test_main.cpp:414:FAIL
test/test_math/test_main.cpp:414:FAIL
test/test_math/test_main.cpp:529:PASS
test/test_math/test_main.cpp:530:PASS
test/test_math/test_main.cpp:531:PASS
...
-----------------------
91 Tests 6 Failures 0 Ignored
FAIL
The final summary shows PASSED.
I responded to the following issue, but I don't think this is Teensy-specific: https://github.com/platformio/platform-teensy/issues/68
Note that the summary also shows "SKIPPED", even when a test ran with some duration and passed. For example:
teensy41 test_math SKIPPED 00:00:31.206
Note: I usually run with pio test -v.
I've identified and fixed the issue!
Root Cause:
In platformio/test/cli.py line 201, the print_suite_footer function was hardcoding "PASSED" for any non-error test status. This caused SKIPPED test suites to incorrectly display as PASSED.
The Fix:
Changed to use the actual test_suite.status.name with appropriate color coding via status.to_ansi_color(). Now the footer correctly displays the actual test execution result (PASSED, FAILED, ERRORED, or SKIPPED).
PR: #5302
I've tested this with multiple test scenarios and verified it works correctly for all status types.