Skip to contentSkip to conversation

eal: add some debug for unit test failures

PATCH New David Marchand 1 participant 1 message Oct 16

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 eal: add some debug for unit test failures

Dirty patch to try to catch more info about a unit test failure seen in ARM containers at UNH.

---
 app/test/commands.c          | 4 +++-
 app/test/process.c           | 7 +++++++
 lib/eal/common/malloc_heap.c | 2 ++
 3 files changed, 12 insertions(+), 1 deletion(-)
app/test/commands.c +3 -1
index 497d8e9952..5108295202 100644
@@ -368,8 +368,10 @@ int commands_init(void)
 	}
 
 	commands = (char *)calloc(commands_len, sizeof(char));
-	if (!commands)
+	if (!commands) {
+		printf("commands_init: calloc(%d) failed %s\n", commands_len, strerror(errno));
 		return -1;
+	}
 
 	TAILQ_FOREACH(t, &commands_list, next) {
 		strlcat(commands, t->command, commands_len);
app/test/process.c +7 -0
index 92c8af702b..dc39d0ea7b 100644
@@ -200,6 +200,13 @@ process_dup(const char *const argv[], int numargs, const char *env_value)
 	}
 #endif
 #endif
+	if (WIFEXITED(status))
+		printf("Child process exited with status %d\n", WEXITSTATUS(status));
+	else if (WIFSIGNALED(status))
+		printf("Child process killed by signal %d\n", WTERMSIG(status));
+	else
+		printf("Child process terminated with wait status %d\n", status);
+
 	return status;
 }
 
lib/eal/common/malloc_heap.c +2 -0
index 39240c261c..6c6bcd3b29 100644
@@ -657,6 +657,8 @@ malloc_heap_alloc_on_heap_id(size_t size, unsigned int heap_id, unsigned int fla
 	/* for legacy mode, try once and with all flags */
 	if (internal_conf->legacy_mem) {
 		ret = heap_alloc(heap, size, flags, align, bound, contig);
+		if (ret == NULL)
+			EAL_LOG(ERR, "Error allocating from heap in legacy mode");
 		goto alloc_unlock;
 	}
 
Signature · 1 line
2.54.0