[2/2] test/metrics: first test case fails on continuous execution

Message ID 1550846689-6615-2-git-send-email-hkalra@marvell.com (mailing list archive)
State Superseded, archived
Delegated to: Thomas Monjalon
Headers
Series [1/2] metrics: new API to deinitialise metrics library |

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/Intel-compilation success Compilation OK

Commit Message

Harman Kalra Feb. 22, 2019, 2:45 p.m. UTC
  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.

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

Comments

Remy Horton Feb. 25, 2019, 12:21 p.m. UTC | #1
Did quick test run and seems fine.

On 22/02/2019 14:45, Harman Kalra wrote:
<snip>
> Signed-off-by: Harman Kalra <hkalra@marvell.com>
> ---
>  test/test/test_metrics.c | 17 +++++++++++++++++
>  1 file changed, 17 insertions(+)

Acked-by: Remy Horton <remy.horton@intel.com>
  

Patch

diff --git a/test/test/test_metrics.c b/test/test/test_metrics.c
index 3c2f36b8a..78b3936ee 100644
--- a/test/test/test_metrics.c
+++ b/test/test/test_metrics.c
@@ -28,6 +28,19 @@  test_metrics_init(void)
 	return TEST_SUCCESS;
 }
 
+/* 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 = 0;
+	err = rte_metrics_deinit();
+	TEST_ASSERT(err == 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  = {
 		 * arraylist, count size
 		 */
 		TEST_CASE(test_metrics_get_values),
+
+		/* TEST CASE 8: Test to unregister metrics*/
+		TEST_CASE(test_metrics_deinitialize),
+
 		TEST_CASES_END()
 	}
 };