[dpdk-dev] [PATCH v5 4/4] test: add unit test for pdump library

Burakov, Anatoly anatoly.burakov at intel.com
Tue Jul 24 14:27:14 CEST 2018


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 <naga.sureshx.somarowthu at intel.com>
> Reviewed-by: Reshma Pattan <reshma.pattan at intel.com>
> ---

<snip>

> +	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


More information about the dev mailing list