> > I'll dig into this. This sounds a way more reasonable approach. > > Thanks. Another thing that may help, if it turns out that we do > want to let agent run when it wants to I did some digging on the reason as to why this was happening. It turns out there is a bug on gnupg. As of gpg 2.1.21, all operations require an agent running (BTW --no-use-agent is effectively a no-op now). Given that on versions 2.19-21, they changed the way sockets are created to be stored on /run/user/UID/gnupg/... deleting the $GNUPG_HOME directory wouldn't flush the agent socket, and would leave an agent instance per test running, possibly forever. E.g., make test would result in the following: santiago at ~ ✔ pgrep -a gpg-agent 632 gpg-agent --homedir /git/t/trash directory.t6050-replace/gpghome --use-standard-socket --daemon 1192 /usr/bin/gpg-agent --supervised 2939 gpg-agent --homedir /git/t/trash directory.t5801-remote-helpers/gpghome --use-standard-socket --daemon 4656 gpg-agent --homedir /git/t/trash directory.t6300-for-each-ref/gpghome --use-standard-socket --daemon 5427 gpg-agent --homedir /git/t/trash directory.t7510-signed-commit/gpghome --use-standard-socket --daemon 5898 gpg-agent --homedir /git/t/trash directory.t6302-for-each-ref-filter/gpghome --use-standard-socket --daemon 7747 gpg-agent --homedir /git/t/trash directory.t7003-filter-branch/gpghome --use-standard-socket --daemon 12922 gpg-agent --homedir /git/t/trash directory.t7600-merge/gpghome --use-standard-socket --daemon 13572 gpg-agent --homedir /git/t/trash directory.t7004-tag/gpghome --use-standard-socket --daemon 14521 gpg-agent --homedir /git/t/trash directory.t5534-push-signed/gpghome --use-standard-socket --daemon 16563 gpg-agent --homedir /git/t/trash directory.t5541-http-push-smart/gpghome --use-standard-socket --daemon 17853 gpg-agent --homedir /git/t/trash directory.t7030-verify-tag/gpghome --use-standard-socket --daemon 29858 gpg-agent --homedir /git/t/trash directory.t7612-merge-verify-signatures/gpghome --use-standard-socket --daemon 31100 gpg-agent --homedir /git/t/trash directory.t4202-log/gpghome --use-standard-socket --daemon Other projects such as notmuch opted for a solution that's simlar to what I had suggested[1], but I wonder if it's even necessary to do. There is already a fix on the master branch of gnupg[2], which I imagine will show up to the next version of gpg2. I don't think it would make sense to fix anything on our side, unless we want to be extra sure the test suite is not leaking agents for all gpg versions (including these minor versions). What is your take? Thanks! -Santiago. [1] https://paste.debian.net/976970/ [2] https://dev.gnupg.org/T3218