Re: [PATCH v2] test: add unit tests for metrics library
From: Remy Horton <hidden>
Date: 2018-07-24 14:53:59
Tested using the following patches also applied: http://patches.dpdk.org/patch/42097/ http://patches.dpdk.org/patch/42098/ http://patches.dpdk.org/patch/42510/ http://patches.dpdk.org/patch/42971/ Two test-cases fail, but these in themselves ought not block this patch. Details below. Acked-by: Remy Horton <redacted>
+ /* Test Case to check failures when memzone init is not done */
+static int
+test_metrics_without_init(void)
+{
+ int err = 0;
+ const uint64_t value[REG_METRIC_COUNT] = {0};
+ const char * const mnames[] = {
+ "mean_bits_in", "mean_bits_out",
+ "peak_bits_in", "peak_bits_out",
+ };
+
+ /* Failure Test: Checking for memzone initialization */
+ err = rte_metrics_reg_name(NULL);
+ TEST_ASSERT(err == -EIO, "%s, %d", __func__, __LINE__);Returns -EINVAL instead of -EIO due to NULL check coming before memzone check. Suggest using non-NULL value.
+/* Test case to validate update a list of metrics */
+static int
+test_metrics_update_values(void)
+{[..]
+ /* Failed Test: Invalid count size */ + err = rte_metrics_update_values(RTE_METRICS_GLOBAL, + KEY, &value[0], 0); + TEST_ASSERT(err < 0, "%s, %d", __func__, __LINE__);
Test fails, fault with library: Silent handling length of zero. Will send patch.