MCPcopy Create free account
hub / github.com/F-Stack/f-stack / test_metrics_without_init

Function test_metrics_without_init

dpdk/app/test/test_metrics.c:44–74  ·  view source on GitHub ↗

Test Case to check failures when memzone init is not done */

Source from the content-addressed store, hash-verified

42
43 /* Test Case to check failures when memzone init is not done */
44static int
45test_metrics_without_init(void)
46{
47 int err = 0;
48 const uint64_t value[REG_METRIC_COUNT] = {0};
49 const char * const mnames[] = {
50 "mean_bits_in", "mean_bits_out",
51 "peak_bits_in", "peak_bits_out",
52 };
53
54 /* Failure Test: Checking for memzone initialization */
55 err = rte_metrics_reg_name("peak_bits_in");
56 TEST_ASSERT(err == -EIO, "%s, %d", __func__, __LINE__);
57
58 err = rte_metrics_reg_names(&mnames[0], 1);
59 TEST_ASSERT(err == -EIO, "%s, %d", __func__, __LINE__);
60
61 err = rte_metrics_update_value(RTE_METRICS_GLOBAL, KEY, VALUE);
62 TEST_ASSERT(err == -EIO, "%s, %d", __func__, __LINE__);
63
64 err = rte_metrics_update_values(RTE_METRICS_GLOBAL, KEY, &value[0], 4);
65 TEST_ASSERT(err == -EIO, "%s, %d", __func__, __LINE__);
66
67 err = rte_metrics_get_names(NULL, 0);
68 TEST_ASSERT(err == -EIO, "%s, %d", __func__, __LINE__);
69
70 err = rte_metrics_get_values(RTE_METRICS_GLOBAL, NULL, 0);
71 TEST_ASSERT(err == -EIO, "%s, %d", __func__, __LINE__);
72
73 return TEST_SUCCESS;
74}
75
76/* Test Case to validate registering a single metric */
77static int

Callers

nothing calls this directly

Calls 6

rte_metrics_reg_nameFunction · 0.85
rte_metrics_reg_namesFunction · 0.85
rte_metrics_update_valueFunction · 0.85
rte_metrics_get_namesFunction · 0.85
rte_metrics_get_valuesFunction · 0.85

Tested by

no test coverage detected