Searched hist:cdad03b7 (Results 1 – 1 of 1) sorted by relevance
/openbmc/qemu/tests/functional/qemu_test/ |
H A D | cmd.py | cdad03b7 Thu Nov 21 10:57:42 CST 2024 Daniel P. Berrangé <berrange@redhat.com> tests/functional: rewrite console handling to be bytewise
The console interaction that waits for predicted strings uses readline(), and thus is only capable of waiting for strings that are followed by a newline.
This is inconvenient when needing to match on some things, particularly login prompts, or shell prompts, causing tests to use time.sleep(...) instead, which is unreliable.
Switch to reading the console 1 byte at a time, comparing against the success/failure messages until we see a match, regardless of whether a newline is encountered.
The success/failure comparisons are done with the python bytes type, rather than strings, to avoid the problem of needing to decode partially received multibyte utf8 characters.
Heavily inspired by a patch proposed by Cédric, but written again to work in bytes, rather than strings.
Co-developed-by: Cédric Le Goater <clg@redhat.com> Signed-off-by: Daniel P. Berrangé <berrange@redhat.com> Message-Id: <20241121154218.1423005-16-berrange@redhat.com> Signed-off-by: Alex Bennée <alex.bennee@linaro.org> Message-Id: <20241121165806.476008-16-alex.bennee@linaro.org>
|