summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorThomas Huth2017-11-30 09:53:02 +0100
committerPaolo Bonzini2017-12-21 09:22:45 +0100
commit92b540dac9fc3a572c7342edd0b073000f5a6abf (patch)
tree66c02a384f7fc0196a95bf954e9a7a644c3641ec /tests
parenttarget/i386: Fix handling of VEX prefixes (diff)
downloadqemu-92b540dac9fc3a572c7342edd0b073000f5a6abf.tar.gz
qemu-92b540dac9fc3a572c7342edd0b073000f5a6abf.tar.xz
qemu-92b540dac9fc3a572c7342edd0b073000f5a6abf.zip
tests/boot-serial-test: Make sure that we check the timeout regularly
If the guest continuesly writes characters to the UART, we never leave the inner while loop and thus never check whether we've reached the timeout value. So if we fail to find the expected string in the UART output, the test just hangs and never finishs. Use a counter to regularly break out of the while loop to check the timeout. Signed-off-by: Thomas Huth <thuth@redhat.com> Message-Id: <1512031988-32490-2-git-send-email-thuth@redhat.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Diffstat (limited to 'tests')
-rw-r--r--tests/boot-serial-test.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/tests/boot-serial-test.c b/tests/boot-serial-test.c
index c935d69824..fa4183de29 100644
--- a/tests/boot-serial-test.c
+++ b/tests/boot-serial-test.c
@@ -43,12 +43,13 @@ static testdef_t tests[] = {
static void check_guest_output(const testdef_t *test, int fd)
{
bool output_ok = false;
- int i, nbr, pos = 0;
+ int i, nbr, pos = 0, ccnt;
char ch;
/* Poll serial output... Wait at most 60 seconds */
for (i = 0; i < 6000; ++i) {
- while ((nbr = read(fd, &ch, 1)) == 1) {
+ ccnt = 0;
+ while ((nbr = read(fd, &ch, 1)) == 1 && ccnt++ < 512) {
if (ch == test->expect[pos]) {
pos += 1;
if (test->expect[pos] == '\0') {