From patchwork Wed Feb 28 04:02:59 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Haozhong Zhang X-Patchwork-Id: 10246739 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 4A49F60362 for ; Wed, 28 Feb 2018 04:04:58 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 3964A28CD4 for ; Wed, 28 Feb 2018 04:04:58 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 2E38E28CD6; Wed, 28 Feb 2018 04:04:58 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 99CF428CD4 for ; Wed, 28 Feb 2018 04:04:57 +0000 (UTC) Received: from localhost ([::1]:42096 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eqszA-0005h5-RT for patchwork-qemu-devel@patchwork.kernel.org; Tue, 27 Feb 2018 23:04:56 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:54601) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eqsxc-0004WA-MN for qemu-devel@nongnu.org; Tue, 27 Feb 2018 23:03:22 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1eqsxb-0002N3-6S for qemu-devel@nongnu.org; Tue, 27 Feb 2018 23:03:20 -0500 Received: from mga05.intel.com ([192.55.52.43]:46587) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1eqsxa-0002Kn-Pt for qemu-devel@nongnu.org; Tue, 27 Feb 2018 23:03:19 -0500 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga006.jf.intel.com ([10.7.209.51]) by fmsmga105.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 27 Feb 2018 20:03:18 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.47,403,1515484800"; d="scan'208";a="21604806" Received: from hz-desktop.sh.intel.com (HELO localhost) ([10.239.13.35]) by orsmga006.jf.intel.com with ESMTP; 27 Feb 2018 20:03:16 -0800 From: Haozhong Zhang To: qemu-devel@nongnu.org Date: Wed, 28 Feb 2018 12:02:59 +0800 Message-Id: <20180228040300.8914-3-haozhong.zhang@intel.com> X-Mailer: git-send-email 2.14.1 In-Reply-To: <20180228040300.8914-1-haozhong.zhang@intel.com> References: <20180228040300.8914-1-haozhong.zhang@intel.com> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 192.55.52.43 Subject: [Qemu-devel] [PATCH v2 2/3] tests/bios-tables-test: allow setting extra machine options 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: Haozhong Zhang , Xiao Guangrong , mst@redhat.com, Eduardo Habkost , Stefan Hajnoczi , Paolo Bonzini , Marcel Apfelbaum , Igor Mammedov , Dan Williams , Richard Henderson Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP Some test cases may require extra machine options than the those used in the current test_acpi_ones(), e.g., nvdimm test cases require the machine option 'nvdimm=on'. Signed-off-by: Haozhong Zhang --- tests/bios-tables-test.c | 45 +++++++++++++++++++++++++++++---------------- 1 file changed, 29 insertions(+), 16 deletions(-) diff --git a/tests/bios-tables-test.c b/tests/bios-tables-test.c index 65b271a173..d45181aa51 100644 --- a/tests/bios-tables-test.c +++ b/tests/bios-tables-test.c @@ -654,17 +654,22 @@ static void test_smbios_structs(test_data *data) } } -static void test_acpi_one(const char *params, test_data *data) +static void test_acpi_one(const char *extra_machine_opts, + const char *params, test_data *data) { char *args; /* Disable kernel irqchip to be able to override apic irq0. */ - args = g_strdup_printf("-machine %s,accel=%s,kernel-irqchip=off " + args = g_strdup_printf("-machine %s,accel=%s,kernel-irqchip=off", + data->machine, "kvm:tcg"); + if (extra_machine_opts) { + args = g_strdup_printf("%s,%s", args, extra_machine_opts); + } + args = g_strdup_printf("%s " "-net none -display none %s " "-drive id=hd0,if=none,file=%s,format=raw " "-device ide-hd,drive=hd0 ", - data->machine, "kvm:tcg", - params ? params : "", disk); + args, params ? params : "", disk); qtest_start(args); @@ -711,7 +716,7 @@ static void test_acpi_piix4_tcg(void) data.machine = MACHINE_PC; data.required_struct_types = base_required_struct_types; data.required_struct_types_len = ARRAY_SIZE(base_required_struct_types); - test_acpi_one(NULL, &data); + test_acpi_one(NULL, NULL, &data); free_test_data(&data); } @@ -724,7 +729,7 @@ static void test_acpi_piix4_tcg_bridge(void) data.variant = ".bridge"; data.required_struct_types = base_required_struct_types; data.required_struct_types_len = ARRAY_SIZE(base_required_struct_types); - test_acpi_one("-device pci-bridge,chassis_nr=1", &data); + test_acpi_one(NULL, "-device pci-bridge,chassis_nr=1", &data); free_test_data(&data); } @@ -736,7 +741,7 @@ static void test_acpi_q35_tcg(void) data.machine = MACHINE_Q35; data.required_struct_types = base_required_struct_types; data.required_struct_types_len = ARRAY_SIZE(base_required_struct_types); - test_acpi_one(NULL, &data); + test_acpi_one(NULL, NULL, &data); free_test_data(&data); } @@ -749,7 +754,7 @@ static void test_acpi_q35_tcg_bridge(void) data.variant = ".bridge"; data.required_struct_types = base_required_struct_types; data.required_struct_types_len = ARRAY_SIZE(base_required_struct_types); - test_acpi_one("-device pci-bridge,chassis_nr=1", + test_acpi_one(NULL, "-device pci-bridge,chassis_nr=1", &data); free_test_data(&data); } @@ -761,7 +766,8 @@ static void test_acpi_piix4_tcg_cphp(void) memset(&data, 0, sizeof(data)); data.machine = MACHINE_PC; data.variant = ".cphp"; - test_acpi_one("-smp 2,cores=3,sockets=2,maxcpus=6" + test_acpi_one(NULL, + "-smp 2,cores=3,sockets=2,maxcpus=6" " -numa node -numa node" " -numa dist,src=0,dst=1,val=21", &data); @@ -775,7 +781,8 @@ static void test_acpi_q35_tcg_cphp(void) memset(&data, 0, sizeof(data)); data.machine = MACHINE_Q35; data.variant = ".cphp"; - test_acpi_one(" -smp 2,cores=3,sockets=2,maxcpus=6" + test_acpi_one(NULL, + " -smp 2,cores=3,sockets=2,maxcpus=6" " -numa node -numa node" " -numa dist,src=0,dst=1,val=21", &data); @@ -795,7 +802,8 @@ static void test_acpi_q35_tcg_ipmi(void) data.variant = ".ipmibt"; data.required_struct_types = ipmi_required_struct_types; data.required_struct_types_len = ARRAY_SIZE(ipmi_required_struct_types); - test_acpi_one("-device ipmi-bmc-sim,id=bmc0" + test_acpi_one(NULL, + "-device ipmi-bmc-sim,id=bmc0" " -device isa-ipmi-bt,bmc=bmc0", &data); free_test_data(&data); @@ -813,7 +821,8 @@ static void test_acpi_piix4_tcg_ipmi(void) data.variant = ".ipmikcs"; data.required_struct_types = ipmi_required_struct_types; data.required_struct_types_len = ARRAY_SIZE(ipmi_required_struct_types); - test_acpi_one("-device ipmi-bmc-sim,id=bmc0" + test_acpi_one(NULL, + "-device ipmi-bmc-sim,id=bmc0" " -device isa-ipmi-kcs,irq=0,bmc=bmc0", &data); free_test_data(&data); @@ -826,7 +835,8 @@ static void test_acpi_q35_tcg_memhp(void) memset(&data, 0, sizeof(data)); data.machine = MACHINE_Q35; data.variant = ".memhp"; - test_acpi_one(" -m 128,slots=3,maxmem=1G" + test_acpi_one(NULL, + " -m 128,slots=3,maxmem=1G" " -numa node -numa node" " -numa dist,src=0,dst=1,val=21", &data); @@ -840,7 +850,8 @@ static void test_acpi_piix4_tcg_memhp(void) memset(&data, 0, sizeof(data)); data.machine = MACHINE_PC; data.variant = ".memhp"; - test_acpi_one(" -m 128,slots=3,maxmem=1G" + test_acpi_one(NULL, + " -m 128,slots=3,maxmem=1G" " -numa node -numa node" " -numa dist,src=0,dst=1,val=21", &data); @@ -854,7 +865,8 @@ static void test_acpi_q35_tcg_numamem(void) memset(&data, 0, sizeof(data)); data.machine = MACHINE_Q35; data.variant = ".numamem"; - test_acpi_one(" -numa node -numa node,mem=128", &data); + test_acpi_one(NULL, + " -numa node -numa node,mem=128", &data); free_test_data(&data); } @@ -865,7 +877,8 @@ static void test_acpi_piix4_tcg_numamem(void) memset(&data, 0, sizeof(data)); data.machine = MACHINE_PC; data.variant = ".numamem"; - test_acpi_one(" -numa node -numa node,mem=128", &data); + test_acpi_one(NULL, + " -numa node -numa node,mem=128", &data); free_test_data(&data); }