test: do not let one bad byte take down the whole test run #36850

pull xanimo wants to merge 1 commits into bitcoin:master from xanimo:test/runner-decode-replace changing 2 files +29 −1
  1. xanimo commented at 4:27 AM on November 13, 2026: none

    the runner decodes each finished test's stdout and stderr strictly. nodes inherit the test process's stderr, so a node that aborts can put raw bytes there, and the decode raises UnicodeDecodeError inside TestHandler.get_next(). that takes the whole run down before it reports which test produced them, so what you see is a traceback in the runner and the real cause is invisible.

    moves the decode into read_captured_output() and decodes with errors='replace'. the pass criterion is untouched: a test with anything on stderr still fails, it just gets named now.

    reproduced on master with a scratch test writing b"Assertion failed\x80\x81 at 0x7f\n" to stderr and exiting 1:

    before
      UnicodeDecodeError: 'utf-8' codec can't decode byte 0x80 in position 16: invalid start byte
      (no results table at all)
    
    after
      feature_zzzbadbyte.py | ✖ Failed | 0 s
      Assertion failed<replacement chars> at 0x7f
    

    two unit tests cover the helper. feature_framework_unit_tests.py previously loaded only test_framework modules, so it now also loads test_runner by name, 33 tests instead of 31. restoring the strict decode fails test_captured_output_survives_undecodable_bytes with the same UnicodeDecodeError the runner used to die on.

    found while chasing a real failure on a debug build of a downstream fork, where a node died and the run reported a decode error instead of naming the test. this does not prevent that failure, it only makes it diagnosable in one step instead of several.

    litecoin carries the same line, and dogecoin's older copy of this runner does too.

  2. test: do not let one bad byte take down the whole test run
    The runner decodes each finished test's stdout and stderr strictly.
    Nodes inherit the test process's stderr, so a node that aborts can put
    raw bytes there, and the decode raises UnicodeDecodeError inside
    TestHandler.get_next(). That aborts the entire run before it reports
    which test produced them, so the visible failure is a traceback in the
    runner and the real cause is invisible.
    
    Moves the decode into read_captured_output() and decodes with
    errors='replace'. The pass criterion is untouched: a test with anything
    on stderr still fails, it just gets named now.
    
    Two unit tests cover the helper, reached through
    feature_framework_unit_tests.py, which did not previously load anything
    outside test_framework. Restoring the strict decode fails
    test_captured_output_survives_undecodable_bytes with the same
    UnicodeDecodeError the runner used to die on.
    d468d807a1
  3. DrahtBot added the label Tests on Nov 13, 2026
  4. DrahtBot commented at 4:27 AM on November 13, 2026: contributor

    <!--e57a25ab6845829454e8d69fc972939a-->

    The following sections might be updated with supplementary metadata relevant to reviewers and maintainers.

    <!--006a51241073e994b41acfe9ec718e94-->

    External sites

    <!--021abf342d371248e50ceaed478a90ca-->

    Reviews

    See the guideline and AI policy for information on the review process. A summary of reviews will appear here.

    <!--5faf32d7da4f0f540f40219e4f7537a3-->

  5. maflcko commented at 6:14 AM on November 13, 2026: member

    internal_abort_helper writes are atomic, and the others should be as well, so this can't happen in reality. (Maybe if two threads are racing an abort, but this should be cosmically rare anyway)

  6. xanimo commented at 7:57 AM on November 13, 2026: none

    internal_abort_helper writes are atomic, and the others should be as well, so this can't happen in reality. (Maybe if two threads are racing an abort, but this should be cosmically rare anyway)

    closing. the abort path is right and it is not where this came from, and i do not have an occurrence on this ci. keeping it downstream where it did.

  7. xanimo closed this on Nov 13, 2026

Labels

github-metadata-mirror

This is a metadata mirror of the GitHub repository bitcoin/bitcoin. This site is not affiliated with GitHub. Content is generated from a GitHub metadata backup.
generated: 2026-11-18 16:51 UTC

This site is hosted by @0xB10C
More mirrored repositories can be found on mirror.b10c.me