diff mbox

Validation: pktio: remove assert side effect

Message ID 1434577908-311-1-git-send-email-mike.holmes@linaro.org
State Accepted
Commit 28e4eb9e9ada4836209b58283ada86ec4bfed121
Headers show

Commit Message

Mike Holmes June 17, 2015, 9:51 p.m. UTC
The assert macro also assigns a variable.
Potentially modifying (disabling) the macro would also change the
operation of the test.

Fixes CID 96200

Signed-off-by: Mike Holmes <mike.holmes@linaro.org>
---
 test/validation/pktio/pktio.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

Comments

Bill Fischofer June 18, 2015, 3:14 a.m. UTC | #1
On Wed, Jun 17, 2015 at 2:51 PM, Mike Holmes <mike.holmes@linaro.org> wrote:

> The assert macro also assigns a variable.
> Potentially modifying (disabling) the macro would also change the
> operation of the test.
>
> Fixes CID 96200
>
> Signed-off-by: Mike Holmes <mike.holmes@linaro.org>
>

Reviewed-by: Bill Fischofer <bill.fischofer@linaro.org>


> ---
>  test/validation/pktio/pktio.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/test/validation/pktio/pktio.c b/test/validation/pktio/pktio.c
> index 8cfa269..93d68f2 100644
> --- a/test/validation/pktio/pktio.c
> +++ b/test/validation/pktio/pktio.c
> @@ -541,7 +541,8 @@ static void pktio_test_inq_remdef(void)
>
>         CU_ASSERT(pktio != ODP_PKTIO_INVALID);
>         CU_ASSERT(create_inq(pktio, ODP_QUEUE_TYPE_POLL) == 0);
> -       CU_ASSERT((inq = odp_pktio_inq_getdef(pktio)) !=
> ODP_QUEUE_INVALID);
> +       inq = odp_pktio_inq_getdef(pktio);
> +       CU_ASSERT(inq != ODP_QUEUE_INVALID);
>         CU_ASSERT(odp_pktio_inq_remdef(pktio) == 0);
>
>         for (i = 0; i < 100; i++) {
> --
> 2.1.4
>
> _______________________________________________
> lng-odp mailing list
> lng-odp@lists.linaro.org
> https://lists.linaro.org/mailman/listinfo/lng-odp
>
Maxim Uvarov July 15, 2015, 11:21 a.m. UTC | #2
Merged,
Maxim.

On 06/18/15 06:14, Bill Fischofer wrote:
>
>
> On Wed, Jun 17, 2015 at 2:51 PM, Mike Holmes <mike.holmes@linaro.org 
> <mailto:mike.holmes@linaro.org>> wrote:
>
>     The assert macro also assigns a variable.
>     Potentially modifying (disabling) the macro would also change the
>     operation of the test.
>
>     Fixes CID 96200
>
>     Signed-off-by: Mike Holmes <mike.holmes@linaro.org
>     <mailto:mike.holmes@linaro.org>>
>
>
> Reviewed-by: Bill Fischofer <bill.fischofer@linaro.org 
> <mailto:bill.fischofer@linaro.org>>
>
>     ---
>      test/validation/pktio/pktio.c | 3 ++-
>      1 file changed, 2 insertions(+), 1 deletion(-)
>
>     diff --git a/test/validation/pktio/pktio.c
>     b/test/validation/pktio/pktio.c
>     index 8cfa269..93d68f2 100644
>     --- a/test/validation/pktio/pktio.c
>     +++ b/test/validation/pktio/pktio.c
>     @@ -541,7 +541,8 @@ static void pktio_test_inq_remdef(void)
>
>             CU_ASSERT(pktio != ODP_PKTIO_INVALID);
>             CU_ASSERT(create_inq(pktio, ODP_QUEUE_TYPE_POLL) == 0);
>     -       CU_ASSERT((inq = odp_pktio_inq_getdef(pktio)) !=
>     ODP_QUEUE_INVALID);
>     +       inq = odp_pktio_inq_getdef(pktio);
>     +       CU_ASSERT(inq != ODP_QUEUE_INVALID);
>             CU_ASSERT(odp_pktio_inq_remdef(pktio) == 0);
>
>             for (i = 0; i < 100; i++) {
>     --
>     2.1.4
>
>     _______________________________________________
>     lng-odp mailing list
>     lng-odp@lists.linaro.org <mailto:lng-odp@lists.linaro.org>
>     https://lists.linaro.org/mailman/listinfo/lng-odp
>
>
>
>
> _______________________________________________
> lng-odp mailing list
> lng-odp@lists.linaro.org
> https://lists.linaro.org/mailman/listinfo/lng-odp
diff mbox

Patch

diff --git a/test/validation/pktio/pktio.c b/test/validation/pktio/pktio.c
index 8cfa269..93d68f2 100644
--- a/test/validation/pktio/pktio.c
+++ b/test/validation/pktio/pktio.c
@@ -541,7 +541,8 @@  static void pktio_test_inq_remdef(void)
 
 	CU_ASSERT(pktio != ODP_PKTIO_INVALID);
 	CU_ASSERT(create_inq(pktio, ODP_QUEUE_TYPE_POLL) == 0);
-	CU_ASSERT((inq = odp_pktio_inq_getdef(pktio)) != ODP_QUEUE_INVALID);
+	inq = odp_pktio_inq_getdef(pktio);
+	CU_ASSERT(inq != ODP_QUEUE_INVALID);
 	CU_ASSERT(odp_pktio_inq_remdef(pktio) == 0);
 
 	for (i = 0; i < 100; i++) {