test/metrics: Fixed a negative case to pass

Message ID 20181206150106.154090-1-hkalra@marvell.com (mailing list archive)
State Superseded, archived
Delegated to: Thomas Monjalon
Headers
Series test/metrics: Fixed a negative case to pass |

Checks

Context Check Description
ci/Intel-compilation success Compilation OK

Commit Message

Harman Kalra Dec. 6, 2018, 3:01 p.m. UTC
  Negative test case for passing invalid count size to
rte_metrics_update_values() will pass if count value
is any value greater than 1 because set size wrt to
key id 1 is 1 and passing 0 as no of values to be
updated will not hit the ERANGE check.

Signed-off-by: Harman Kalra <hkalra@marvell.com>
---
 test/test/test_metrics.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
  

Comments

Remy Horton Dec. 7, 2018, 11:45 a.m. UTC | #1
Git apply choked on the patch but it applied using patch -p0 - I'm 
guessing this is a problem with patches made using diff rather than git 
format-patch. The change itself is fine though. :)

On 06/12/2018 15:01, Harman Kalra wrote:
> Negative test case for passing invalid count size to
> rte_metrics_update_values() will pass if count value
> is any value greater than 1 because set size wrt to
> key id 1 is 1 and passing 0 as no of values to be
> updated will not hit the ERANGE check.
>
> Signed-off-by: Harman Kalra <hkalra@marvell.com>

Missing fixline:

Fixes: cd3804242901 ("test/metrics: add unit tests for metrics library")

Acked-by: Remy Horton <remy.horton@intel.com>
  

Patch

diff --git test/test/test_metrics.c test/test/test_metrics.c
index 94d54d71c..3c2f36b8a 100644
--- test/test/test_metrics.c
+++ test/test/test_metrics.c
@@ -154,7 +154,7 @@  test_metrics_update_values(void)
 
 	/* Failed Test: Invalid count size */
 	err = rte_metrics_update_values(RTE_METRICS_GLOBAL,
-			 KEY, &value[0], 0);
+			 KEY, &value[0], ARRAY_SIZE(value));
 	TEST_ASSERT(err < 0, "%s, %d", __func__, __LINE__);
 
 	/* Failed Test: Invalid port_id(lower value) and valid data */