[v2,2/2] test/malloc: add bad parameter tests for realloc

Message ID 182dadd4c7c8acd07d186c37fbf0a35a3d5ab6b0.1585818128.git.anatoly.burakov@intel.com (mailing list archive)
State Accepted, archived
Delegated to: David Marchand
Headers
Series [v2,1/2] test/malloc: run realloc tests on external heap |

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/Intel-compilation success Compilation OK
ci/travis-robot success Travis build: passed

Commit Message

Anatoly Burakov April 2, 2020, 9:02 a.m. UTC
  Realloc did not have bad parameter autotest. Add them.

Signed-off-by: Anatoly Burakov <anatoly.burakov@intel.com>
Reviewed-by: David Christensen <drc@linux.vnet.ibm.com>
---
 app/test/test_malloc.c | 10 ++++++++++
 1 file changed, 10 insertions(+)
  

Patch

diff --git a/app/test/test_malloc.c b/app/test/test_malloc.c
index eed0b20d5a..04608a97e5 100644
--- a/app/test/test_malloc.c
+++ b/app/test/test_malloc.c
@@ -828,6 +828,11 @@  test_malloc_bad_params(void)
 	if (bad_ptr != NULL)
 		goto err_return;
 
+	/* rte_realloc expected to return null with inappropriate size */
+	bad_ptr = rte_realloc(NULL, size, align);
+	if (bad_ptr != NULL)
+		goto err_return;
+
 	/* rte_malloc expected to return null with inappropriate alignment */
 	align = 17;
 	size = 1024;
@@ -836,6 +841,11 @@  test_malloc_bad_params(void)
 	if (bad_ptr != NULL)
 		goto err_return;
 
+	/* rte_realloc expected to return null with inappropriate alignment */
+	bad_ptr = rte_realloc(NULL, size, align);
+	if (bad_ptr != NULL)
+		goto err_return;
+
 	return 0;
 
 err_return: