From nobody Sun May 5 17:17:17 2024 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 1526977909181302.8846342627771; Tue, 22 May 2018 01:31:49 -0700 (PDT) Received: from localhost ([::1]:54187 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fL2hn-0007rS-82 for importer@patchew.org; Tue, 22 May 2018 04:31:39 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:40284) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fL2go-0007R0-EM for qemu-devel@nongnu.org; Tue, 22 May 2018 04:30:39 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fL2gk-0003BU-BK for qemu-devel@nongnu.org; Tue, 22 May 2018 04:30:38 -0400 Received: from mx3-rdu2.redhat.com ([66.187.233.73]:42418 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 1fL2gk-0003BF-74 for qemu-devel@nongnu.org; Tue, 22 May 2018 04:30:34 -0400 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.rdu2.redhat.com [10.11.54.6]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id AA717401EF0F; Tue, 22 May 2018 08:30:33 +0000 (UTC) Received: from thh440s.redhat.com (ovpn-204-52.brq.redhat.com [10.40.204.52]) by smtp.corp.redhat.com (Postfix) with ESMTP id 3F455215CDA7; Tue, 22 May 2018 08:30:32 +0000 (UTC) From: Thomas Huth To: qemu-devel@nongnu.org Date: Tue, 22 May 2018 10:30:31 +0200 Message-Id: <1526977831-31129-1-git-send-email-thuth@redhat.com> X-Scanned-By: MIMEDefang 2.78 on 10.11.54.6 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.5]); Tue, 22 May 2018 08:30:33 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.5]); Tue, 22 May 2018 08:30:33 +0000 (UTC) for IP:'10.11.54.6' DOMAIN:'int-mx06.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: Do not delete the output file in case of errors 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 , Mark Cave-Ayland , =?UTF-8?q?Alex=20Benn=C3=A9e?= , Peter Maydell 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" Peter reported that the boot-serial tester sometimes runs into timeouts with SPARC guests. It's currently completely unclear whether this is due to too much load on the host machine (so that the guest really just ran too slow), or whether there is something wrong with the guest's firmware boot. For further debugging, we need the serial output of the guest in case of errors, so instead of unlinking the file immediately, this is now only done in case of success. In case of error, print the name of the file with the serial output via g_error() (which then also calls abort() internally to mark the test as failed). Signed-off-by: Thomas Huth --- tests/boot-serial-test.c | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/tests/boot-serial-test.c b/tests/boot-serial-test.c index 4d6815c..952a2e7 100644 --- a/tests/boot-serial-test.c +++ b/tests/boot-serial-test.c @@ -111,9 +111,8 @@ static testdef_t tests[] =3D { { NULL } }; =20 -static void check_guest_output(const testdef_t *test, int fd) +static bool check_guest_output(const testdef_t *test, int fd) { - bool output_ok =3D false; int i, nbr =3D 0, pos =3D 0, ccnt; char ch; =20 @@ -125,8 +124,7 @@ static void check_guest_output(const testdef_t *test, i= nt fd) pos +=3D 1; if (test->expect[pos] =3D=3D '\0') { /* We've reached the end of the expected string! */ - output_ok =3D true; - goto done; + return true; } } else { pos =3D 0; @@ -136,8 +134,7 @@ static void check_guest_output(const testdef_t *test, i= nt fd) g_usleep(10000); } =20 -done: - g_assert(output_ok); + return false; } =20 static void test_machine(const void *data) @@ -180,12 +177,16 @@ static void test_machine(const void *data) "-no-shutdown -serial chardev:serial0 %s", codeparam, code ? codetmp : "", test->machine, serialtmp, test->extra); - unlink(serialtmp); if (code) { unlink(codetmp); } =20 - check_guest_output(test, ser_fd); + if (!check_guest_output(test, ser_fd)) { + g_error("Failed to find expected string. Please check '%s'", + serialtmp); + } + unlink(serialtmp); + qtest_quit(global_qtest); =20 close(ser_fd); --=20 1.8.3.1