[v2,2/4] test: verify calloc succeeded for sum variable

Message ID 1557170620-99694-1-git-send-email-drc@linux.vnet.ibm.com (mailing list archive)
State Superseded, archived
Headers
Series [v2,1/4] test: fix typo in print statement |

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/Intel-compilation success Compilation OK

Commit Message

David Christensen May 6, 2019, 7:23 p.m. UTC
  Code tested calloc failures for pt & lpt variables
but not for the sum variable. Add a test for calloc
failure of sum.

Signed-off-by: David Christensen <drc@linux.vnet.ibm.com>
---
v2:
* Removed change to ITER_MAX

 app/test/test_barrier.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
  

Comments

Ananyev, Konstantin May 7, 2019, 10:40 a.m. UTC | #1
> Code tested calloc failures for pt & lpt variables
> but not for the sum variable. Add a test for calloc
> failure of sum.
> 
> Signed-off-by: David Christensen <drc@linux.vnet.ibm.com>
> ---
> v2:
> * Removed change to ITER_MAX
> 
>  app/test/test_barrier.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/app/test/test_barrier.c b/app/test/test_barrier.c
> index c219d56..ae37b1e 100644
> --- a/app/test/test_barrier.c
> +++ b/app/test/test_barrier.c
> @@ -202,7 +202,7 @@ struct lcore_plock_test {
>  	printf("%s(iter=%u, utype=%u) started on %u lcores\n",
>  		__func__, iter, utype, n);
> 
> -	if (pt == NULL || lpt == NULL) {
> +	if (pt == NULL || lpt == NULL || sum == NULL) {
>  		printf("%s: failed to allocate memory for %u lcores\n",
>  			__func__, n);
>  		free(pt);
> --

Acked-by: Konstantin Ananyev <konstantin.ananyev@intel.com>

> 1.8.3.1
  

Patch

diff --git a/app/test/test_barrier.c b/app/test/test_barrier.c
index c219d56..ae37b1e 100644
--- a/app/test/test_barrier.c
+++ b/app/test/test_barrier.c
@@ -202,7 +202,7 @@  struct lcore_plock_test {
 	printf("%s(iter=%u, utype=%u) started on %u lcores\n",
 		__func__, iter, utype, n);
 
-	if (pt == NULL || lpt == NULL) {
+	if (pt == NULL || lpt == NULL || sum == NULL) {
 		printf("%s: failed to allocate memory for %u lcores\n",
 			__func__, n);
 		free(pt);