[PATCH v2 4/7] test: add flow parser unit tests

Stephen Hemminger stephen at networkplumber.org
Tue Jan 6 19:04:54 CET 2026


On Tue,  6 Jan 2026 16:38:34 +0100
Lukas Sismis <sismis at dyna-nic.com> wrote:

> +static int
> +test_flow_parser_command_mapping(void)
> +{
> +	static const char *create_cmd =
> +		"flow create 0 ingress pattern eth / end "
> +		"actions drop / end";
> +	static const char *list_cmd = "flow list 0";
> +	uint8_t outbuf[4096];
> +	struct rte_flow_parser_output *out = (void *)outbuf;
> +	int ret;
> +
> +	ret = rte_flow_parser_init(NULL);
> +	if (ret != 0)
> +		return TEST_FAILED;

Why not:
	TEST_ASSERT(rte_flow_parser_init(NULL) == 0, "rte_flow_parser_init failed");

> +
> +	/* Test flow create command parsing */
> +	memset(outbuf, 0, sizeof(outbuf));

Don't think you need to pre-zero the result buffer.

> +	ret = rte_flow_parser_parse(create_cmd, out, sizeof(outbuf));
> +	if (ret != 0) {
> +		printf("flow create parse failed: %d\n", ret);
> +		return TEST_FAILED;
> +	}

	TEST_ASSERT(ret == 0, "flow create parse failed: %s\n", strerror(-ret));

Or do you want to use rte_errno for error code?


More information about the dev mailing list