DPDK patches and discussions
 help / color / mirror / Atom feed
* [dpdk-dev] [PATCH] test: add delay time in test alarm
@ 2017-03-21  6:03 Qiming Yang
  2017-05-05  2:17 ` [dpdk-dev] [PATCH v2] " Qiming Yang
  0 siblings, 1 reply; 10+ messages in thread
From: Qiming Yang @ 2017-03-21  6:03 UTC (permalink / raw)
  To: dev; +Cc: Qiming Yang

Because accuracy of timing to the microsecond is not guaranteed
in rte_eal_alarm_set, this function will not be called before
the requested time, but may be called a period of time
afterwards which can not be calculated. In order to ensure
test alarm running success, this patch added the delay time
before check the flag.

Signed-off-by: Qiming Yang <qiming.yang@intel.com>
---
 test/test/test_alarm.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/test/test/test_alarm.c b/test/test/test_alarm.c
index ecb2f6d..ad4e908 100644
--- a/test/test/test_alarm.c
+++ b/test/test/test_alarm.c
@@ -169,7 +169,9 @@
 		printf("Error, cancelling head-of-list leads to premature callback\n");
 		return -1;
 	}
-	rte_delay_ms(10);
+	int count = 0;
+	while (flag != 2 && count ++ < 6)
+		rte_delay_ms(10);
 	if (flag != 2) {
 		printf("Error - expected callback not called\n");
 		rte_eal_alarm_cancel(test_remove_in_callback, (void *)-1);
@@ -212,7 +214,7 @@
 		printf("fail to set alarm callback\n");
 		return -1;
 	}
-	while (flag == 0 && count ++ < 6)
+	while (flag == 0 && count ++ < 20)
 		rte_delay_ms(RTE_TEST_CHECK_PERIOD);
 
 	if (flag == 0){
-- 
1.8.3.1

^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2017-07-14  9:36 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-03-21  6:03 [dpdk-dev] [PATCH] test: add delay time in test alarm Qiming Yang
2017-05-05  2:17 ` [dpdk-dev] [PATCH v2] " Qiming Yang
2017-05-05  6:28   ` Chen, Jing D
2017-05-16  3:15     ` Yang, Qiming
2017-06-20  3:24   ` [dpdk-dev] [PATCH v3] " Qiming Yang
2017-07-06  8:28     ` Chen, Jing D
2017-07-07  4:35       ` Yang, Qiming
2017-07-12  1:31         ` Chen, Jing D
2017-07-14  5:51           ` [dpdk-dev] FW: " Yang, Qiming
2017-07-14  9:36           ` [dpdk-dev] " Thomas Monjalon

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).