chiark / gitweb /
test suite: gnupg: Run with a lock held
[dgit.git] / tests / setup / gnupg
1 #!/bin/bash
2 set -e
3 . tests/lib
4
5 mkdir -p $tmp/gnupg
6 cp $troot/gnupg/* $tmp/gnupg
7 chmod go-rw $tmp/gnupg/*
8
9 export DGIT_TEST_GNUPG_GLOBAL_LOCK=$tmp/gnupg/dgit-test-global-lock
10
11 setup='
12         export GNUPGHOME=$tmp/gnupg
13         export DGIT_TEST_GNUPG_GLOBAL_LOCK
14
15         cat >$tmp/gnupg/gpg-agent.conf <<END
16         log-file $tmp/gnupg/AGENT.log
17 END
18         #debug-all
19
20         : ${DGIT_TEST_REAL_GPG_AGENT:=$(type -p gpg-agent)}
21         export DGIT_TEST_REAL_GPG_AGENT=$(type -p gpg-agent)
22         export DGIT_STUNT_AGENT=$troot/tstunt/gpg-agent
23         t-tstunt gpg
24 '
25
26 eval "$setup"
27
28 gpg --list-secret
29
30 t-setup-done 'DGIT_TEST_GNUPG_GLOBAL_LOCK' 'gnupg' "$setup"
31
32 t-ok