From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <stable-bounces@dpdk.org>
Received: from dpdk.org (dpdk.org [92.243.14.124])
	by inbox.dpdk.org (Postfix) with ESMTP id 5791CA00E6
	for <public@inbox.dpdk.org>; Wed, 10 Jul 2019 12:53:03 +0200 (CEST)
Received: from [92.243.14.124] (localhost [127.0.0.1])
	by dpdk.org (Postfix) with ESMTP id 386D0397D;
	Wed, 10 Jul 2019 12:53:03 +0200 (CEST)
Received: from mx0b-0016f401.pphosted.com (mx0b-0016f401.pphosted.com
 [67.231.156.173]) by dpdk.org (Postfix) with ESMTP id 3E2CE3195;
 Wed, 10 Jul 2019 12:52:57 +0200 (CEST)
Received: from pps.filterd (m0045851.ppops.net [127.0.0.1])
 by mx0b-0016f401.pphosted.com (8.16.0.27/8.16.0.27) with SMTP id
 x6AAo5CF000514; Wed, 10 Jul 2019 03:52:56 -0700
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=marvell.com;
 h=from : to : cc :
 subject : date : message-id : references : in-reply-to : content-type :
 content-transfer-encoding : mime-version; s=pfpt0818;
 bh=0b2rNgnfsew/GN67awI3m+dDl/nZieGG8jpG/kCBLig=;
 b=TGW/RbpoWbX9spJq53VgwEP9UGf5XkfYtLS8StVe02JMfLL7hqFdaN2IoDLTKFFArbRg
 xGSGhzMeGvzLwMbXX9ufshElRoISSCk1sSkB9EpHqxxgBFBdVV9IBfzowHGzqXMXcQMO
 9rdlcu4sFplXesEg8PTwT2fOQY0pIZ+X2Xyg67JzN1xiosCjVM/F/a7CtuqfCVPGSeke
 qqnEV8l38CQ+74o3pyWoxdJchBrt+uMdbzPz6sf5TzfxszVc/3IIgS4PCI68A2Lpd5Zz
 LYvcecbm2uOuh/6bB4s+yJcQzw0oBAAdm7wJjiiVL5ETASkTQUCekH5S3c9IwQad4xhe Zg== 
Received: from sc-exch04.marvell.com ([199.233.58.184])
 by mx0b-0016f401.pphosted.com with ESMTP id 2tn5nvht39-1
 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT);
 Wed, 10 Jul 2019 03:52:56 -0700
Received: from SC-EXCH04.marvell.com (10.93.176.84) by SC-EXCH04.marvell.com
 (10.93.176.84) with Microsoft SMTP Server (TLS) id 15.0.1367.3; Wed, 10 Jul
 2019 03:52:54 -0700
Received: from NAM05-BY2-obe.outbound.protection.outlook.com (104.47.50.59) by
 SC-EXCH04.marvell.com (10.93.176.84) with Microsoft SMTP Server
 (TLS) id
 15.0.1367.3 via Frontend Transport; Wed, 10 Jul 2019 03:52:54 -0700
ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none;
 b=W4RtbUCEZ5ThGYXj1m7egJmz6B0q64gh2Pwfp002OLeoJl//5cKWwrtUnGL/JsPmZLHAKsUqWNveP+fEO0FNJmpo+Qdi1rPD01292xnSVrzY1Hhlu6E4bbSeixWzGefrmkFJeReBSeeB6Lj9pdM5yoXtWgvWlPIQ96Pn+ingtyzlTuEvDXFgZGwFQEEDaS5cmsuRNsU18q/k5GlrMPUjlpJjeygqvdGCLqfkItV2vlEtcQcxSpAUo2XP8MkIlIGPGzh5NKd6qR9G517Pmx/MXCmuxbLEBemV9Afz4FPVZwKnGSohQ7mP4PZT0a6o2SzXMSizCUohpF/4KXtipCihxw==
ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; 
 s=arcselector9901;
 h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck;
 bh=0b2rNgnfsew/GN67awI3m+dDl/nZieGG8jpG/kCBLig=;
 b=TclTYSt549vmhht+/cnDk+BQwHEoTHF0UemDaZ6xNju8KTKpOKLG/SOluJUVF9zoR8mW7coEGkKkUx69kDPAWIYF3soSYzl9FFw08IbZ2X6NK5d9NS9JcDpuVgn0VfMkCZlAmwIfzZ8pqU3Nn4MSlvpBLZM0VOpVZZQVZYI3Ic16GuB843O8/yo2eWBFGpnGgsVoAcyilLjwQLBtk7It6dok9QXz1A7yAPAVr8IzaEmBZqlV/HkQkKKkWAS2YU7j5N9FDVbdlh/IoZ8zznqBV5HkNdnVYT79oym7mMY+/8bSUQXGKRAt0HW4b1ff5EoefDAOrM9vPGDq7OVpKzcWFg==
ARC-Authentication-Results: i=1; mx.microsoft.com 1;spf=pass
 smtp.mailfrom=marvell.com;dmarc=pass action=none
 header.from=marvell.com;dkim=pass header.d=marvell.com;arc=none
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=marvell.onmicrosoft.com; s=selector2-marvell-onmicrosoft-com;
 h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck;
 bh=0b2rNgnfsew/GN67awI3m+dDl/nZieGG8jpG/kCBLig=;
 b=pZOVf6wrbzcTlueRb6wtb/ViltpOEW8Ce/g2lAdxJG/QlA2wKqkpoJEtzSpSl7cnFyd5j4YaNExkfPACPmUyuqu3PfiT085AS2QJS8e30Z6ifp+p+rcCSuguj5WXzCDeGCbXP66rdP/XdekPQMarUq8NzcHFCqhGWFeM2qWSXxc=
Received: from MN2PR18MB2848.namprd18.prod.outlook.com (20.179.21.149) by
 MN2PR18MB2848.namprd18.prod.outlook.com (20.179.21.149) with Microsoft SMTP
 Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id
 15.20.2073.10; Wed, 10 Jul 2019 10:52:53 +0000
Received: from MN2PR18MB2848.namprd18.prod.outlook.com
 ([fe80::4447:9459:5386:2e18]) by MN2PR18MB2848.namprd18.prod.outlook.com
 ([fe80::4447:9459:5386:2e18%7]) with mapi id 15.20.2073.008; Wed, 10 Jul 2019
 10:52:53 +0000
From: Harman Kalra <hkalra@marvell.com>
To: "remy.horton@intel.com" <remy.horton@intel.com>, "reshma.pattan@intel.com"
 <reshma.pattan@intel.com>, "anatoly.burakov@intel.com"
 <anatoly.burakov@intel.com>, "marko.kovacevic@intel.com"
 <marko.kovacevic@intel.com>, "john.mcnamara@intel.com"
 <john.mcnamara@intel.com>
CC: "dev@dpdk.org" <dev@dpdk.org>, Harman Kalra <hkalra@marvell.com>,
 "stable@dpdk.org" <stable@dpdk.org>
Thread-Topic: [PATCH v3 2/2] test/metrics: fix metrics autotest failure
Thread-Index: AQHVNw2fYSIAphZ4AkauPW7OWdpjwQ==
Date: Wed, 10 Jul 2019 10:52:52 +0000
Message-ID: <1562755934-13358-2-git-send-email-hkalra@marvell.com>
References: <3AEA2BF9852C6F48A459DA490692831F2A4881E7@irsmsx110.ger.corp.intel.com>
 <1562755934-13358-1-git-send-email-hkalra@marvell.com>
In-Reply-To: <1562755934-13358-1-git-send-email-hkalra@marvell.com>
Accept-Language: en-GB, en-US
Content-Language: en-US
X-MS-Has-Attach: 
X-MS-TNEF-Correlator: 
x-clientproxiedby: BM1PR0101CA0040.INDPRD01.PROD.OUTLOOK.COM
 (2603:1096:b00:1a::26) To MN2PR18MB2848.namprd18.prod.outlook.com
 (2603:10b6:208:3e::21)
x-ms-exchange-messagesentrepresentingtype: 1
x-mailer: git-send-email 2.7.4
x-originating-ip: [115.113.156.2]
x-ms-publictraffictype: Email
x-ms-office365-filtering-correlation-id: b232fa2f-a1c0-4274-704f-08d70524c1ff
x-microsoft-antispam: BCL:0; PCL:0;
 RULEID:(2390118)(7020095)(4652040)(8989299)(4534185)(7168020)(4627221)(201703031133081)(201702281549075)(8990200)(5600148)(711020)(4605104)(1401327)(2017052603328)(7193020);
 SRVR:MN2PR18MB2848; 
x-ms-traffictypediagnostic: MN2PR18MB2848:
x-microsoft-antispam-prvs: <MN2PR18MB28482E661A92ADA4CE8FFFF5C5F00@MN2PR18MB2848.namprd18.prod.outlook.com>
x-ms-oob-tlc-oobclassifiers: OLM:6430;
x-forefront-prvs: 0094E3478A
x-forefront-antispam-report: SFV:NSPM;
 SFS:(10009020)(4636009)(346002)(366004)(136003)(39860400002)(396003)(376002)(199004)(189003)(478600001)(50226002)(2906002)(8936002)(26005)(446003)(11346002)(186003)(81156014)(316002)(256004)(2616005)(36756003)(7736002)(54906003)(305945005)(476003)(110136005)(81166006)(8676002)(3846002)(486006)(99286004)(6116002)(76176011)(4326008)(6486002)(2501003)(14454004)(66066001)(52116002)(66446008)(64756008)(66946007)(66476007)(66556008)(68736007)(55236004)(102836004)(2201001)(6512007)(86362001)(71190400001)(71200400001)(386003)(6436002)(6506007)(25786009)(5660300002)(53936002);
 DIR:OUT; SFP:1101; SCL:1; SRVR:MN2PR18MB2848;
 H:MN2PR18MB2848.namprd18.prod.outlook.com; FPR:; SPF:None; LANG:en;
 PTR:InfoNoRecords; A:1; MX:1; 
received-spf: None (protection.outlook.com: marvell.com does not designate
 permitted sender hosts)
x-ms-exchange-senderadcheck: 1
x-microsoft-antispam-message-info: jAAW27cVfFOPsAiAxuAoKhjJzO7vUAp+VeJxljQQbz1cCh8dzXMeFTJH/FRCHDIngwcZpP8pnqxRqTWZWSWxcGSunggWPYstogXK+uzn+n2qoLjLiDECr2CpY93cgvN1Nss+mgHzekH0SIMcOIzrPhiCL2dyjNK/D0oUPY0IBY9zY55xRV9UzllovO6N0/979sWTXCEWx0B66fi7JgDJM6a5s+o1y4br0R02spMb40F593r1VoSwdZQ5ldId8p9ANz6J7eZ/wZ/IjvNF6P5SCJnAik/GWai1JKrvOJUsv5n2lEADQP6/CLR++ufsTTbkZEerd4WFkEFG3WnDuAqwvM1JreqGlAbXAsL3v3aRK0A9J+rsp8x2jT/hoBZfkck4+0xVCp9DvE2QAiOI7VQ+XprAoKLdsfYmidqLqZ3JDg8=
Content-Type: text/plain; charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable
MIME-Version: 1.0
X-MS-Exchange-CrossTenant-Network-Message-Id: b232fa2f-a1c0-4274-704f-08d70524c1ff
X-MS-Exchange-CrossTenant-originalarrivaltime: 10 Jul 2019 10:52:52.9668 (UTC)
X-MS-Exchange-CrossTenant-fromentityheader: Hosted
X-MS-Exchange-CrossTenant-id: 70e1fb47-1155-421d-87fc-2e58f638b6e0
X-MS-Exchange-CrossTenant-mailboxtype: HOSTED
X-MS-Exchange-CrossTenant-userprincipalname: hkalra@marvell.com
X-MS-Exchange-Transport-CrossTenantHeadersStamped: MN2PR18MB2848
X-OriginatorOrg: marvell.com
X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:, ,
 definitions=2019-07-10_04:, , signatures=0
Subject: [dpdk-stable] [PATCH v3 2/2] test/metrics: fix metrics autotest
	failure
X-BeenThere: stable@dpdk.org
X-Mailman-Version: 2.1.15
Precedence: list
List-Id: patches for DPDK stable branches <stable.dpdk.org>
List-Unsubscribe: <https://mails.dpdk.org/options/stable>,
 <mailto:stable-request@dpdk.org?subject=unsubscribe>
List-Archive: <http://mails.dpdk.org/archives/stable/>
List-Post: <mailto:stable@dpdk.org>
List-Help: <mailto:stable-request@dpdk.org?subject=help>
List-Subscribe: <https://mails.dpdk.org/listinfo/stable>,
 <mailto:stable-request@dpdk.org?subject=subscribe>
Errors-To: stable-bounces@dpdk.org
Sender: "stable" <stable-bounces@dpdk.org>

Issue is observed while running 'metrics_autotest' continuously
without quiting. During first execution all test cases pass but
second run onwards first test case fails as library is already
initialized.

To resolve, introduced a new API to deinitialise the library
after all test cases are executed.

Fixes: cd3804242901 ("test/metrics: add unit tests for metrics library")
Cc: stable@dpdk.org

Signed-off-by: Harman Kalra <hkalra@marvell.com>
---
 app/test/test_metrics.c | 17 +++++++++++++++++
 1 file changed, 17 insertions(+)

diff --git a/app/test/test_metrics.c b/app/test/test_metrics.c
index 3c2f36b8a..78b3936ee 100644
--- a/app/test/test_metrics.c
+++ b/app/test/test_metrics.c
@@ -28,6 +28,19 @@ test_metrics_init(void)
 	return TEST_SUCCESS;
 }
=20
+/* Deinitialize metric module. This function must be called
+ * from a primary process after metrics usage is over
+ */
+static int
+test_metrics_deinitialize(void)
+{
+	int err =3D 0;
+	err =3D rte_metrics_deinit();
+	TEST_ASSERT(err =3D=3D 0, "%s, %d", __func__, __LINE__);
+
+	return TEST_SUCCESS;
+}
+
  /* Test Case to check failures when memzone init is not done */
 static int
 test_metrics_without_init(void)
@@ -300,6 +313,10 @@ static struct unit_test_suite metrics_testsuite  =3D {
 		 * arraylist, count size
 		 */
 		TEST_CASE(test_metrics_get_values),
+
+		/* TEST CASE 8: Test to unregister metrics*/
+		TEST_CASE(test_metrics_deinitialize),
+
 		TEST_CASES_END()
 	}
 };
--=20
2.18.0