Permalink
Show file tree
Hide file tree
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
upstream: Test that ssh-agent exits when running as as subprocess
of a specified command (ie "ssh-agent command"). Would have caught bz#3181. OpenBSD-Regress-ID: 895b4765ba5153eefaea3160a7fe08ac0b6db8b3
- Loading branch information
Showing
2 changed files
with
24 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,22 @@ | ||
| # $OpenBSD: agent-subprocess.sh,v 1.1 2020/06/19 05:07:09 dtucker Exp $ | ||
| # Placed in the Public Domain. | ||
|
|
||
| tid="agent subprocess" | ||
|
|
||
| trace "ensure agent exits when run as subprocess" | ||
| ${SSHAGENT} sh -c "echo \$SSH_AGENT_PID >$OBJ/pidfile; sleep 1" | ||
|
|
||
| pid=`cat $OBJ/pidfile` | ||
|
|
||
| # Currently ssh-agent polls every 10s so we need to wait at least that long. | ||
| n=12 | ||
| while kill -0 $pid >/dev/null 2>&1 && test "$n" -gt "0"; do | ||
| n=$(($n - 1)) | ||
| sleep 1 | ||
| done | ||
|
|
||
| if test "$n" -eq "0"; then | ||
| fail "agent still running" | ||
| fi | ||
|
|
||
| rm -f $OBJ/pidfile |