test: cleanup when leaving bitrate and latency tests

Both bitratestats_autotest latency test initializes the metrics library.
It should be cleaned during exit.

Signed-off-by: Hemant Agrawal <hemant.agrawal@nxp.com>
Acked-by: David Marchand <david.marchand@redhat.com>
This commit is contained in:
Hemant Agrawal 2020-05-19 16:22:58 +05:30 committed by David Marchand
parent 1168be0077
commit d3f7095baf
2 changed files with 17 additions and 0 deletions

View file

@ -32,6 +32,18 @@ test_stats_bitrate_create(void)
return TEST_SUCCESS;
}
/* To test free the resources from bitrate_reg test */
static int
test_stats_bitrate_free(void)
{
int ret = 0;
ret = rte_metrics_deinit();
TEST_ASSERT(ret >= 0, "Test Failed: rte_metrics_deinit failed");
return TEST_SUCCESS;
}
/* To test bit rate registration */
static int
test_stats_bitrate_reg(void)
@ -214,6 +226,8 @@ unit_test_suite bitratestats_testsuite = {
*/
TEST_CASE_ST(test_bit_packet_forward, NULL,
test_stats_bitrate_calc),
/* TEST CASE 9: Test to do the cleanup w.r.t create */
TEST_CASE(test_stats_bitrate_free),
TEST_CASES_END()
}
};

View file

@ -60,6 +60,9 @@ static int test_latency_uninit(void)
ret = rte_latencystats_uninit();
TEST_ASSERT(ret >= 0, "Test Failed: rte_latencystats_uninit failed");
ret = rte_metrics_deinit();
TEST_ASSERT(ret >= 0, "Test Failed: rte_metrics_deinit failed");
return TEST_SUCCESS;
}