From: Thomas Huth <thuth@redhat.com>
To: qemu-devel@nongnu.org, Peter Maydell <peter.maydell@linaro.org>
Cc: "Philippe Mathieu-Daudé" <f4bug@amsat.org>,
"Dr. David Alan Gilbert" <dgilbert@redhat.com>,
"Richard Henderson" <richard.henderson@linaro.org>,
"Paolo Bonzini" <pbonzini@redhat.com>
Subject: [Qemu-devel] [PATCH] tests/boot-serial-test: Fix problem with timeout due to dropped characters
Date: Fri, 16 Feb 2018 07:12:44 +0100 [thread overview]
Message-ID: <1518761564-9899-1-git-send-email-thuth@redhat.com> (raw)
Commit 92b540dac9fc3a5 introduce a counter to handle the timeouts in a
better way. But in case ccnt reaches 512, the current read character is
ignored - and if that character is part of the string that we are looking
for, the test fails to match the string.
Almost all of the tests look for a string within the first 512 bytes of
firmware output, so the problem never triggered there. But the hppa test
that has been added recently looks for a longer string at the very end of
a long output, thus there's a chance that we miss a character there so
that the test fails unexpectedly. Fix it by *not* reading and dropping a
character if the counter reaches 512.
Fixes: 92b540dac9fc3a572c7342edd0b073000f5a6abf
Signed-off-by: Thomas Huth <thuth@redhat.com>
---
@Peter: Since this fixes the problem with running "make check", could
you maybe apply this directly to the master branch? Thanks, and sorry
for the inconvenience!
tests/boot-serial-test.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/tests/boot-serial-test.c b/tests/boot-serial-test.c
index ea87a80..696f7a3 100644
--- a/tests/boot-serial-test.c
+++ b/tests/boot-serial-test.c
@@ -101,7 +101,7 @@ static void check_guest_output(const testdef_t *test, int fd)
/* Poll serial output... Wait at most 60 seconds */
for (i = 0; i < 6000; ++i) {
ccnt = 0;
- while ((nbr = read(fd, &ch, 1)) == 1 && ccnt++ < 512) {
+ while (ccnt++ < 512 && (nbr = read(fd, &ch, 1)) == 1) {
if (ch == test->expect[pos]) {
pos += 1;
if (test->expect[pos] == '\0') {
--
1.8.3.1
next reply other threads:[~2018-02-16 6:13 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-02-16 6:12 Thomas Huth [this message]
2018-02-16 10:15 ` [Qemu-devel] [PATCH] tests/boot-serial-test: Fix problem with timeout due to dropped characters Peter Maydell
2018-02-16 10:25 ` Thomas Huth
2018-02-16 11:19 ` Peter Maydell
2018-02-21 11:05 ` Paolo Bonzini
2018-02-21 11:10 ` Thomas Huth
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1518761564-9899-1-git-send-email-thuth@redhat.com \
--to=thuth@redhat.com \
--cc=dgilbert@redhat.com \
--cc=f4bug@amsat.org \
--cc=pbonzini@redhat.com \
--cc=peter.maydell@linaro.org \
--cc=qemu-devel@nongnu.org \
--cc=richard.henderson@linaro.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).