public inbox for glibc-cvs@sourceware.org help / color / mirror / Atom feed
From: Stefan Liebler <stli@sourceware.org> To: glibc-cvs@sourceware.org Subject: [glibc] Fix WAIT_FOR_DEBUGGER for container tests. Date: Mon, 16 Oct 2023 07:52:06 +0000 (GMT) [thread overview] Message-ID: <20231016075206.5A8153858434@sourceware.org> (raw) https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=4a829d70ab3bc9e69f3d186471d043e07e0d78d8 commit 4a829d70ab3bc9e69f3d186471d043e07e0d78d8 Author: Stefan Liebler <stli@linux.ibm.com> Date: Thu Sep 28 12:50:40 2023 +0200 Fix WAIT_FOR_DEBUGGER for container tests. For container tests, gdb needs to set the sysroot to the corresponding testroot.root directory. The assumption was that PIDs < 3 means that we are running within a container. Starting with commit 2fe64148a81f0d78050c302f34a6853d21f7cae4 "Allow for unpriviledged nested containers", the default is to use the PID namespace of the parent. Thus support_test_main.c does not recognize our container anymore. This patch now assumes that we are running inside a container if test-container.c has set PID_OUTSIDE_CONTAINER and always uses this PID independent of having a new PID namespace or not. Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org> Diff: --- support/support_test_main.c | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/support/support_test_main.c b/support/support_test_main.c index c20c19e774..f19fce5644 100644 --- a/support/support_test_main.c +++ b/support/support_test_main.c @@ -195,16 +195,14 @@ run_test_function (int argc, char **argv, const struct test_config *config) char *gdb_script_name; int inside_container = 0; - mypid = getpid(); - if (mypid < 3) + const char *outside_pid = getenv("PID_OUTSIDE_CONTAINER"); + if (outside_pid) { - const char *outside_pid = getenv("PID_OUTSIDE_CONTAINER"); - if (outside_pid) - { - mypid = atoi (outside_pid); - inside_container = 1; - } + mypid = atoi (outside_pid); + inside_container = 1; } + else + mypid = getpid(); gdb_script_name = (char *) xmalloc (strlen (argv[0]) + strlen (".gdb") + 1); sprintf (gdb_script_name, "%s.gdb", argv[0]);
reply other threads:[~2023-10-16 7:52 UTC|newest] Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=20231016075206.5A8153858434@sourceware.org \ --to=stli@sourceware.org \ --cc=glibc-cvs@sourceware.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).