From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga03.intel.com (mga03.intel.com [134.134.136.65]) by dpdk.org (Postfix) with ESMTP id B55F02C8 for ; Fri, 7 Jul 2017 06:35:42 +0200 (CEST) Received: from orsmga001.jf.intel.com ([10.7.209.18]) by orsmga103.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 06 Jul 2017 21:35:41 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.40,320,1496127600"; d="scan'208";a="1148977431" Received: from fmsmsx108.amr.corp.intel.com ([10.18.124.206]) by orsmga001.jf.intel.com with ESMTP; 06 Jul 2017 21:35:41 -0700 Received: from fmsmsx154.amr.corp.intel.com (10.18.116.70) by FMSMSX108.amr.corp.intel.com (10.18.124.206) with Microsoft SMTP Server (TLS) id 14.3.319.2; Thu, 6 Jul 2017 21:35:41 -0700 Received: from shsmsx152.ccr.corp.intel.com (10.239.6.52) by FMSMSX154.amr.corp.intel.com (10.18.116.70) with Microsoft SMTP Server (TLS) id 14.3.319.2; Thu, 6 Jul 2017 21:35:41 -0700 Received: from shsmsx101.ccr.corp.intel.com ([169.254.1.197]) by SHSMSX152.ccr.corp.intel.com ([169.254.6.122]) with mapi id 14.03.0319.002; Fri, 7 Jul 2017 12:35:39 +0800 From: "Yang, Qiming" To: "Chen, Jing D" , "dev@dpdk.org" CC: "Wu, Jingjing" Thread-Topic: [PATCH v3] test: add delay time in test alarm Thread-Index: AQHS6XZB/fMTNKZ5D0as25P7hXgcbqJGCqyAgAHV4FA= Date: Fri, 7 Jul 2017 04:35:38 +0000 Message-ID: References: <1493950673-15953-1-git-send-email-qiming.yang@intel.com> <1497929051-48912-1-git-send-email-qiming.yang@intel.com> <4341B239C0EFF9468EE453F9E9F4604D3C678919@shsmsx102.ccr.corp.intel.com> In-Reply-To: <4341B239C0EFF9468EE453F9E9F4604D3C678919@shsmsx102.ccr.corp.intel.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: dlp-product: dlpe-windows dlp-version: 10.0.102.7 dlp-reaction: no-action x-originating-ip: [10.239.127.40] Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Subject: Re: [dpdk-dev] [PATCH v3] test: add delay time in test alarm X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 07 Jul 2017 04:35:43 -0000 Hi, Mark "2" and "10" is the special number in this test case, not a general number. /* Test that we cannot cancel an alarm from within the callback its= elf * Also test that we can cancel head-of-line callbacks ok.*/ flag =3D 0; recursive_error =3D 0; rte_eal_alarm_set(10 * US_PER_MS, test_remove_in_callback, (void *)= 1); rte_eal_alarm_set(20 * US_PER_MS, test_remove_in_callback, (void *)= 2); > -----Original Message----- > From: Chen, Jing D > Sent: Thursday, July 6, 2017 4:29 PM > To: Yang, Qiming ; dev@dpdk.org > Cc: Wu, Jingjing > Subject: RE: [PATCH v3] test: add delay time in test alarm >=20 >=20 > + while (flag !=3D 2 && count++ < RTE_TEST_MAX_REPEAT) > + rte_delay_ms(10); >=20 > Why you don't replace "2" and "10" with macro? >=20 > -----Original Message----- > From: Yang, Qiming > Sent: Tuesday, June 20, 2017 11:24 AM > To: dev@dpdk.org > Cc: Chen, Jing D ; Wu, Jingjing ; > Yang, Qiming > Subject: [PATCH v3] test: add delay time in test alarm >=20 > 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 ti= me > before check the flag. >=20 > Signed-off-by: Qiming Yang > --- > v2 changes: > * fixed coding style problems > v3 changes: > * replaced the numeric by macro > --- > --- > test/test/test_alarm.c | 9 +++++++-- > 1 file changed, 7 insertions(+), 2 deletions(-) >=20 > diff --git a/test/test/test_alarm.c b/test/test/test_alarm.c index > ecb2f6d..40f55b5 100644 > --- a/test/test/test_alarm.c > +++ b/test/test/test_alarm.c > @@ -47,6 +47,7 @@ >=20 > #define RTE_TEST_ALARM_TIMEOUT 10 /* ms */ > #define RTE_TEST_CHECK_PERIOD 3 /* ms */ > +#define RTE_TEST_MAX_REPEAT 20 >=20 > static volatile int flag; >=20 > @@ -96,6 +97,7 @@ static int > test_multi_alarms(void) > { > int rm_count =3D 0; > + int count =3D 0; > cb_count.cnt =3D 0; >=20 > printf("Expect 6 callbacks in order...\n"); @@ -169,7 +171,10 @@ > test_multi_alarms(void) > printf("Error, cancelling head-of-list leads to premature > callback\n"); > return -1; > } > - rte_delay_ms(10); > + > + while (flag !=3D 2 && count++ < RTE_TEST_MAX_REPEAT) > + rte_delay_ms(10); > + > if (flag !=3D 2) { > printf("Error - expected callback not called\n"); > rte_eal_alarm_cancel(test_remove_in_callback, (void *)-1); > @@ -212,7 +217,7 @@ test_alarm(void) > printf("fail to set alarm callback\n"); > return -1; > } > - while (flag =3D=3D 0 && count ++ < 6) > + while (flag =3D=3D 0 && count++ < RTE_TEST_MAX_REPEAT) > rte_delay_ms(RTE_TEST_CHECK_PERIOD); >=20 > if (flag =3D=3D 0){ > -- > 2.7.4