diff options
author | Daniel P. Berrangé <berrange@redhat.com> | 2024-11-21 16:57:42 +0000 |
---|---|---|
committer | Alex Bennée <alex.bennee@linaro.org> | 2024-11-25 10:13:41 +0000 |
commit | cdad03b74f759857d784e074755f0d96a64d69af (patch) | |
tree | 44bf705a7dde268f892f452094e2774a648de7e9 /docs/devel/testing | |
parent | f03a81897db14bb56109b6adc8699a91774b3389 (diff) |
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>
Diffstat (limited to 'docs/devel/testing')
0 files changed, 0 insertions, 0 deletions