net/sfc: rename array of SW stats descriptions
[dpdk.git] / app / test / test_bitratestats.c
index 3a7d9c0..f4a92c9 100644 (file)
@@ -32,6 +32,20 @@ test_stats_bitrate_create(void)
        return TEST_SUCCESS;
 }
 
+/* To test free the resources from bitrate_create test */
+static int
+test_stats_bitrate_free(void)
+{
+       int ret = 0;
+
+       rte_stats_bitrate_free(bitrate_data);
+
+       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)
@@ -87,8 +101,8 @@ test_stats_bitrate_calc_invalid_portid_1(void)
        int ret = 0;
 
        ret = rte_stats_bitrate_calc(bitrate_data, 33);
-       TEST_ASSERT(ret == -EINVAL, "Test Failed: Expected -%d for higher "
-                       "portid rte_stats_bitrate_calc ret:%d", EINVAL, ret);
+       TEST_ASSERT(ret == -ENODEV, "Test Failed: Expected -%d for higher "
+                       "portid rte_stats_bitrate_calc ret:%d", ENODEV, ret);
 
        return TEST_SUCCESS;
 }
@@ -100,8 +114,8 @@ test_stats_bitrate_calc_invalid_portid_2(void)
        int ret = 0;
 
        ret = rte_stats_bitrate_calc(bitrate_data, -1);
-       TEST_ASSERT(ret == -EINVAL, "Test Failed: Expected -%d for invalid "
-                       "portid rte_stats_bitrate_calc ret:%d", EINVAL, ret);
+       TEST_ASSERT(ret == -ENODEV, "Test Failed: Expected -%d for invalid "
+                       "portid rte_stats_bitrate_calc ret:%d", ENODEV, ret);
 
        return TEST_SUCCESS;
 }
@@ -113,9 +127,9 @@ test_stats_bitrate_calc_non_existing_portid(void)
        int ret = 0;
 
        ret = rte_stats_bitrate_calc(bitrate_data, 31);
-       TEST_ASSERT(ret ==  -EINVAL, "Test Failed: Expected -%d for "
+       TEST_ASSERT(ret ==  -ENODEV, "Test Failed: Expected -%d for "
                        "non-existing portid rte_stats_bitrate_calc ret:%d",
-                       EINVAL, ret);
+                       ENODEV, ret);
 
        return TEST_SUCCESS;
 }
@@ -214,6 +228,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()
        }
 };