From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga02.intel.com (mga02.intel.com [134.134.136.20]) by dpdk.org (Postfix) with ESMTP id 0904A235 for ; Tue, 24 Jul 2018 14:27:27 +0200 (CEST) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga005.fm.intel.com ([10.253.24.32]) by orsmga101.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 24 Jul 2018 05:27:25 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.51,398,1526367600"; d="scan'208";a="247901833" Received: from aburakov-mobl.ger.corp.intel.com (HELO [10.237.220.86]) ([10.237.220.86]) by fmsmga005.fm.intel.com with ESMTP; 24 Jul 2018 05:27:14 -0700 To: Naga Suresh Somarowthu , dev@dpdk.org Cc: remy.horton@intel.com, reshma.pattan@intel.com References: <1531821650-5506-1-git-send-email-jananeex.m.parthasarathy@intel.com> <1532429671-1606-1-git-send-email-naga.sureshx.somarowthu@intel.com> <1532429671-1606-5-git-send-email-naga.sureshx.somarowthu@intel.com> From: "Burakov, Anatoly" Message-ID: <8017c659-e9d7-7d33-bdb8-2d0bef05a275@intel.com> Date: Tue, 24 Jul 2018 13:27:14 +0100 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:52.0) Gecko/20100101 Thunderbird/52.9.1 MIME-Version: 1.0 In-Reply-To: <1532429671-1606-5-git-send-email-naga.sureshx.somarowthu@intel.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit Subject: Re: [dpdk-dev] [PATCH v5 4/4] test: add unit test for pdump library X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 24 Jul 2018 12:27:28 -0000 On 24-Jul-18 11:54 AM, Naga Suresh Somarowthu wrote: > Unit test cases are added for pdump library. > Primary process will act as server, forks a child secondary process. > Secondary process acts as client. > Server will do pdump init to serve any pdump client requests. > Server will create a vdev, send/receive packets continuously in a separate thread. > Client will create virtual rings to receive the packet dump. > Client sends pdump enable/disable requests using either port id or device id. > Packet flow direction can be tx/rx/tx&rx. > In Server, appropriate pdump callbacks are triggered when packets are transmitted/received. > Pdump packet is copied to client rings. > > Signed-off-by: Naga Suresh Somarowthu > Reviewed-by: Reshma Pattan > --- > + char buf[PATH_MAX] = { 0 }; > + > + /* get file for config (fd is always 3) */ > + snprintf(path, sizeof(path), "/proc/self/fd/%d", 3); > + > + /* return NULL on error */ > + if (readlink(path, buf, sizeof(buf)) == -1) > + return NULL; > + > + /* get the basename */ > + snprintf(buf, sizeof(buf), "%s", basename(buf)); > + > + /* copy string all the way from second char up to start of _config */ > + snprintf(prefix, size, "%.*s", > + (int)(strnlen(buf, sizeof(buf)) - sizeof("_config")), &buf[1]); > + > + return prefix; > +} > +#endif This will not work in 18.08, see http://patches.dpdk.org/patch/43102/ Can we perhaps make it a standard test-app function? It is already duplicated in two places, this will make it third. > + > +int > +test_pdump_init(void) > +{ > + int ret = 0; > + > + ret = rte_pdump_init(NULL); > + if (ret < 0) { > + printf("rte_pdump_init failed\n"); > + return -1; > + } > + ret = test_ring_setup(ring_server, &portid); > + if (ret < 0) { > + printf("test_ring_setup failed\n"); > + return -1; > + } > + printf("pdump_init success\n"); > + return ret; > +} -- Thanks, Anatoly