From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga07.intel.com (mga07.intel.com [134.134.136.100]) by dpdk.org (Postfix) with ESMTP id 96E263257 for ; Wed, 12 Jul 2017 03:31:23 +0200 (CEST) Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by orsmga105.jf.intel.com with ESMTP; 11 Jul 2017 18:31:22 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.40,347,1496127600"; d="scan'208";a="1171369349" Received: from fmsmsx106.amr.corp.intel.com ([10.18.124.204]) by fmsmga001.fm.intel.com with ESMTP; 11 Jul 2017 18:31:22 -0700 Received: from fmsmsx111.amr.corp.intel.com (10.18.116.5) by FMSMSX106.amr.corp.intel.com (10.18.124.204) with Microsoft SMTP Server (TLS) id 14.3.319.2; Tue, 11 Jul 2017 18:31:22 -0700 Received: from shsmsx101.ccr.corp.intel.com (10.239.4.153) by fmsmsx111.amr.corp.intel.com (10.18.116.5) with Microsoft SMTP Server (TLS) id 14.3.319.2; Tue, 11 Jul 2017 18:31:21 -0700 Received: from shsmsx102.ccr.corp.intel.com ([169.254.2.146]) by SHSMSX101.ccr.corp.intel.com ([169.254.1.197]) with mapi id 14.03.0319.002; Wed, 12 Jul 2017 09:31:20 +0800 From: "Chen, Jing D" To: "Yang, Qiming" , "dev@dpdk.org" CC: "Wu, Jingjing" Thread-Topic: [PATCH v3] test: add delay time in test alarm Thread-Index: AQHS6XZB5VyNMZNY10yK/6LvQhL/QKJGkKoggADLQwCACC4qcA== Date: Wed, 12 Jul 2017 01:31:19 +0000 Message-ID: <4341B239C0EFF9468EE453F9E9F4604D3C67D3CA@shsmsx102.ccr.corp.intel.com> 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: Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: 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: Wed, 12 Jul 2017 01:31:24 -0000 > > > > -----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 > > > > 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 > > --- > > 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(-) > > > > 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 @@ > > > > #define RTE_TEST_ALARM_TIMEOUT 10 /* ms */ > > #define RTE_TEST_CHECK_PERIOD 3 /* ms */ > > +#define RTE_TEST_MAX_REPEAT 20 > > > > static volatile int flag; > > > > @@ -96,6 +97,7 @@ static int > > test_multi_alarms(void) > > { > > int rm_count =3D 0; > > + int count =3D 0; > > cb_count.cnt =3D 0; > > > > 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); > > > > if (flag =3D=3D 0){ > > -- > > 2.7.4 Acked-by : Jing Chen