From nobody Wed Oct 22 15:02:27 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (208.118.235.17 [208.118.235.17]) by mx.zohomail.com with SMTPS id 1518761660242626.6030365514081; Thu, 15 Feb 2018 22:14:20 -0800 (PST) Received: from localhost ([::1]:43897 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1emZHY-0005YE-QE for importer@patchew.org; Fri, 16 Feb 2018 01:14:04 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:37150) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1emZGd-0005Ax-Hc for qemu-devel@nongnu.org; Fri, 16 Feb 2018 01:13:08 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1emZGY-00039K-Gd for qemu-devel@nongnu.org; Fri, 16 Feb 2018 01:13:07 -0500 Received: from mx3-rdu2.redhat.com ([66.187.233.73]:54902 helo=mx1.redhat.com) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1emZGY-000392-Bk for qemu-devel@nongnu.org; Fri, 16 Feb 2018 01:13:02 -0500 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.rdu2.redhat.com [10.11.54.3]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 55C2E8182D1E; Fri, 16 Feb 2018 06:12:51 +0000 (UTC) Received: from thh440s.redhat.com (ovpn-204-47.brq.redhat.com [10.40.204.47]) by smtp.corp.redhat.com (Postfix) with ESMTP id 97AF81010053; Fri, 16 Feb 2018 06:12:45 +0000 (UTC) From: Thomas Huth To: qemu-devel@nongnu.org, Peter Maydell Date: Fri, 16 Feb 2018 07:12:44 +0100 Message-Id: <1518761564-9899-1-git-send-email-thuth@redhat.com> X-Scanned-By: MIMEDefang 2.78 on 10.11.54.3 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.8]); Fri, 16 Feb 2018 06:12:51 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.8]); Fri, 16 Feb 2018 06:12:51 +0000 (UTC) for IP:'10.11.54.3' DOMAIN:'int-mx03.intmail.prod.int.rdu2.redhat.com' HELO:'smtp.corp.redhat.com' FROM:'thuth@redhat.com' RCPT:'' X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 66.187.233.73 Subject: [Qemu-devel] [PATCH] tests/boot-serial-test: Fix problem with timeout due to dropped characters X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Paolo Bonzini , Richard Henderson , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , "Dr. David Alan Gilbert" Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" 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 --- @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, i= nt fd) /* Poll serial output... Wait at most 60 seconds */ for (i =3D 0; i < 6000; ++i) { ccnt =3D 0; - while ((nbr =3D read(fd, &ch, 1)) =3D=3D 1 && ccnt++ < 512) { + while (ccnt++ < 512 && (nbr =3D read(fd, &ch, 1)) =3D=3D 1) { if (ch =3D=3D test->expect[pos]) { pos +=3D 1; if (test->expect[pos] =3D=3D '\0') { --=20 1.8.3.1