annotate tests/test-gpg.t @ 52316:a820a7a1fce0 default tip

setup: require TLS 1.2 support from the Python interpreter (BC) Before it was optional, and either 1.1 or 1.2 was sufficient. Now that the default minimum is 1.2, it needs to be present to work out of the box. The code here is more convoluted than the corresponding checks in `sslutil.py`, but I'm leaving it alone because it can all be simplified when py38 is dropped.
author Matt Harbison <matt_harbison@yahoo.com>
date Thu, 21 Nov 2024 11:46:10 -0500
parents 181936ad069a
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
22046
7a9cbb315d84 tests: replace exit 80 with #require
Matt Mackall <mpm@selenic.com>
parents: 21711
diff changeset
1 #require gpg
7a9cbb315d84 tests: replace exit 80 with #require
Matt Mackall <mpm@selenic.com>
parents: 21711
diff changeset
2
12428
3aa7b6445aad tests: unify test-gpg
Matt Mackall <mpm@selenic.com>
parents: 9041
diff changeset
3 Test the GPG extension
8809
6fce36336e42 gpg: add test
Brendan Cully <brendan@kublai.com>
parents:
diff changeset
4
12428
3aa7b6445aad tests: unify test-gpg
Matt Mackall <mpm@selenic.com>
parents: 9041
diff changeset
5 $ cat <<EOF >> $HGRCPATH
3aa7b6445aad tests: unify test-gpg
Matt Mackall <mpm@selenic.com>
parents: 9041
diff changeset
6 > [extensions]
3aa7b6445aad tests: unify test-gpg
Matt Mackall <mpm@selenic.com>
parents: 9041
diff changeset
7 > gpg=
3aa7b6445aad tests: unify test-gpg
Matt Mackall <mpm@selenic.com>
parents: 9041
diff changeset
8 >
3aa7b6445aad tests: unify test-gpg
Matt Mackall <mpm@selenic.com>
parents: 9041
diff changeset
9 > [gpg]
29789
66e038fb3c0d test-gpg: make temporary copy of GNUPGHOME
Yuya Nishihara <yuya@tcha.org>
parents: 25472
diff changeset
10 > cmd=gpg --no-permission-warning --no-secmem-warning --no-auto-check-trustdb
12428
3aa7b6445aad tests: unify test-gpg
Matt Mackall <mpm@selenic.com>
parents: 9041
diff changeset
11 > EOF
29789
66e038fb3c0d test-gpg: make temporary copy of GNUPGHOME
Yuya Nishihara <yuya@tcha.org>
parents: 25472
diff changeset
12 $ GNUPGHOME="$TESTTMP/gpg"; export GNUPGHOME
66e038fb3c0d test-gpg: make temporary copy of GNUPGHOME
Yuya Nishihara <yuya@tcha.org>
parents: 25472
diff changeset
13 $ cp -R "$TESTDIR/gpg" "$GNUPGHOME"
66e038fb3c0d test-gpg: make temporary copy of GNUPGHOME
Yuya Nishihara <yuya@tcha.org>
parents: 25472
diff changeset
14
29873
80ba176bad62 test-gpg: start gpg-agent by gpg-connect-agent only if GnuPG v2.1+ detected
Yuya Nishihara <yuya@tcha.org>
parents: 29791
diff changeset
15 Start gpg-agent, which is required by GnuPG v2
80ba176bad62 test-gpg: start gpg-agent by gpg-connect-agent only if GnuPG v2.1+ detected
Yuya Nishihara <yuya@tcha.org>
parents: 29791
diff changeset
16
80ba176bad62 test-gpg: start gpg-agent by gpg-connect-agent only if GnuPG v2.1+ detected
Yuya Nishihara <yuya@tcha.org>
parents: 29791
diff changeset
17 #if gpg21
80ba176bad62 test-gpg: start gpg-agent by gpg-connect-agent only if GnuPG v2.1+ detected
Yuya Nishihara <yuya@tcha.org>
parents: 29791
diff changeset
18 $ gpg-connect-agent -q --subst /serverpid '/echo ${get serverpid}' /bye \
80ba176bad62 test-gpg: start gpg-agent by gpg-connect-agent only if GnuPG v2.1+ detected
Yuya Nishihara <yuya@tcha.org>
parents: 29791
diff changeset
19 > >> $DAEMON_PIDS
80ba176bad62 test-gpg: start gpg-agent by gpg-connect-agent only if GnuPG v2.1+ detected
Yuya Nishihara <yuya@tcha.org>
parents: 29791
diff changeset
20 #endif
80ba176bad62 test-gpg: start gpg-agent by gpg-connect-agent only if GnuPG v2.1+ detected
Yuya Nishihara <yuya@tcha.org>
parents: 29791
diff changeset
21
80ba176bad62 test-gpg: start gpg-agent by gpg-connect-agent only if GnuPG v2.1+ detected
Yuya Nishihara <yuya@tcha.org>
parents: 29791
diff changeset
22 and migrate secret keys
29790
94fb0458a791 test-gpg: start gpg-agent under control of the test runner
Yuya Nishihara <yuya@tcha.org>
parents: 29789
diff changeset
23
94fb0458a791 test-gpg: start gpg-agent under control of the test runner
Yuya Nishihara <yuya@tcha.org>
parents: 29789
diff changeset
24 #if gpg2
29791
28591876fa63 test-gpg: run migration of v1 secret keys beforehand
Yuya Nishihara <yuya@tcha.org>
parents: 29790
diff changeset
25 $ gpg --no-permission-warning --no-secmem-warning --list-secret-keys \
28591876fa63 test-gpg: run migration of v1 secret keys beforehand
Yuya Nishihara <yuya@tcha.org>
parents: 29790
diff changeset
26 > > /dev/null 2>&1
29790
94fb0458a791 test-gpg: start gpg-agent under control of the test runner
Yuya Nishihara <yuya@tcha.org>
parents: 29789
diff changeset
27 #endif
94fb0458a791 test-gpg: start gpg-agent under control of the test runner
Yuya Nishihara <yuya@tcha.org>
parents: 29789
diff changeset
28
12428
3aa7b6445aad tests: unify test-gpg
Matt Mackall <mpm@selenic.com>
parents: 9041
diff changeset
29 $ hg init r
3aa7b6445aad tests: unify test-gpg
Matt Mackall <mpm@selenic.com>
parents: 9041
diff changeset
30 $ cd r
3aa7b6445aad tests: unify test-gpg
Matt Mackall <mpm@selenic.com>
parents: 9041
diff changeset
31 $ echo foo > foo
3aa7b6445aad tests: unify test-gpg
Matt Mackall <mpm@selenic.com>
parents: 9041
diff changeset
32 $ hg ci -Amfoo
3aa7b6445aad tests: unify test-gpg
Matt Mackall <mpm@selenic.com>
parents: 9041
diff changeset
33 adding foo
8809
6fce36336e42 gpg: add test
Brendan Cully <brendan@kublai.com>
parents:
diff changeset
34
12428
3aa7b6445aad tests: unify test-gpg
Matt Mackall <mpm@selenic.com>
parents: 9041
diff changeset
35 $ hg sigs
3aa7b6445aad tests: unify test-gpg
Matt Mackall <mpm@selenic.com>
parents: 9041
diff changeset
36
21711
0986af9e7006 gpg: accept '--edit' like other commands creating new changeset
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 20305
diff changeset
37 $ HGEDITOR=cat hg sign -e 0
45030
f58928715d0c tests: ignore possible diagnostics from gpg 2.2
Joerg Sonnenberger <joerg@bec.de>
parents: 29873
diff changeset
38 gpg: error retrieving key fingerprint from card: Invalid name (?)
16927
7922004a46b8 gpg: lowercase messages
Martin Geisler <mg@aragost.com>
parents: 16913
diff changeset
39 signing 0:e63c23eaa88a
21711
0986af9e7006 gpg: accept '--edit' like other commands creating new changeset
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 20305
diff changeset
40 Added signature for changeset e63c23eaa88a
0986af9e7006 gpg: accept '--edit' like other commands creating new changeset
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 20305
diff changeset
41
0986af9e7006 gpg: accept '--edit' like other commands creating new changeset
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 20305
diff changeset
42
0986af9e7006 gpg: accept '--edit' like other commands creating new changeset
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 20305
diff changeset
43 HG: Enter commit message. Lines beginning with 'HG:' are removed.
0986af9e7006 gpg: accept '--edit' like other commands creating new changeset
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 20305
diff changeset
44 HG: Leave message empty to abort commit.
0986af9e7006 gpg: accept '--edit' like other commands creating new changeset
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 20305
diff changeset
45 HG: --
0986af9e7006 gpg: accept '--edit' like other commands creating new changeset
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 20305
diff changeset
46 HG: user: test
0986af9e7006 gpg: accept '--edit' like other commands creating new changeset
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 20305
diff changeset
47 HG: branch 'default'
0986af9e7006 gpg: accept '--edit' like other commands creating new changeset
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents: 20305
diff changeset
48 HG: added .hgsigs
8809
6fce36336e42 gpg: add test
Brendan Cully <brendan@kublai.com>
parents:
diff changeset
49
12428
3aa7b6445aad tests: unify test-gpg
Matt Mackall <mpm@selenic.com>
parents: 9041
diff changeset
50 $ hg sigs
3aa7b6445aad tests: unify test-gpg
Matt Mackall <mpm@selenic.com>
parents: 9041
diff changeset
51 hgtest 0:e63c23eaa88ae77967edcf4ea194d31167c478b0
8809
6fce36336e42 gpg: add test
Brendan Cully <brendan@kublai.com>
parents:
diff changeset
52
12428
3aa7b6445aad tests: unify test-gpg
Matt Mackall <mpm@selenic.com>
parents: 9041
diff changeset
53 $ hg sigcheck 0
3aa7b6445aad tests: unify test-gpg
Matt Mackall <mpm@selenic.com>
parents: 9041
diff changeset
54 e63c23eaa88a is signed by:
3aa7b6445aad tests: unify test-gpg
Matt Mackall <mpm@selenic.com>
parents: 9041
diff changeset
55 hgtest
16289
aae219a99a6e test-gpg: make sure gpg does not modify the trustdb.gpg file
Greg Ward <greg@gerg.ca>
parents: 12428
diff changeset
56
50822
181936ad069a gpg: fix an UnboundLocalError whenever using --force
Matt Harbison <matt_harbison@yahoo.com>
parents: 45030
diff changeset
57 The signature is different each time, so avoid signing the previous signature so
181936ad069a gpg: fix an UnboundLocalError whenever using --force
Matt Harbison <matt_harbison@yahoo.com>
parents: 45030
diff changeset
58 that the cset hashes are unchanging.
181936ad069a gpg: fix an UnboundLocalError whenever using --force
Matt Harbison <matt_harbison@yahoo.com>
parents: 45030
diff changeset
59 $ hg up -q '.^'
181936ad069a gpg: fix an UnboundLocalError whenever using --force
Matt Harbison <matt_harbison@yahoo.com>
parents: 45030
diff changeset
60
181936ad069a gpg: fix an UnboundLocalError whenever using --force
Matt Harbison <matt_harbison@yahoo.com>
parents: 45030
diff changeset
61 $ HGEDITOR=cat hg sign -f -e .
181936ad069a gpg: fix an UnboundLocalError whenever using --force
Matt Harbison <matt_harbison@yahoo.com>
parents: 45030
diff changeset
62 gpg: error retrieving key fingerprint from card: Invalid name (?)
181936ad069a gpg: fix an UnboundLocalError whenever using --force
Matt Harbison <matt_harbison@yahoo.com>
parents: 45030
diff changeset
63 signing 0:e63c23eaa88a
181936ad069a gpg: fix an UnboundLocalError whenever using --force
Matt Harbison <matt_harbison@yahoo.com>
parents: 45030
diff changeset
64 Added signature for changeset e63c23eaa88a
181936ad069a gpg: fix an UnboundLocalError whenever using --force
Matt Harbison <matt_harbison@yahoo.com>
parents: 45030
diff changeset
65
181936ad069a gpg: fix an UnboundLocalError whenever using --force
Matt Harbison <matt_harbison@yahoo.com>
parents: 45030
diff changeset
66
181936ad069a gpg: fix an UnboundLocalError whenever using --force
Matt Harbison <matt_harbison@yahoo.com>
parents: 45030
diff changeset
67 HG: Enter commit message. Lines beginning with 'HG:' are removed.
181936ad069a gpg: fix an UnboundLocalError whenever using --force
Matt Harbison <matt_harbison@yahoo.com>
parents: 45030
diff changeset
68 HG: Leave message empty to abort commit.
181936ad069a gpg: fix an UnboundLocalError whenever using --force
Matt Harbison <matt_harbison@yahoo.com>
parents: 45030
diff changeset
69 HG: --
181936ad069a gpg: fix an UnboundLocalError whenever using --force
Matt Harbison <matt_harbison@yahoo.com>
parents: 45030
diff changeset
70 HG: user: test
181936ad069a gpg: fix an UnboundLocalError whenever using --force
Matt Harbison <matt_harbison@yahoo.com>
parents: 45030
diff changeset
71 HG: branch 'default'
181936ad069a gpg: fix an UnboundLocalError whenever using --force
Matt Harbison <matt_harbison@yahoo.com>
parents: 45030
diff changeset
72 HG: added .hgsigs
181936ad069a gpg: fix an UnboundLocalError whenever using --force
Matt Harbison <matt_harbison@yahoo.com>
parents: 45030
diff changeset
73
16913
f2719b387380 tests: add missing trailing 'cd ..'
Mads Kiilerich <mads@kiilerich.com>
parents: 16350
diff changeset
74 $ cd ..