[PATCHv2,4/7] validation: pktio: don't print to stdout

Message ID 1441360547-18999-4-git-send-email-stuart.haslam@linaro.org
State New
Headers show

Commit Message

Stuart Haslam Sept. 4, 2015, 9:55 a.m.
To avoid cluttering the test output, unit tests should not print directly
to stdout.

Signed-off-by: Stuart Haslam <stuart.haslam@linaro.org>
---
 test/validation/pktio/pktio.c | 6 ------
 1 file changed, 6 deletions(-)

Comments

Maxim Uvarov Sept. 7, 2015, 11:05 a.m. | #1
When I added that print I expected that person who executed test for 
specific pktio can verify that
printed mac address is the same as read pktio (device). With removing 
that print there will be no
way to prove that right mac addr was returned.

Maxim.

On 09/04/15 12:55, Stuart Haslam wrote:
> To avoid cluttering the test output, unit tests should not print directly
> to stdout.
>
> Signed-off-by: Stuart Haslam <stuart.haslam@linaro.org>
> ---
>   test/validation/pktio/pktio.c | 6 ------
>   1 file changed, 6 deletions(-)
>
> diff --git a/test/validation/pktio/pktio.c b/test/validation/pktio/pktio.c
> index 512a77c..50cd901 100644
> --- a/test/validation/pktio/pktio.c
> +++ b/test/validation/pktio/pktio.c
> @@ -563,15 +563,9 @@ void pktio_test_mac(void)
>   
>   	pktio = create_pktio(iface_name[0], ODP_QUEUE_TYPE_SCHED, 0);
>   
> -	printf("testing mac for %s\n", iface_name[0]);
> -
>   	mac_len = odp_pktio_mac_addr(pktio, mac_addr, sizeof(mac_addr));
>   	CU_ASSERT(ODPH_ETHADDR_LEN == mac_len);
>   
> -	printf(" %X:%X:%X:%X:%X:%X ",
> -	       mac_addr[0], mac_addr[1], mac_addr[2],
> -	       mac_addr[3], mac_addr[4], mac_addr[5]);
> -
>   	/* Fail case: wrong addr_size. Expected <0. */
>   	mac_len = odp_pktio_mac_addr(pktio, mac_addr, 2);
>   	CU_ASSERT(mac_len < 0);
Stuart Haslam Sept. 7, 2015, 2:35 p.m. | #2
On Mon, Sep 07, 2015 at 02:05:29PM +0300, Maxim Uvarov wrote:
> When I added that print I expected that person who executed test for
> specific pktio can verify that
> printed mac address is the same as read pktio (device).

Hrm, I've never done that.

> With removing that print there will be no
> way to prove that right mac addr was returned.
> 
> Maxim.

I don't think the validation tests should expect visual inspection of
the output. We could test the correct MAC is returned by using it as
the destination address with promiscuous mode disabled.
Maxim Uvarov Sept. 8, 2015, 9:25 a.m. | #3
On 09/07/15 17:35, Stuart Haslam wrote:
> On Mon, Sep 07, 2015 at 02:05:29PM +0300, Maxim Uvarov wrote:
>> When I added that print I expected that person who executed test for
>> specific pktio can verify that
>> printed mac address is the same as read pktio (device).
> Hrm, I've never done that.
>
>> With removing that print there will be no
>> way to prove that right mac addr was returned.
>>
>> Maxim.
> I don't think the validation tests should expect visual inspection of
> the output. We could test the correct MAC is returned by using it as
> the destination address with promiscuous mode disabled.
>

we also can pass correct mac in pktio_env as device names and inside
test expect that they match. But with promisc mode it looks more 
interesting.

Maxim.

Patch

diff --git a/test/validation/pktio/pktio.c b/test/validation/pktio/pktio.c
index 512a77c..50cd901 100644
--- a/test/validation/pktio/pktio.c
+++ b/test/validation/pktio/pktio.c
@@ -563,15 +563,9 @@  void pktio_test_mac(void)
 
 	pktio = create_pktio(iface_name[0], ODP_QUEUE_TYPE_SCHED, 0);
 
-	printf("testing mac for %s\n", iface_name[0]);
-
 	mac_len = odp_pktio_mac_addr(pktio, mac_addr, sizeof(mac_addr));
 	CU_ASSERT(ODPH_ETHADDR_LEN == mac_len);
 
-	printf(" %X:%X:%X:%X:%X:%X ",
-	       mac_addr[0], mac_addr[1], mac_addr[2],
-	       mac_addr[3], mac_addr[4], mac_addr[5]);
-
 	/* Fail case: wrong addr_size. Expected <0. */
 	mac_len = odp_pktio_mac_addr(pktio, mac_addr, 2);
 	CU_ASSERT(mac_len < 0);