diff mbox

validation: queue: refactor test to avoid coverity issues

Message ID 1449057923-27117-1-git-send-email-bill.fischofer@linaro.org
State Accepted
Commit 89701399735b08f8a8c90574c85a7589e51d2cdf
Headers show

Commit Message

Bill Fischofer Dec. 2, 2015, 12:05 p.m. UTC
Change CU_ASSERT order to avoid side effect issues identified by Coverity

Signed-off-by: Bill Fischofer <bill.fischofer@linaro.org>
---
 test/validation/queue/queue.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

Comments

Ivan Khoronzhuk Dec. 2, 2015, 12:25 p.m. UTC | #1
On 02.12.15 14:05, Bill Fischofer wrote:
> Change CU_ASSERT order to avoid side effect issues identified by Coverity
>
> Signed-off-by: Bill Fischofer <bill.fischofer@linaro.org>

Reviewed-by: Ivan Khoronzhuk <ivan.khoronzhuk@linaro.org>

> ---
>   test/validation/queue/queue.c | 3 ++-
>   1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/test/validation/queue/queue.c b/test/validation/queue/queue.c
> index 3b522c9..3c1c64a 100644
> --- a/test/validation/queue/queue.c
> +++ b/test/validation/queue/queue.c
> @@ -173,7 +173,8 @@ void queue_test_info(void)
>   	CU_ASSERT(info.param.sched.prio == odp_queue_sched_prio(q_order));
>   	CU_ASSERT(info.param.sched.sync == odp_queue_sched_type(q_order));
>   	CU_ASSERT(info.param.sched.group == odp_queue_sched_group(q_order));
> -	CU_ASSERT(ret = odp_queue_lock_count(q_order) >= 0);
> +	ret = odp_queue_lock_count(q_order);
> +	CU_ASSERT(ret >= 0);
>   	lock_count = (unsigned) ret;
>   	CU_ASSERT(info.param.sched.lock_count == lock_count);
>
>
Maxim Uvarov Dec. 3, 2015, 4:31 p.m. UTC | #2
Merged,
Maxim.

On 12/02/2015 15:25, Ivan Khoronzhuk wrote:
>
>
> On 02.12.15 14:05, Bill Fischofer wrote:
>> Change CU_ASSERT order to avoid side effect issues identified by 
>> Coverity
>>
>> Signed-off-by: Bill Fischofer <bill.fischofer@linaro.org>
>
> Reviewed-by: Ivan Khoronzhuk <ivan.khoronzhuk@linaro.org>
>
>> ---
>>   test/validation/queue/queue.c | 3 ++-
>>   1 file changed, 2 insertions(+), 1 deletion(-)
>>
>> diff --git a/test/validation/queue/queue.c 
>> b/test/validation/queue/queue.c
>> index 3b522c9..3c1c64a 100644
>> --- a/test/validation/queue/queue.c
>> +++ b/test/validation/queue/queue.c
>> @@ -173,7 +173,8 @@ void queue_test_info(void)
>>       CU_ASSERT(info.param.sched.prio == odp_queue_sched_prio(q_order));
>>       CU_ASSERT(info.param.sched.sync == odp_queue_sched_type(q_order));
>>       CU_ASSERT(info.param.sched.group == 
>> odp_queue_sched_group(q_order));
>> -    CU_ASSERT(ret = odp_queue_lock_count(q_order) >= 0);
>> +    ret = odp_queue_lock_count(q_order);
>> +    CU_ASSERT(ret >= 0);
>>       lock_count = (unsigned) ret;
>>       CU_ASSERT(info.param.sched.lock_count == lock_count);
>>
>>
>
diff mbox

Patch

diff --git a/test/validation/queue/queue.c b/test/validation/queue/queue.c
index 3b522c9..3c1c64a 100644
--- a/test/validation/queue/queue.c
+++ b/test/validation/queue/queue.c
@@ -173,7 +173,8 @@  void queue_test_info(void)
 	CU_ASSERT(info.param.sched.prio == odp_queue_sched_prio(q_order));
 	CU_ASSERT(info.param.sched.sync == odp_queue_sched_type(q_order));
 	CU_ASSERT(info.param.sched.group == odp_queue_sched_group(q_order));
-	CU_ASSERT(ret = odp_queue_lock_count(q_order) >= 0);
+	ret = odp_queue_lock_count(q_order);
+	CU_ASSERT(ret >= 0);
 	lock_count = (unsigned) ret;
 	CU_ASSERT(info.param.sched.lock_count == lock_count);