[dpdk-dev] [PATCH v2 3/3] app/test: add unit tests for eal vfio

Burakov, Anatoly anatoly.burakov at intel.com
Thu Aug 22 14:15:20 CEST 2019


On 22-Aug-19 12:53 PM, Chaitanya Babu Talluri wrote:
> Unit test cases are added for eal vfio library.
> eal_vfio_autotest added to meson build file.
> 
> Signed-off-by: Chaitanya Babu Talluri <tallurix.chaitanya.babu at intel.com>
> ---

I think the suggestion to check if VFIO is enabled was a good one. There 
is an API to do that - i think you can do

rte_vfio_is_enabled("vfio_pci")

and if returns 0, you can return TEST_SKIPPED straight away.

>   app/test/Makefile        |   1 +
>   app/test/meson.build     |   2 +
>   app/test/test_eal_vfio.c | 728 +++++++++++++++++++++++++++++++++++++++
>   3 files changed, 731 insertions(+)
>   create mode 100644 app/test/test_eal_vfio.c
> 
> diff --git a/app/test/Makefile b/app/test/Makefile

<snip>

> +static int
> +test_eal_vfio(void)
> +{
> +	printf("VFIO not supported, skipping test\n");
> +	return TEST_SKIPPED;
> +}
> +
> +#else
> +
> +#define PAGESIZE sysconf(_SC_PAGESIZE)
> +#define INVALID_CONTAINER_FD -5
> +#define THREE_PAGES 3
> +#define UNMAPPED_ADDR 0x1500

UNMAPPED_ADDR is not 4K-aligned and will probably trigger other errors 
regarding page alignment checks. I suggest making it either 4K-aligned 
(e.g. 0x2000), or explicitly align it (e.g. RTE_ALIGN(0x1500, PAGESIZE)).


-- 
Thanks,
Anatoly


More information about the dev mailing list