From nobody Mon Nov 10 12:52:49 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=163.com ARC-Seal: i=1; a=rsa-sha256; t=1556115447; cv=none; d=zoho.com; s=zohoarc; b=i2lZFW/HrRct1K9GU6FUsyma9uthm9no9L+uFVpDFfItjmoe3YlPc0j8z3gvkbK+6OCJegV773B7CgldUag0GG/DikMmZsDTvqU2rsvqwt7unq8+f20Pr8quLEIWp997zMWMz0wffREUOq95QG3XKBGbTx8OkvKoYQGzET5l+2A= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1556115447; h=Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:Message-ID:References:Sender:Subject:To:ARC-Authentication-Results; bh=vgOeaRvpko5K839zOg5xl9f11bNiWV/S9xLagM3xojs=; b=h7wAV/wnzVbbsFSMFC0AER4GghwpcGUJOAIIDKSzSB2gDz1ToxIHHhuQGtTwzm5sHTVKmH5hvj+dqurMpEaUO9k5fD285jOJQeWWAcjlGMSvnR4w42/+fZDxcQdNX1pJ3iSFSnZovvxBX0k4ffGG94BP2DdUSKctSC+v4tNjuVc= ARC-Authentication-Results: i=1; mx.zoho.com; dkim=fail; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1556115447238480.0307649230947; Wed, 24 Apr 2019 07:17:27 -0700 (PDT) Received: from localhost ([127.0.0.1]:42371 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hJIi9-0004AA-3n for importer@patchew.org; Wed, 24 Apr 2019 10:17:21 -0400 Received: from eggs.gnu.org ([209.51.188.92]:39025) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hJIfe-0002XO-9D for qemu-devel@nongnu.org; Wed, 24 Apr 2019 10:14:47 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hJIY4-0006iH-5O for qemu-devel@nongnu.org; Wed, 24 Apr 2019 10:06:57 -0400 Received: from m12-14.163.com ([220.181.12.14]:54701) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hJIY2-0006gJ-HF for qemu-devel@nongnu.org; Wed, 24 Apr 2019 10:06:56 -0400 Received: from localhost.localdomain (unknown [115.200.201.0]) by smtp10 (Coremail) with SMTP id DsCowAC3Ayl0bcBcrks9CA--.5531S6; Wed, 24 Apr 2019 22:06:52 +0800 (CST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=163.com; s=s110527; h=From:Subject:Date:Message-Id; bh=vgOeaRvpko5K839zOg 5xl9f11bNiWV/S9xLagM3xojs=; b=Iky/ArWzE7zTNSsAoAPwbDm222RehfXnnB qyxdaVjMRiWZtcydpJ2hOQDLdnD13AHU3VxZTW3Cqryv4AFDHPkxncy/FjPF4HfW tDGYUxQAP/zNZrWG7e/diM5+bDLnqyBgcjrNfTUKqmAFgsAw1pKtxvrSePPUwglm PEWhpoz4I= From: Li Qiang To: philmd@redhat.com, lersek@redhat.com, kraxel@redhat.com, thuth@redhat.com, lvivier@redhat.com, pbonzini@redhat.com Date: Wed, 24 Apr 2019 07:06:42 -0700 Message-Id: <20190424140643.62457-5-liq3ea@163.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190424140643.62457-1-liq3ea@163.com> References: <20190424140643.62457-1-liq3ea@163.com> X-CM-TRANSID: DsCowAC3Ayl0bcBcrks9CA--.5531S6 X-Coremail-Antispam: 1Uf129KBjvJXoW7CFyrWw48tw45CrWDAw1rXrb_yoW8WF13pF 1jk3ZFkrZ5JFW2qr13KrnFqr1aq3s7Jr4UArZrXFW0yw18Wr1qqa18Ca4Fg3WDWFZ2vFs8 ZF4vqF13KF1DWaDanT9S1TB71UUUUUUqnTZGkaVYY2UrUUUUjbIjqfuFe4nvWSU5nxnvy2 9KBjDUYxBIdaVFxhVjvjDU0xZFpf9x07U2_M-UUUUU= X-Originating-IP: [115.200.201.0] X-CM-SenderInfo: 5oltjvrd6rljoofrz/1tbitBygbVSIbtkMzQAAsP X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 220.181.12.14 Subject: [Qemu-devel] [PATCH v2 4/5] 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: Li Qiang , liq3ea@gmail.com, qemu-devel@nongnu.org Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Signed-off-by: Li Qiang --- Change since v1: Converting little endian reboot_timeout to cpu endian 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 c22503619f..6c6add54db 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" =20 static uint64_t ram_size =3D 128 << 20; static uint16_t nb_cpus =3D 1; @@ -174,6 +175,25 @@ static void test_fw_cfg_boot_menu(void) qtest_quit(s); } =20 +static void test_fw_cfg_reboot_timeout(void) +{ + QFWCFG *fw_cfg; + QTestState *s; + uint32_t reboot_timeout =3D 0; + size_t filesize; + + s =3D qtest_init("-boot reboot-timeout=3D15"); + fw_cfg =3D pc_fw_cfg_init(s); + + filesize =3D qfw_cfg_get_file(fw_cfg, "etc/boot-fail-wait", + &reboot_timeout, sizeof(reboot_timeout)); + g_assert_cmpint(filesize, =3D=3D, sizeof(reboot_timeout)); + reboot_timeout =3D le32_to_cpu(reboot_timeout); + g_assert_cmpint(reboot_timeout, =3D=3D, 15); + pc_fw_cfg_uninit(fw_cfg); + qtest_quit(s); +} + int main(int argc, char **argv) { int ret; @@ -195,6 +215,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); =20 ret =3D g_test_run(); =20 --=20 2.17.1