From nobody Mon Feb 9 14:50:24 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass header.i=@intel.com; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linux.intel.com ARC-Seal: i=1; a=rsa-sha256; t=1709913037; cv=none; d=zohomail.com; s=zohoarc; b=g15GIHZ/0oyYapFY2XYeaWJHIc2GZXcfij3uJ8RwOIh34qfEN1xEL4kKApO90uSVEv4JtmvQCkQoPdntaB0Tco02qi+jujH3Bx/feM+r8IwgAoP3TxYguHYCjt3yNJZQz2J9SVoe2IeVGzRJ1GBc+zKgsEt5w5U/9sr1vPrtD5E= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1709913037; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=qmwgOPgzI6+a5bLhK1DdsuqrJKKuEPSTVyIf2Awv5Rg=; b=FNSOpiTfVNBPjXGPFU0MnHKEYfMCGaUzAWCI7UDfaMKXSpt7YTkTgMuXGHyCAkXEHQhFY4N1D++9dziu/jnXWLaHPnywT1aMGqXUKSYztFARbOHYX8MQSTOqT/L3JIEkH9/MYjbDH1c6Bk5yS6EMfZN3LJf2Aby5ZegOL5o1vA8= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass header.i=@intel.com; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1709913037087996.2151334383155; Fri, 8 Mar 2024 07:50:37 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ricT3-000149-H0; Fri, 08 Mar 2024 10:49:05 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ricT1-00013e-5v for qemu-devel@nongnu.org; Fri, 08 Mar 2024 10:49:03 -0500 Received: from mgamail.intel.com ([198.175.65.21]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ricSz-000449-BL for qemu-devel@nongnu.org; Fri, 08 Mar 2024 10:49:02 -0500 Received: from fmviesa007.fm.intel.com ([10.60.135.147]) by orvoesa113.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 08 Mar 2024 07:48:51 -0800 Received: from liuzhao-optiplex-7080.sh.intel.com ([10.239.160.36]) by fmviesa007.fm.intel.com with ESMTP; 08 Mar 2024 07:48:47 -0800 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1709912942; x=1741448942; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=vf3I/tff1LAPx6iIpRAFiHDNzjYLXmXU3Gy0u0/iRyo=; b=SJOwVm7ldEGH+UZm/m+jyDHfYgfQ7kG1y1HFpXZVMP5NWEhw0uGPR3L6 OcfsevGCbFrRgx1Xi00VHXS1PSfJXQRhmZyUtsygUFnOe46Nhmda/Eqyh WCwTEoZgEPLvbOstMYRdGY/GadIvtSSD7P97M1U69xYv0cUvgR61Tal+Z 3RGlzgQ9RFTC3uMbKIIBIXuntNmGk8vSzdmXAMpRhWjoRYaA5lqw+2Ypk IMmlYil+XfJPT8bDv65YKwZ0sacHOi14aghYTJAaKT1nj542faNkHRxVg L3EgEl8x1jfMldw18AG/sphe7m0mj2mp4CukL/A1orI4irgfNYo8jzBDZ w==; X-IronPort-AV: E=McAfee;i="6600,9927,11006"; a="4561128" X-IronPort-AV: E=Sophos;i="6.07,110,1708416000"; d="scan'208";a="4561128" X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.07,110,1708416000"; d="scan'208";a="10400367" From: Zhao Liu To: Eduardo Habkost , Marcel Apfelbaum , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Yanan Wang , =?UTF-8?q?Daniel=20P=20=2E=20Berrang=C3=A9?= , Thomas Huth , Igor Mammedov , Prasad Pandit , qemu-devel@nongnu.org Cc: Xiaoling Song , Zhao Liu Subject: [PATCH v2 13/13] tests/unit/test-smp-parse: Test "parameter=0" SMP configurations Date: Sat, 9 Mar 2024 00:01:48 +0800 Message-Id: <20240308160148.3130837-14-zhao1.liu@linux.intel.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240308160148.3130837-1-zhao1.liu@linux.intel.com> References: <20240308160148.3130837-1-zhao1.liu@linux.intel.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.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; Received-SPF: none client-ip=198.175.65.21; envelope-from=zhao1.liu@linux.intel.com; helo=mgamail.intel.com X-Spam_score_int: -25 X-Spam_score: -2.6 X-Spam_bar: -- X-Spam_report: (-2.6 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.572, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_NONE=0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @intel.com) X-ZM-MESSAGEID: 1709913038451100015 Content-Type: text/plain; charset="utf-8" From: Zhao Liu The support for "parameter=3D0" SMP configurations is removed, and QEMU returns error for those cases. So add the related test cases to ensure parameters can't accept 0. Signed-off-by: Zhao Liu Reviewed-by: Thomas Huth --- tests/unit/test-smp-parse.c | 92 +++++++++++++++++++++++++++++++++++++ 1 file changed, 92 insertions(+) diff --git a/tests/unit/test-smp-parse.c b/tests/unit/test-smp-parse.c index d39cfdc19bfe..8994337e12c7 100644 --- a/tests/unit/test-smp-parse.c +++ b/tests/unit/test-smp-parse.c @@ -524,6 +524,91 @@ static const struct SMPTestData data_full_topo_invalid= [] =3D { }, }; =20 +static const struct SMPTestData data_zero_topo_invalid[] =3D { + { + /* + * Test "cpus=3D0". + * config: -smp 0,drawers=3D1,books=3D1,sockets=3D1,dies=3D1,\ + * clusters=3D1,cores=3D1,threads=3D1,maxcpus=3D1 + */ + .config =3D SMP_CONFIG_WITH_FULL_TOPO(0, 1, 1, 1, 1, 1, 1, 1, 1), + .expect_error =3D "Invalid CPU topology: CPU topology parameters m= ust " + "be greater than zero", + }, { + /* + * Test "drawers=3D0". + * config: -smp 1,drawers=3D0,books=3D1,sockets=3D1,dies=3D1,\ + * clusters=3D1,cores=3D1,threads=3D1,maxcpus=3D1 + */ + .config =3D SMP_CONFIG_WITH_FULL_TOPO(1, 0, 1, 1, 1, 1, 1, 1, 1), + .expect_error =3D "Invalid CPU topology: CPU topology parameters m= ust " + "be greater than zero", + }, { + /* + * Test "books=3D0". + * config: -smp 1,drawers=3D1,books=3D0,sockets=3D1,dies=3D1,\ + * clusters=3D1,cores=3D1,threads=3D1,maxcpus=3D1 + */ + .config =3D SMP_CONFIG_WITH_FULL_TOPO(1, 1, 0, 1, 1, 1, 1, 1, 1), + .expect_error =3D "Invalid CPU topology: CPU topology parameters m= ust " + "be greater than zero", + }, { + /* + * Test "sockets=3D0". + * config: -smp 1,drawers=3D1,books=3D1,sockets=3D0,dies=3D1,\ + * clusters=3D1,cores=3D1,threads=3D1,maxcpus=3D1 + */ + .config =3D SMP_CONFIG_WITH_FULL_TOPO(1, 1, 1, 0, 1, 1, 1, 1, 1), + .expect_error =3D "Invalid CPU topology: CPU topology parameters m= ust " + "be greater than zero", + }, { + /* + * Test "dies=3D0". + * config: -smp 1,drawers=3D1,books=3D1,sockets=3D1,dies=3D0,\ + * clusters=3D1,cores=3D1,threads=3D1,maxcpus=3D1 + */ + .config =3D SMP_CONFIG_WITH_FULL_TOPO(1, 1, 1, 1, 0, 1, 1, 1, 1), + .expect_error =3D "Invalid CPU topology: CPU topology parameters m= ust " + "be greater than zero", + }, { + /* + * Test "clusters=3D0". + * config: -smp 1,drawers=3D1,books=3D1,sockets=3D1,dies=3D1,\ + * clusters=3D0,cores=3D1,threads=3D1,maxcpus=3D1 + */ + .config =3D SMP_CONFIG_WITH_FULL_TOPO(1, 1, 1, 1, 1, 0, 1, 1, 1), + .expect_error =3D "Invalid CPU topology: CPU topology parameters m= ust " + "be greater than zero", + }, { + /* + * Test "cores=3D0". + * config: -smp 1,drawers=3D1,books=3D1,sockets=3D1,dies=3D1,\ + * clusters=3D1,cores=3D0,threads=3D1,maxcpus=3D1 + */ + .config =3D SMP_CONFIG_WITH_FULL_TOPO(1, 1, 1, 1, 1, 1, 0, 1, 1), + .expect_error =3D "Invalid CPU topology: CPU topology parameters m= ust " + "be greater than zero", + }, { + /* + * Test "threads=3D0". + * config: -smp 1,drawers=3D1,books=3D1,sockets=3D1,dies=3D1,\ + * clusters=3D1,cores=3D1,threads=3D0,maxcpus=3D1 + */ + .config =3D SMP_CONFIG_WITH_FULL_TOPO(1, 1, 1, 1, 1, 1, 1, 0, 1), + .expect_error =3D "Invalid CPU topology: CPU topology parameters m= ust " + "be greater than zero", + }, { + /* + * Test "maxcpus=3D0". + * config: -smp 1,drawers=3D1,books=3D1,sockets=3D1,dies=3D1,\ + * clusters=3D1,cores=3D1,threads=3D1,maxcpus=3D0 + */ + .config =3D SMP_CONFIG_WITH_FULL_TOPO(1, 1, 1, 1, 1, 1, 1, 1, 0), + .expect_error =3D "Invalid CPU topology: CPU topology parameters m= ust " + "be greater than zero", + }, +}; + static char *smp_config_to_string(const SMPConfiguration *config) { return g_strdup_printf( @@ -1173,6 +1258,13 @@ static void test_full_topo(const void *opaque) smp_parse_test(ms, &data, false); } =20 + for (i =3D 0; i < ARRAY_SIZE(data_zero_topo_invalid); i++) { + data =3D data_zero_topo_invalid[i]; + unsupported_params_init(mc, &data); + + smp_parse_test(ms, &data, false); + } + object_unref(obj); } =20 --=20 2.34.1