From: Harman Kalra Date: Thu, 11 Jul 2019 09:26:12 +0000 (+0000) Subject: test/metrics: fix second run X-Git-Url: http://git.droids-corp.org/?a=commitdiff_plain;h=9d10f53e403820e35c68ba581c065db7e12cbe3d;p=dpdk.git test/metrics: fix second run 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") Signed-off-by: Harman Kalra Acked-by: Remy Horton Tested-by: Reshma Pattan Acked-by: Reshma Pattan --- diff --git a/app/test/test_metrics.c b/app/test/test_metrics.c index 3c2f36b8a4..78b3936eee 100644 --- a/app/test/test_metrics.c +++ b/app/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() } };