From patchwork Thu May 23 12:43:19 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 1104108 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=redhat.com Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 458qQ93z8hz9s1c for ; Thu, 23 May 2019 23:01:37 +1000 (AEST) Received: from localhost ([127.0.0.1]:35704 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hTnLj-0007QD-Gj for incoming@patchwork.ozlabs.org; Thu, 23 May 2019 09:01:35 -0400 Received: from eggs.gnu.org ([209.51.188.92]:51307) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hTnGl-0003rP-5M for qemu-devel@nongnu.org; Thu, 23 May 2019 08:56:28 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hTn6N-00041K-Hv for qemu-devel@nongnu.org; Thu, 23 May 2019 08:45:44 -0400 Received: from mx1.redhat.com ([209.132.183.28]:57402) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1hTn6N-00040w-Di; Thu, 23 May 2019 08:45:43 -0400 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id B1C12859FF; Thu, 23 May 2019 12:45:42 +0000 (UTC) Received: from x1w.redhat.com (unknown [10.40.205.5]) by smtp.corp.redhat.com (Postfix) with ESMTPS id D05F268378; Thu, 23 May 2019 12:45:38 +0000 (UTC) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Date: Thu, 23 May 2019 14:43:19 +0200 Message-Id: <20190523124320.28726-15-philmd@redhat.com> In-Reply-To: <20190523124320.28726-1-philmd@redhat.com> References: <20190523124320.28726-1-philmd@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.26]); Thu, 23 May 2019 12:45:42 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PULL 14/15] tests: fw_cfg: add 'reboot-timeout' test case 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: Laurent Vivier , Thomas Huth , "Michael S. Tsirkin" , Laszlo Ersek , Mark Cave-Ayland , qemu-ppc@nongnu.org, Gerd Hoffmann , Li Qiang , Paolo Bonzini , =?utf-8?q?Philippe_Mathieu-Daud?= =?utf-8?b?w6k=?= , Artyom Tarasenko , David Gibson Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" From: Li Qiang Signed-off-by: Li Qiang Tested-by: Thomas Huth Reviewed-by: Philippe Mathieu-Daudé Tested-by: Philippe Mathieu-Daudé Message-Id: <20190424140643.62457-5-liq3ea@163.com> Signed-off-by: Philippe Mathieu-Daudé --- tests/fw_cfg-test.c | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/tests/fw_cfg-test.c b/tests/fw_cfg-test.c index 4597626dd7..20b1eb75f4 100644 --- a/tests/fw_cfg-test.c +++ b/tests/fw_cfg-test.c @@ -15,6 +15,7 @@ #include "libqtest.h" #include "standard-headers/linux/qemu_fw_cfg.h" #include "libqos/fw_cfg.h" +#include "qemu/bswap.h" static uint64_t ram_size = 128 << 20; static uint16_t nb_cpus = 1; @@ -174,6 +175,25 @@ static void test_fw_cfg_boot_menu(void) qtest_quit(s); } +static void test_fw_cfg_reboot_timeout(void) +{ + QFWCFG *fw_cfg; + QTestState *s; + uint32_t reboot_timeout = 0; + size_t filesize; + + s = qtest_init("-boot reboot-timeout=15"); + fw_cfg = pc_fw_cfg_init(s); + + filesize = qfw_cfg_get_file(fw_cfg, "etc/boot-fail-wait", + &reboot_timeout, sizeof(reboot_timeout)); + g_assert_cmpint(filesize, ==, sizeof(reboot_timeout)); + reboot_timeout = le32_to_cpu(reboot_timeout); + g_assert_cmpint(reboot_timeout, ==, 15); + pc_fw_cfg_uninit(fw_cfg); + qtest_quit(s); +} + int main(int argc, char **argv) { g_test_init(&argc, &argv, NULL); @@ -193,6 +213,7 @@ int main(int argc, char **argv) qtest_add_func("fw_cfg/max_cpus", test_fw_cfg_max_cpus); qtest_add_func("fw_cfg/numa", test_fw_cfg_numa); qtest_add_func("fw_cfg/boot_menu", test_fw_cfg_boot_menu); + qtest_add_func("fw_cfg/reboot_timeout", test_fw_cfg_reboot_timeout); return g_test_run(); }