diff mbox

[API-NEXT,v3,1/7] validation: time: don't assign int directly to odp_time_t

Message ID 1448313655-7949-2-git-send-email-ivan.khoronzhuk@linaro.org
State Superseded
Headers show

Commit Message

Ivan Khoronzhuk Nov. 23, 2015, 9:20 p.m. UTC
Under opaque type can be structure that cannot be used with direct
values, So, use conversion functions to get time_t to avoid build
issues.

Signed-off-by: Ivan Khoronzhuk <ivan.khoronzhuk@linaro.org>
---
 test/validation/time/time.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Comments

Ivan Khoronzhuk Nov. 30, 2015, 1:43 p.m. UTC | #1
On 30.11.15 15:37, Savolainen, Petri (Nokia - FI/Espoo) wrote:
>
>
>> -----Original Message-----
>> From: lng-odp [mailto:lng-odp-bounces@lists.linaro.org] On Behalf Of EXT
>> Ivan Khoronzhuk
>> Sent: Monday, November 23, 2015 11:21 PM
>> To: lng-odp@lists.linaro.org
>> Subject: [lng-odp] [API-NEXT PATCH v3 1/7] validation: time: don't assign
>> int directly to odp_time_t
>>
>> Under opaque type can be structure that cannot be used with direct
>> values, So, use conversion functions to get time_t to avoid build
>> issues.
>>
>> Signed-off-by: Ivan Khoronzhuk <ivan.khoronzhuk@linaro.org>
>> ---
>>   test/validation/time/time.c | 4 ++--
>>   1 file changed, 2 insertions(+), 2 deletions(-)
>>
>> diff --git a/test/validation/time/time.c b/test/validation/time/time.c
>> index f70c776..3d05a6f 100644
>> --- a/test/validation/time/time.c
>> +++ b/test/validation/time/time.c
>> @@ -36,8 +36,8 @@ void time_test_odp_negative_diff(void)
>>   {
>>   	odp_time_t diff, t1, t2;
>>
>> -	t1 = 10;
>> -	t2 = 5;
>> +	t1 = odp_time_local_from_ns(10);
>> +	t2 = odp_time_local_from_ns(5);
>>   	diff = odp_time_diff(t2, t1);
>>   	CU_ASSERT(odp_time_cmp(diff, ODP_TIME_NULL) > 0);
>
>
> This requires <5ns resolution, which is may not be available all times.
>
> Also "negative_diff" hints that it should be diff(5, 10) instead of diff(10, 5), which is positive after the diff API chance.
>
> -Petri
This patch only needed to allow following patches to be built, not fix resolution impact.
Behind of this, it's temporary required change and test odp_negative_diff() is deleted in patch 7/7
as not needed any more, so fix is not needed.

>
>
>>   }
>> --
>> 1.9.1
>>
>> _______________________________________________
>> 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/time/time.c b/test/validation/time/time.c
index f70c776..3d05a6f 100644
--- a/test/validation/time/time.c
+++ b/test/validation/time/time.c
@@ -36,8 +36,8 @@  void time_test_odp_negative_diff(void)
 {
 	odp_time_t diff, t1, t2;
 
-	t1 = 10;
-	t2 = 5;
+	t1 = odp_time_local_from_ns(10);
+	t2 = odp_time_local_from_ns(5);
 	diff = odp_time_diff(t2, t1);
 	CU_ASSERT(odp_time_cmp(diff, ODP_TIME_NULL) > 0);
 }