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 0FE0345845; Thu, 22 Aug 2024 12:36:13 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id DACE742E6E; Thu, 22 Aug 2024 12:36:12 +0200 (CEST) Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.13]) by mails.dpdk.org (Postfix) with ESMTP id 4E9BA42E66 for ; Thu, 22 Aug 2024 12:36:11 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1724322972; x=1755858972; h=from:to:cc:subject:date:message-id:mime-version: content-transfer-encoding; bh=n+C7KryW2E1KAqlo4mXU7YOdxV3su+mZ4koTXDteqyw=; b=UHxB2AWmLnMtVxSRZsDBHTyhgEUBhZaO914xdDNp34NlKpny2IKHNCLk l2p4F+vC5VhakPTl15dIF2Mx2F0vbxBJGIXs7y+1+BLb4OP7K/4Lkw+tr cFW4fAaXHjiSFfVJIJ/HiAco1bR+x0FDI1BGjcOlS558klNQPZeicOXKz DQGpDMV2gigrzAc9xpij3DIdfXFQ6D+e9I0gYf+UOSDyldEFJwBjsvac7 olstbcgKaBfsIMFqD5x1ITdsiUh5pa+8CVXaft+oJAYktzDh7p4kY06oD 0ZlzqzieSk/lQDtGM76XC/kp+wrCOb7ACx535ZiQgySkHGWCXs6SNlV+K g==; X-CSE-ConnectionGUID: ueQOSLURRye/UgxrUPzjRQ== X-CSE-MsgGUID: XQc5xzrTSByaSKp3di57uA== X-IronPort-AV: E=McAfee;i="6700,10204,11171"; a="33881244" X-IronPort-AV: E=Sophos;i="6.10,166,1719903600"; d="scan'208";a="33881244" Received: from fmviesa003.fm.intel.com ([10.60.135.143]) by orvoesa105.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 22 Aug 2024 03:36:11 -0700 X-CSE-ConnectionGUID: CKGFgsDcRNm3szcCixOOeA== X-CSE-MsgGUID: pTWFPulORHK7slVyxjgGKQ== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.10,166,1719903600"; d="scan'208";a="65600369" Received: from unknown (HELO silpixa00401385.ir.intel.com) ([10.237.214.39]) by fmviesa003.fm.intel.com with ESMTP; 22 Aug 2024 03:36:10 -0700 From: Bruce Richardson To: dev@dpdk.org Cc: Bruce Richardson Subject: [PATCH] app/testpmd: show output of commands read from file Date: Thu, 22 Aug 2024 11:36:04 +0100 Message-ID: <20240822103604.113246-1-bruce.richardson@intel.com> X-Mailer: git-send-email 2.43.0 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 Testpmd supports the "--cmdline-file" parameter to read a set of initial commands from a file. However, the only indication that this has been done successfully on startup is a single-line message, no output from the commands is seen. To improve usability here, we can use cmdline_new rather than cmdline_file_new and have the output from the various commands sent to stdout, allowing the user to see better what is happening. Signed-off-by: Bruce Richardson --- app/test-pmd/cmdline.c | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/app/test-pmd/cmdline.c b/app/test-pmd/cmdline.c index b7759e38a8..2a449b6b2f 100644 --- a/app/test-pmd/cmdline.c +++ b/app/test-pmd/cmdline.c @@ -6,6 +6,7 @@ #include #include #include +#include #include #include #include @@ -13431,7 +13432,18 @@ cmdline_read_from_file(const char *filename) { struct cmdline *cl; - cl = cmdline_file_new(main_ctx, "testpmd> ", filename); + /* cmdline_file_new does not produce any output which is not ideal here. + * Much better to show output of the commands, so we open filename directly + * and then pass that to cmdline_new with stdout as the output path. + */ + int fd = open(filename, O_RDONLY); + if (fd < 0) { + fprintf(stderr, "Failed to open file %s: %s\n", + filename, strerror(errno)); + return; + } + + cl = cmdline_new(main_ctx, "testpmd> ", fd, 1); if (cl == NULL) { fprintf(stderr, "Failed to create file based cmdline context: %s\n", -- 2.43.0