diff options
author | Glenn Strauss <gstrauss@gluelogic.com> | 2022-01-08 23:23:28 -0500 |
---|---|---|
committer | Glenn Strauss <gstrauss@gluelogic.com> | 2022-01-10 22:38:32 -0500 |
commit | 1e335b3724ae3f839170286d572b3056d6814b54 (patch) | |
tree | 7c1b938500505ca0e4d189ec3e0b84199f62f872 /tests/LightyTest.pm | |
parent | aeba3144548b17d1fc35db4a6809ba5ebbe50c7e (diff) | |
download | lighttpd-git-1e335b3724ae3f839170286d572b3056d6814b54.tar.gz |
[core] allow LISTEN_PID to be ppid if TRACEME (fixes #3137)
allow LISTEN_PID to be ppid (parent pid) if TRACEME set in environment
(e.g. for strace, gdb on Linux; valgrind starts lighttpd as LISTEN_PID)
x-ref:
"TRACEME environment option in tests broken with LISTEN_PID"
https://redmine.lighttpd.net/issues/3137
Diffstat (limited to 'tests/LightyTest.pm')
-rw-r--r-- | tests/LightyTest.pm | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/tests/LightyTest.pm b/tests/LightyTest.pm index 4416376d..e71fd2e6 100644 --- a/tests/LightyTest.pm +++ b/tests/LightyTest.pm @@ -115,6 +115,7 @@ sub stop_proc { my $pid = $self->{LIGHTTPD_PID}; if (defined $pid && $pid != -1) { + kill('USR1', $pid) if (($ENV{"TRACEME"}||'') eq 'strace'); kill('TERM', $pid) or return -1; return -1 if ($pid != waitpid($pid, 0)); } else { @@ -205,6 +206,9 @@ sub start_proc { # set up systemd socket activation env vars $ENV{LISTEN_FDS} = "1"; $ENV{LISTEN_PID} = $$; + if (defined($ENV{"TRACEME"}) && $ENV{"TRACEME"} ne "valgrind") { + $ENV{LISTEN_PID} = "parent:$$"; # lighttpd extension + } listen($SOCK, 1024) || die "listen: $!"; if (fileno($SOCK) != 3) { # SD_LISTEN_FDS_START 3 require POSIX; |