From nobody Tue Nov 26 06:53:04 2024 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=1709718194; cv=none; d=zohomail.com; s=zohoarc; b=DvUuP6bc7sq64rqbhSUcwU4FwZtsifvFXK8/E7K7lPklVBeZ9Z9E3dxvZzyK/Hx9bJ2/iIFNpaa5MvsIJjXG7ZuP8VufaDDJSn1/O+mRJEMQm0daNefb4rpYAvvOQAI7F6oxPN2463ws2mtCq4+PWHOcn/YfrLisn9Yt9Mx/b2Y= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1709718194; 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=mchNf8yY1VhQRGXhH53JRB2L2hcph8i6oaxNUqyb8FE=; b=TE4IkGzUal2fquJaWeKqw7IjbEyZ3YKtFb79/E0nu+PqnNIX7f77jQXjwn27MwhyfewV9zQPk9kGSaSFpYq2oc5mcXGepXCzMjd9DdUXh3ZTW6IXX03kV80cJFfWxThdLu9oQo9Y+sPweounYYkwTlvvyDSfg0Hu/6/4XFkhtfQ= 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 1709718194886559.7897696832383; Wed, 6 Mar 2024 01:43:14 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rhnm8-00085o-TP; Wed, 06 Mar 2024 04:41:24 -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 1rhnm7-00085T-1m for qemu-devel@nongnu.org; Wed, 06 Mar 2024 04:41:23 -0500 Received: from mgamail.intel.com ([198.175.65.11]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rhnm4-0002dF-7X for qemu-devel@nongnu.org; Wed, 06 Mar 2024 04:41:22 -0500 Received: from fmviesa002.fm.intel.com ([10.60.135.142]) by orvoesa103.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 06 Mar 2024 01:41:09 -0800 Received: from liuzhao-optiplex-7080.sh.intel.com ([10.239.160.36]) by fmviesa002.fm.intel.com with ESMTP; 06 Mar 2024 01:41:06 -0800 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1709718080; x=1741254080; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=AyRMlDMPyeK2zIKXag691XL6Lf4SeMfVoV8Ojv6fvFk=; b=gJReOePo5eCcVs/hZ3hpWiIoTGyTxLMiti5eoKhGyZsZEi0nYEl9aySW I8fcsbsM47eJ0osypxoz/+8owA/b9VvkEWz6aB+LzEP9OT4CqkfCtZAxI KTgyZYLWmoQ6oxwK0Cqlxmss6fJScx47jz2FLzwkEwl+4u/jZ5LVvaZb+ 6XNDrPemJ4sFaiOHa93OqYQjKIaK8cGJIrDK2XpGff0RbNK3JP+sBvO37 Oz9x5sKVfXA8gJ0or9iyfnIY4LwTW68neQWCQSl1CCuHSZFMseAV1Rg4T M4+1vmL8+aBwLeyfO+UTfqjje72oZvClFDUIJzqQa2GPPzCQDyMYXhxiN A==; X-IronPort-AV: E=McAfee;i="6600,9927,11004"; a="14897959" X-IronPort-AV: E=Sophos;i="6.06,207,1705392000"; d="scan'208";a="14897959" X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.06,207,1705392000"; d="scan'208";a="32854209" 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 14/14] tests/unit/test-smp-parse: Test "parameter=0" SMP configurations Date: Wed, 6 Mar 2024 17:54:07 +0800 Message-Id: <20240306095407.3058909-15-zhao1.liu@linux.intel.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240306095407.3058909-1-zhao1.liu@linux.intel.com> References: <20240306095407.3058909-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.11; 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.568, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_EF=-0.1, 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: 1709718195082100001 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