Skip to contentSkip to conversation

test: verify calloc succeeded for sum variable

PATCH Superseded David Christensen 2 participants 2 messages May 6, 2019 – May 7, 2019

v2 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

PATCH v2 2/4 test: verify calloc succeeded for sum variable

Code tested calloc failures for pt & lpt variables but not for the sum variable. Add a test for calloc failure of sum.

---
v2:
* Removed change to ITER_MAX

 app/test/test_barrier.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
app/test/test_barrier.c +1 -1
index c219d56..ae37b1e 100644
@@ -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);
Signature · 1 line
1.8.3.1
Acked-by on v2 2/4
#1 lore raw
Quoted 18 lines

Code tested calloc failures for pt & lpt variables but not for the sum variable. Add a test for calloc failure of sum.

---
v2:
* Removed change to ITER_MAX

 app/test/test_barrier.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
app/test/test_barrier.c +0 -0
index c219d56..ae37b1e 100644

app/test/test_barrier.c struct lcore_plock_test {

Quoted 9 lines
app/test/test_barrier.c +1 -2
@@ -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);
--
Quoted 1 line

1.8.3.1