diff mbox

[ODP/PATCH,1/2] test_api: timer: odp_timer_create error check

Message ID 1411642048-19451-1-git-send-email-santosh.shukla@linaro.org
State Accepted
Commit 544b46a6ea9617750bd92a805b6452496a4ecb94
Headers show

Commit Message

Santosh Shukla Sept. 25, 2014, 10:47 a.m. UTC
Also set appropriate timer resolution. w/o this error check odp ping
application will segfault.

Signed-off-by: Santosh Shukla <santosh.shukla@linaro.org>
---
 test/api_test/odp_timer_ping.c |   15 ++++++++++++++-
 1 file changed, 14 insertions(+), 1 deletion(-)

Comments

Ankit Jindal Sept. 26, 2014, 5:10 a.m. UTC | #1
Tested-by: Ankit Jindal <ankit.jindal@linaro.org>

Thanks,
Ankit

On 25 September 2014 16:17, Santosh Shukla <santosh.shukla@linaro.org> wrote:
> Also set appropriate timer resolution. w/o this error check odp ping
> application will segfault.
>
> Signed-off-by: Santosh Shukla <santosh.shukla@linaro.org>
> ---
>  test/api_test/odp_timer_ping.c |   15 ++++++++++++++-
>  1 file changed, 14 insertions(+), 1 deletion(-)
>
> diff --git a/test/api_test/odp_timer_ping.c b/test/api_test/odp_timer_ping.c
> index 5ae379f..29a6392 100644
> --- a/test/api_test/odp_timer_ping.c
> +++ b/test/api_test/odp_timer_ping.c
> @@ -43,6 +43,11 @@
>  #define PING_CNT       10
>  #define PING_THRD      2       /* Send and Rx Ping thread */
>
> +/* Nanoseconds */
> +#define RESUS  10000
> +#define MINUS  10000
> +#define MAXUS  10000000
> +
>  static odp_timer_t test_timer_ping;
>  static odp_timer_tmo_t test_ping_tmo;
>
> @@ -353,7 +358,15 @@ int main(int argc ODP_UNUSED, char *argv[] ODP_UNUSED)
>         }
>
>         test_timer_ping = odp_timer_create("ping_timer", pool,
> -                                          1000000, 1000000, 1000000000000UL);
> +                                          RESUS*ODP_TIME_USEC,
> +                                          MINUS*ODP_TIME_USEC,
> +                                          MAXUS*ODP_TIME_USEC);
> +
> +       if (test_timer_ping == ODP_TIMER_INVALID) {
> +               ODP_ERR("Timer create failed.\n");
> +               return -1;
> +       }
> +
>         odp_shm_print_all();
>
>         pingarg.thrdarg.testcase = ODP_TIMER_PING_TEST;
> --
> 1.7.9.5
>
>
> _______________________________________________
> lng-odp mailing list
> lng-odp@lists.linaro.org
> http://lists.linaro.org/mailman/listinfo/lng-odp
Maxim Uvarov Sept. 26, 2014, 12:20 p.m. UTC | #2
Merged, thanks!

Maxim.

On 09/25/2014 02:47 PM, Santosh Shukla wrote:
> Also set appropriate timer resolution. w/o this error check odp ping
> application will segfault.
>
> Signed-off-by: Santosh Shukla <santosh.shukla@linaro.org>
> ---
>   test/api_test/odp_timer_ping.c |   15 ++++++++++++++-
>   1 file changed, 14 insertions(+), 1 deletion(-)
>
> diff --git a/test/api_test/odp_timer_ping.c b/test/api_test/odp_timer_ping.c
> index 5ae379f..29a6392 100644
> --- a/test/api_test/odp_timer_ping.c
> +++ b/test/api_test/odp_timer_ping.c
> @@ -43,6 +43,11 @@
>   #define PING_CNT	10
>   #define PING_THRD	2	/* Send and Rx Ping thread */
>   
> +/* Nanoseconds */
> +#define RESUS	10000
> +#define MINUS	10000
> +#define MAXUS	10000000
> +
>   static odp_timer_t test_timer_ping;
>   static odp_timer_tmo_t test_ping_tmo;
>   
> @@ -353,7 +358,15 @@ int main(int argc ODP_UNUSED, char *argv[] ODP_UNUSED)
>   	}
>   
>   	test_timer_ping = odp_timer_create("ping_timer", pool,
> -					   1000000, 1000000, 1000000000000UL);
> +					   RESUS*ODP_TIME_USEC,
> +					   MINUS*ODP_TIME_USEC,
> +					   MAXUS*ODP_TIME_USEC);
> +
> +	if (test_timer_ping == ODP_TIMER_INVALID) {
> +		ODP_ERR("Timer create failed.\n");
> +		return -1;
> +	}
> +
>   	odp_shm_print_all();
>   
>   	pingarg.thrdarg.testcase = ODP_TIMER_PING_TEST;
diff mbox

Patch

diff --git a/test/api_test/odp_timer_ping.c b/test/api_test/odp_timer_ping.c
index 5ae379f..29a6392 100644
--- a/test/api_test/odp_timer_ping.c
+++ b/test/api_test/odp_timer_ping.c
@@ -43,6 +43,11 @@ 
 #define PING_CNT	10
 #define PING_THRD	2	/* Send and Rx Ping thread */
 
+/* Nanoseconds */
+#define RESUS	10000
+#define MINUS	10000
+#define MAXUS	10000000
+
 static odp_timer_t test_timer_ping;
 static odp_timer_tmo_t test_ping_tmo;
 
@@ -353,7 +358,15 @@  int main(int argc ODP_UNUSED, char *argv[] ODP_UNUSED)
 	}
 
 	test_timer_ping = odp_timer_create("ping_timer", pool,
-					   1000000, 1000000, 1000000000000UL);
+					   RESUS*ODP_TIME_USEC,
+					   MINUS*ODP_TIME_USEC,
+					   MAXUS*ODP_TIME_USEC);
+
+	if (test_timer_ping == ODP_TIMER_INVALID) {
+		ODP_ERR("Timer create failed.\n");
+		return -1;
+	}
+
 	odp_shm_print_all();
 
 	pingarg.thrdarg.testcase = ODP_TIMER_PING_TEST;