twister: Remove newline suffix in BinaryHandler

Simics converts newline characters when writing console output to
stdout, so we need to remove them as a suffix string. Otherwise the
console harness fails to match expected PASS/FAIL/RunID string patterns
and twister tests timeout.

Signed-off-by: Maureen Helm <maureen.helm@intel.com>
This commit is contained in:
Maureen Helm 2023-05-02 17:00:30 -05:00 committed by Anas Nashif
commit 6a6d05b941

View file

@ -203,7 +203,7 @@ class BinaryHandler(Handler):
reader_t.join(this_timeout)
if not reader_t.is_alive() and self.line != b"":
line_decoded = self.line.decode('utf-8', "replace")
stripped_line = line_decoded.rstrip()
stripped_line = line_decoded.rstrip().removesuffix('\\r\\n')
logger.debug("OUTPUT: %s", stripped_line)
log_out_fp.write(line_decoded)
log_out_fp.flush()