From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <dev-bounces@dpdk.org>
Received: from dpdk.org (dpdk.org [92.243.14.124])
	by inbox.dpdk.org (Postfix) with ESMTP id C6DB7A046B
	for <public@inbox.dpdk.org>; Thu, 22 Aug 2019 14:15:26 +0200 (CEST)
Received: from [92.243.14.124] (localhost [127.0.0.1])
	by dpdk.org (Postfix) with ESMTP id 7A3121BF60;
	Thu, 22 Aug 2019 14:15:25 +0200 (CEST)
Received: from mga05.intel.com (mga05.intel.com [192.55.52.43])
 by dpdk.org (Postfix) with ESMTP id 7B7641BF55
 for <dev@dpdk.org>; Thu, 22 Aug 2019 14:15:24 +0200 (CEST)
X-Amp-Result: SKIPPED(no attachment in message)
X-Amp-File-Uploaded: False
Received: from orsmga005.jf.intel.com ([10.7.209.41])
 by fmsmga105.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384;
 22 Aug 2019 05:15:23 -0700
X-ExtLoop1: 1
X-IronPort-AV: E=Sophos;i="5.64,416,1559545200"; d="scan'208";a="354266262"
Received: from aburakov-mobl1.ger.corp.intel.com (HELO [10.237.220.108])
 ([10.237.220.108])
 by orsmga005.jf.intel.com with ESMTP; 22 Aug 2019 05:15:21 -0700
To: Chaitanya Babu Talluri <tallurix.chaitanya.babu@intel.com>, dev@dpdk.org
Cc: reshma.pattan@intel.com, jananeex.m.parthasarathy@intel.com
References: <1566392575-7965-1-git-send-email-tallurix.chaitanya.babu@intel.com>
 <1566474836-30480-4-git-send-email-tallurix.chaitanya.babu@intel.com>
From: "Burakov, Anatoly" <anatoly.burakov@intel.com>
Message-ID: <55dcdf32-0c8a-0d0c-1b07-8619327be911@intel.com>
Date: Thu, 22 Aug 2019 13:15:20 +0100
User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:60.0) Gecko/20100101
 Thunderbird/60.8.0
MIME-Version: 1.0
In-Reply-To: <1566474836-30480-4-git-send-email-tallurix.chaitanya.babu@intel.com>
Content-Type: text/plain; charset=utf-8; format=flowed
Content-Language: en-US
Content-Transfer-Encoding: 7bit
Subject: Re: [dpdk-dev] [PATCH v2 3/3] app/test: add unit tests for eal vfio
X-BeenThere: dev@dpdk.org
X-Mailman-Version: 2.1.15
Precedence: list
List-Id: DPDK patches and discussions <dev.dpdk.org>
List-Unsubscribe: <https://mails.dpdk.org/options/dev>,
 <mailto:dev-request@dpdk.org?subject=unsubscribe>
List-Archive: <http://mails.dpdk.org/archives/dev/>
List-Post: <mailto:dev@dpdk.org>
List-Help: <mailto:dev-request@dpdk.org?subject=help>
List-Subscribe: <https://mails.dpdk.org/listinfo/dev>,
 <mailto:dev-request@dpdk.org?subject=subscribe>
Errors-To: dev-bounces@dpdk.org
Sender: "dev" <dev-bounces@dpdk.org>

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