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

Message ID 4e6d9f131c31f1b9d7fcac58c245225350e87a8b.1585746650.git.anatoly.burakov@intel.com (mailing list archive)
State Superseded, archived
Delegated to: David Marchand
Headers
Series [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

Burakov, Anatoly April 1, 2020, 1:11 p.m. UTC
  Realloc did not have bad parameter autotest. Add them.

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

Comments

David Christensen April 2, 2020, 2:43 a.m. UTC | #1
On 4/1/20 6:11 AM, Anatoly Burakov wrote:
> 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>
  

Patch

diff --git a/app/test/test_malloc.c b/app/test/test_malloc.c
index 3a45a00406..788595ead7 100644
--- a/app/test/test_malloc.c
+++ b/app/test/test_malloc.c
@@ -826,6 +826,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;
@@ -834,6 +839,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: