From patchwork Thu Mar 14 09:46:26 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mingjin Ye X-Patchwork-Id: 138375 X-Patchwork-Delegate: thomas@monjalon.net Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 1833243CB2; Thu, 14 Mar 2024 11:04:38 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 896B042E73; Thu, 14 Mar 2024 11:04:37 +0100 (CET) Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.15]) by mails.dpdk.org (Postfix) with ESMTP id 945C9406BC; Thu, 14 Mar 2024 11:04:25 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1710410666; x=1741946666; h=from:to:cc:subject:date:message-id:mime-version: content-transfer-encoding; bh=Ki9DSbaR4fklwV46Q18zbUPt7AkEkyRdTilWoVZQ40Q=; b=iwnwDs3DpFC4E8y5h+AnbS7rY7XOxOipdU04LMxa87q8R5OLIAQa4pIU ce3aZz+heqZ38trFJraEjf8wtvD9RiWp3v8aWcuqma3mCDy+TQewlgB/X It5t6SuY+BWLWYLuFex2dbP29k3ZRd+UH0eIlL9Gh1hNaX4q53/X7BmIF UXFYt7N+eU71eFFqclYz8pZKyumloZrmsIKgtkoFMFvA4ZLqf82PW8TjN UBlDaHY+1eOZsxHS3pjzvNc6qn6oW1iw0A4os8bkT/Z9T/1QFjK0PQIfK Ui/f1/Frs0kAafyBgCyoUHEi9dSD55HLCAlBVPc2OPatFHvjfgXArQGnY Q==; X-IronPort-AV: E=McAfee;i="6600,9927,11012"; a="9036423" X-IronPort-AV: E=Sophos;i="6.07,125,1708416000"; d="scan'208";a="9036423" Received: from orviesa005.jf.intel.com ([10.64.159.145]) by orvoesa107.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 14 Mar 2024 03:04:24 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.07,125,1708416000"; d="scan'208";a="16976939" Received: from unknown (HELO localhost.localdomain) ([10.239.252.253]) by orviesa005-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 14 Mar 2024 03:04:22 -0700 From: Mingjin Ye To: dev@dpdk.org Cc: Mingjin Ye , stable@dpdk.org Subject: [PATCH] test: fix option block Date: Thu, 14 Mar 2024 09:46:26 +0000 Message-Id: <20240314094626.1068059-1-mingjinx.ye@intel.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org The options allow (-a) and block (-b) cannot be used at the same time. Therefore, allow (-a) will not be added when block (-b) is present. Fixes: b3ce7891ad38 ("test: fix probing in secondary process") Cc: stable@dpdk.org Signed-off-by: Mingjin Ye Tested-by: Jiale Song --- app/test/process.h | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/app/test/process.h b/app/test/process.h index 9fb2bf481c..388c7975cd 100644 --- a/app/test/process.h +++ b/app/test/process.h @@ -44,7 +44,7 @@ add_parameter_allow(char **argv, int max_capacity) int count = 0; RTE_EAL_DEVARGS_FOREACH(NULL, devargs) { - if (strlen(devargs->name) == 0) + if (strlen(devargs->name) == 0 || devargs->type != RTE_DEVTYPE_ALLOWED) continue; if (devargs->data == NULL || strlen(devargs->data) == 0) { @@ -74,7 +74,7 @@ process_dup(const char *const argv[], int numargs, const char *env_value) { int num = 0; char **argv_cpy; - int allow_num; + int allow_num, block_num; int argv_num; int i, status; char path[32]; @@ -89,7 +89,18 @@ process_dup(const char *const argv[], int numargs, const char *env_value) if (pid < 0) return -1; else if (pid == 0) { - allow_num = rte_devargs_type_count(RTE_DEVTYPE_ALLOWED); + allow_num = 0; + block_num = 0; + + /* If block (-b) is present, allow (-a) is not added. */ + for (i = 0; i < numargs; i++) { + if (strcmp(argv[i], "-b") == 0 || + strcmp(argv[i], "-block") == 0) + block_num++; + } + if (!block_num) + allow_num = rte_devargs_type_count(RTE_DEVTYPE_ALLOWED); + argv_num = numargs + allow_num + 1; argv_cpy = calloc(argv_num, sizeof(char *)); if (!argv_cpy)