diff options
author | Darren Tucker <dtucker@dtucker.net> | 2022-01-19 15:37:39 +1100 |
---|---|---|
committer | Darren Tucker <dtucker@dtucker.net> | 2022-01-19 15:37:39 +1100 |
commit | 20da6ed136dd76e6a0b229ca3036ef9c7c7ef798 (patch) | |
tree | 87e76e96464964b243f215f7cfe47791803c24bd /regress/test-exec.sh | |
parent | ad2e0580c87b0714cf166bca9d926a95ddeee1c8 (diff) | |
download | openssh-git-20da6ed136dd76e6a0b229ca3036ef9c7c7ef798.tar.gz |
Invoke EXIT handler early when using Valgrind.
When using Valgrind, we need to wait for all invoked programs to
complete before checking their valgrind logs. Some tests, notably
agent-restrict, set an EXIT trap handler to clean up things like
ssh-agent, but those do not get invoked until test-exec.sh exits.
This causes the Valgrind wait to deadlock, so if present invoke
the EXIT handler before checking the Valgrind logs.
Diffstat (limited to 'regress/test-exec.sh')
-rw-r--r-- | regress/test-exec.sh | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/regress/test-exec.sh b/regress/test-exec.sh index 361a0653..7aeead5c 100644 --- a/regress/test-exec.sh +++ b/regress/test-exec.sh @@ -718,6 +718,19 @@ start_sshd () cleanup if [ "x$USE_VALGRIND" != "x" ]; then + # If there is an EXIT trap handler, invoke it now. + # Some tests set these to clean up processes such as ssh-agent. We + # need to wait for all valgrind processes to complete so we can check + # their logs, but since the EXIT traps are not invoked until + # test-exec.sh exits, waiting here will deadlock. + # This is not very portable but then neither is valgrind itself. + exithandler=$(trap -p | awk -F "'" '/EXIT$/{print $2}') + if [ "x${exithandler}" != "x" ]; then + verbose invoking EXIT trap handler early: ${exithandler} + ${exithandler} + trap '' EXIT + fi + # wait for any running process to complete wait; sleep 1 VG_RESULTS=$(find $OBJ/valgrind-out -type f -print) |