From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 840E445B1C; Sat, 12 Oct 2024 11:58:09 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id A2DF1402CF; Sat, 12 Oct 2024 11:58:08 +0200 (CEST) Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.18]) by mails.dpdk.org (Postfix) with ESMTP id 9D32940265; Sat, 12 Oct 2024 11:58:06 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1728727087; x=1760263087; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=CfWq0p0Adaq98UCDMzlrfGP37sMTAYltTHEOmbfw9Hw=; b=EscVGLnL4YdR/Zu2Bl1gH4JsyY7dLGk9I3ZeFoXkTJk6EKBMHmuxoNWW aaDY2GEYZoXvK6BmKlpSCGzgG1cy/Pkj31Q8OYHLKGNazDWIOeZescaAI PpIYrAPPsm9DMsYjx3vYHDW4S7CPyTJjdkqjlvMwYyorxVLJaak1tXXws ERGFNZwa/3cjUmTFRqMKasWt9TbgeYjMaCrHRyzq4SZP2yT94VsxwnLeG 1zZoUlYpER1grpJy1t+W9xkEORJ1AwrhIfOeb33a1lrOd2aCgqv9buvdy fzFn1JOSZbQlByM3Od3xcery4EOb821uHKsrJ9HxCb3CcIq6ZR8bFtFuE Q==; X-CSE-ConnectionGUID: Pj9UOOQrTY+3H0PLsktBvA== X-CSE-MsgGUID: jtVJKC/8SZeJxrDPSkGFeA== X-IronPort-AV: E=McAfee;i="6700,10204,11222"; a="27568758" X-IronPort-AV: E=Sophos;i="6.11,198,1725346800"; d="scan'208";a="27568758" Received: from orviesa006.jf.intel.com ([10.64.159.146]) by fmvoesa112.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 12 Oct 2024 02:58:05 -0700 X-CSE-ConnectionGUID: 6mTdKH7sQjeDkyPKcJdsgg== X-CSE-MsgGUID: npUBAHK9TlePnBSvFWcAGQ== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.11,198,1725346800"; d="scan'208";a="77323159" Received: from unknown (HELO localhost.localdomain) ([10.239.252.253]) by orviesa006-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 12 Oct 2024 02:58:04 -0700 From: Mingjin Ye To: dev@dpdk.org Cc: Mingjin Ye , stable@dpdk.org Subject: [PATCH v2] test: fix option block Date: Sat, 12 Oct 2024 09:35:19 +0000 Message-Id: <20241012093519.1500942-1-mingjinx.ye@intel.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20240314094626.1068059-1-mingjinx.ye@intel.com> References: <20240314094626.1068059-1-mingjinx.ye@intel.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 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 --- v2: The long form of the fix option is "--block". --- 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..75d6a41802 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) -- 2.25.1