From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <dev-bounces@dpdk.org>
Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124])
	by inbox.dpdk.org (Postfix) with ESMTP id 49013A0C45;
	Sat,  4 Sep 2021 09:23:01 +0200 (CEST)
Received: from [217.70.189.124] (localhost [127.0.0.1])
	by mails.dpdk.org (Postfix) with ESMTP id CB69F40E3C;
	Sat,  4 Sep 2021 09:23:00 +0200 (CEST)
Received: from szxga01-in.huawei.com (szxga01-in.huawei.com [45.249.212.187])
 by mails.dpdk.org (Postfix) with ESMTP id D02F340DDD
 for <dev@dpdk.org>; Sat,  4 Sep 2021 09:22:58 +0200 (CEST)
Received: from dggemv703-chm.china.huawei.com (unknown [172.30.72.56])
 by szxga01-in.huawei.com (SkyGuard) with ESMTP id 4H1mHR03ZSzblrD;
 Sat,  4 Sep 2021 15:18:59 +0800 (CST)
Received: from dggpeml500024.china.huawei.com (7.185.36.10) by
 dggemv703-chm.china.huawei.com (10.3.19.46) with Microsoft SMTP Server
 (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id
 15.1.2176.2; Sat, 4 Sep 2021 15:22:55 +0800
Received: from [10.40.190.165] (10.40.190.165) by
 dggpeml500024.china.huawei.com (7.185.36.10) with Microsoft SMTP Server
 (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id
 15.1.2176.2; Sat, 4 Sep 2021 15:22:54 +0800
To: "Walsh, Conor" <conor.walsh@intel.com>, "thomas@monjalon.net"
 <thomas@monjalon.net>, "Yigit, Ferruh" <ferruh.yigit@intel.com>, "Richardson, 
 Bruce" <bruce.richardson@intel.com>, "jerinj@marvell.com"
 <jerinj@marvell.com>, "jerinjacobk@gmail.com" <jerinjacobk@gmail.com>,
 "andrew.rybchenko@oktetlabs.ru" <andrew.rybchenko@oktetlabs.ru>
CC: "dev@dpdk.org" <dev@dpdk.org>, "mb@smartsharesystems.com"
 <mb@smartsharesystems.com>, "nipun.gupta@nxp.com" <nipun.gupta@nxp.com>,
 "hemant.agrawal@nxp.com" <hemant.agrawal@nxp.com>,
 "maxime.coquelin@redhat.com" <maxime.coquelin@redhat.com>,
 "honnappa.nagarahalli@arm.com" <honnappa.nagarahalli@arm.com>,
 "david.marchand@redhat.com" <david.marchand@redhat.com>, "sburla@marvell.com"
 <sburla@marvell.com>, "pkapoor@marvell.com" <pkapoor@marvell.com>, "Ananyev,
 Konstantin" <konstantin.ananyev@intel.com>, "Laatz, Kevin"
 <kevin.laatz@intel.com>
References: <1625231891-2963-1-git-send-email-fengchengwen@huawei.com>
 <1630588395-2804-1-git-send-email-fengchengwen@huawei.com>
 <1630588395-2804-8-git-send-email-fengchengwen@huawei.com>
 <PH0PR11MB5207409DEAEDBEC13394016CFFCE9@PH0PR11MB5207.namprd11.prod.outlook.com>
 <21ebd68c-894b-5537-dbb8-06ecf550c563@huawei.com>
 <PH0PR11MB5207E4656AE6E3219EBCE0EBFFCF9@PH0PR11MB5207.namprd11.prod.outlook.com>
From: fengchengwen <fengchengwen@huawei.com>
Message-ID: <88fc081d-cb1a-10fe-8e1a-e1135d8968a9@huawei.com>
Date: Sat, 4 Sep 2021 15:22:54 +0800
User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:68.0) Gecko/20100101
 Thunderbird/68.11.0
MIME-Version: 1.0
In-Reply-To: <PH0PR11MB5207E4656AE6E3219EBCE0EBFFCF9@PH0PR11MB5207.namprd11.prod.outlook.com>
Content-Type: text/plain; charset="utf-8"
Content-Language: en-US
Content-Transfer-Encoding: 8bit
X-Originating-IP: [10.40.190.165]
X-ClientProxiedBy: dggems703-chm.china.huawei.com (10.3.19.180) To
 dggpeml500024.china.huawei.com (7.185.36.10)
X-CFilter-Loop: Reflected
Subject: Re: [dpdk-dev] [PATCH v19 7/7] app/test: add dmadev API test
X-BeenThere: dev@dpdk.org
X-Mailman-Version: 2.1.29
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 2021/9/3 23:38, Walsh, Conor wrote:
> 
>> This is a tradeoff point. If we changed the log level of dmadev, it is difficult to
>> know where the test case fails.
>>
>> So I prefer add more meaningful information, at least print out the function
>> name.
>>
>> And V19 add format function name in log default, so the rte_dmadev's log
>> will show like:
>>
>> rte_dmadev_configure(): Invalid dev_id=64
>> rte_dmadev_configure(): Device 4 configure zero vchans
>> rte_dmadev_configure(): Device 4 configure too many vchans
>> rte_dmadev_configure(): Device 4 don't support silent
>> test_dmadev_configure Passed
>> rte_dmadev_vchan_setup(): Invalid dev_id=64
>> rte_dmadev_vchan_setup(): Device 4 number of descriptors invalid
>> rte_dmadev_vchan_setup(): Device 4 vchan out range!
>> rte_dmadev_vchan_setup(): Device 4 direction invalid!
>> rte_dmadev_vchan_setup(): Device 4 direction invalid!
>> rte_dmadev_vchan_setup(): Device 4 don't support mem2dev transfer
>> rte_dmadev_vchan_setup(): Device 4 don't support dev2mem transfer
>> rte_dmadev_vchan_setup(): Device 4 don't support dev2dev transfer
>> rte_dmadev_vchan_setup(): Device 4 number of descriptors invalid
>> rte_dmadev_vchan_setup(): Device 4 number of descriptors invalid
>> rte_dmadev_vchan_setup(): Device 4 source port type invalid
>> rte_dmadev_vchan_setup(): Device 4 destination port type invalid
> 
> I thought it would be cleaner, could you suppress the output only before and re-enable after negative testing?
> It's a lot of output to print to a user, in the driver tests extra information is only printed in the case
> of an error or failure. The line of code shown below will only suppress output from the dmadev lib not
> EAL or test.

Yes, you're right, UT is fine enough to quickly pinpoint which error.

will use your method to modify, thanks

> 
> I don’t have a very strong opinion either way, I wanted to improve usability.
> 
> With or without this change/cleanup:
> 
> Reviewed-by: Conor Walsh <conor.walsh@intel.com>
> 
>>
>>
>> On 2021/9/2 22:11, Walsh, Conor wrote:
>>> Hi Chengwen,
>>>
>>> The output from the API tests is not very straightforward to interpret if you
>> are not familiar with these tests.
>>> Could we change the log level of the dmadev library before and after the
>> API tests using something similar to
>>> The code I have included inline below?
>>>
>>>> +static int
>>>> +testsuite_setup(uint16_t dev_id)
>>>> +{
>>>> +	test_dev_id = dev_id;
>>>> +	invalid_dev_id = RTE_DMADEV_MAX_DEVS;
>>>> +
>>>> +	src = rte_malloc("dmadev_test_src", TEST_MEMCPY_SIZE, 0);
>>>> +	if (src == NULL)
>>>> +		return -ENOMEM;
>>>> +	dst = rte_malloc("dmadev_test_dst", TEST_MEMCPY_SIZE, 0);
>>>> +	if (dst == NULL)
>>>> +		return -ENOMEM;
>>>
>>> 	/* Set dmadev log level to critical to suppress unnecessary output
>> during API tests. */
>>> 	rte_log_set_level_pattern("lib.dmadev", RTE_LOG_CRIT);
>>>> +
>>>> +	total = 0;
>>>> +	passed = 0;
>>>> +	failed = 0;
>>>> +
>>>> +	return 0;
>>>> +}
>>>> +
>>>> +static void
>>>> +testsuite_teardown(void)
>>>> +{
>>>> +	rte_free(src);
>>>> +	rte_free(dst);
>>>> +	/* Ensure the dmadev is stopped. */
>>>> +	rte_dmadev_stop(test_dev_id);
>>> 	rte_log_set_level_pattern("lib.dmadev", RTE_LOG_INFO);
>>>> +}
>>>
>>> This change would bring your output down from:
>>>
>>> ### Test dmadev infrastructure using skeleton driver
>>> test_dmadev_get_dev_id Passed
>>> test_dmadev_is_valid_dev Passed
>>> test_dmadev_count Passed
>>> Invalid dev_id=64
>>> test_dmadev_info_get Passed
>>> Invalid dev_id=64
>>> Device 1 configure zero vchans
>>> Device 1 configure too many vchans
>>> Device 1 don't support silent
>>> test_dmadev_configure Passed
>>> Invalid dev_id=64
>>> Device 1 number of descriptors invalid
>>> Device 1 vchan out range!
>>> Device 1 direction invalid!
>>> Device 1 direction invalid!
>>> Device 1 don't support mem2dev transfer
>>> Device 1 don't support dev2mem transfer
>>> Device 1 don't support dev2dev transfer
>>> Device 1 number of descriptors invalid
>>> Device 1 number of descriptors invalid
>>> Device 1 source port type invalid
>>> Device 1 destination port type invalid
>>> test_dmadev_vchan_setup Passed
>>> Invalid dev_id=64
>>> Invalid dev_id=64
>>> Device 1 must be stopped to allow configuration
>>> Device 1 must be stopped to allow configuration
>>> test_dmadev_start_stop Passed
>>> Invalid dev_id=64
>>> Invalid dev_id=64
>>> Invalid dev_id=64
>>> Device 1 vchan 1 out of range
>>> Device 1 vchan 1 out of range
>>> test_dmadev_stats Passed
>>> test_dmadev_completed Passed
>>> test_dmadev_completed_status Passed
>>> Device 1 already stopped
>>> Total tests   : 10
>>> Passed        : 10
>>> Failed        : 0
>>> skeldma_remove(): Remove dma_skeleton dmadev
>>>
>>> To:
>>>
>>> ### Test dmadev infrastructure using skeleton driver
>>> test_dmadev_get_dev_id Passed
>>> test_dmadev_is_valid_dev Passed
>>> test_dmadev_count Passed
>>> test_dmadev_info_get Passed
>>> test_dmadev_configure Passed
>>> test_dmadev_vchan_setup Passed
>>> test_dmadev_start_stop Passed
>>> test_dmadev_stats Passed
>>> test_dmadev_completed Passed
>>> test_dmadev_completed_status Passed
>>> Total tests   : 10
>>> Passed        : 10
>>> Failed        : 0
>>> skeldma_remove(): Remove dma_skeleton dmadev
>>>
>>> Thanks,
>>> Conor.
>>> .
>>>