diff options
-rwxr-xr-x | test/test-common.sh | 3 | ||||
-rwxr-xr-x | test/testenv | 17 |
2 files changed, 18 insertions, 2 deletions
diff --git a/test/test-common.sh b/test/test-common.sh index da19490..45adb8b 100755 --- a/test/test-common.sh +++ b/test/test-common.sh @@ -22,7 +22,6 @@ before() { unset BUILDDIR unset PKGEXT SRCEXT unset GPGKEY PACKAGER - killall gpg-agent &>/dev/null || true tmpdir="$(mktemp -d --tmpdir "test-${roundup_desc//\//-}.${roundup_test_name}.XXXXXXXXXXXX")" chmod 755 "$tmpdir" @@ -35,7 +34,7 @@ before() { after() { common_after - killall gpg-agent &>/dev/null || true + gpg-connect-agent KILLAGENT /bye || true if [[ -f "$tmpdir/.used-sudo" ]]; then sudo rm -rf -- "$tmpdir" "$XDG_CONFIG_HOME" "$XDG_CACHE_HOME" else diff --git a/test/testenv b/test/testenv index faad4e1..4fc2860 100755 --- a/test/testenv +++ b/test/testenv @@ -80,6 +80,23 @@ '_sudo "$@"' \ > "$destdir/usr/bin/testsudo" chmod 755 "$destdir/usr/bin/testsudo" + # Hack to work around GnuPG being stupid with locating gpg-agent's socket + install -Dm755 /dev/stdin "$destdir/usr/bin/gpg" <<-'eot' + #!/bin/bash + export GNUPGHOME="${GNUPGHOME:-$HOME/.gnupg}" + if [[ $GNUPGHOME = "$HOME/.gnupg" ]]; then + export HOME=/var/empty + fi + exec /usr/bin/gpg "$@" + eot + install -Dm755 /dev/stdin "$destdir/usr/bin/gpg-connect-agent" <<-'eot' + #!/bin/bash + export GNUPGHOME="${GNUPGHOME:-$HOME/.gnupg}" + if [[ $GNUPGHOME = "$HOME/.gnupg" ]]; then + export HOME=/var/empty + fi + exec /usr/bin/gpg-connect-agent "$@" + eot # Run the tests command -- "$@" |