Skip to contentSkip to conversation

testsuite/smokey/gdb: Skip test if gdb is not available

PATCH New Jan Kiszka 1 participant 1 message Apr 4, 2023

lore
Share & tools
lore

Jan Kiszka

author
#0 lore raw

PATCH 1/1 testsuite/smokey/gdb: Skip test if gdb is not available

From: Jan Kiszka <[email protected]>

Make gdb optional so that we do not need define it as dependency of the xenomai-runtime package. Can be changed again in the future when factoring out a separate xenomai-testsuite package.

---

Changes in v2:
- close pipe_out so that we always leave wait_for_pattern

 testsuite/smokey/gdb/gdb.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)
testsuite/smokey/gdb/gdb.c +7 -1
index eabf75e6a2..b09b78b4e0 100644
@@ -75,8 +75,12 @@ static void handle_sigchld(int signum)
 	int status;
 
 	wait(&status);
-	check("gdb execution", WEXITSTATUS(status), 0);
+	if (WEXITSTATUS(status) == ESRCH)
+		smokey_note("gdb: skipped (gdb not available)");
+	else
+		check("gdb execution", WEXITSTATUS(status), 0);
 	child_terminated = 1;
+	close(pipe_out[0]);
 }
 
 static void wait_for_pattern(const char *string)
@@ -279,6 +283,8 @@ static int run_gdb(struct smokey_test *t, int argc, char *const argv[])
 
 		default:
 			wait_for_pattern("(gdb) ");
+			if (child_terminated)
+				break;
 			send_command("b breakpoint_target\n", 1);
 			send_command("r\n", 1);
 
Signature · 1 line
2.35.3