aboutsummaryrefslogtreecommitdiffstats
path: root/tests/migrations/from-classic.test
diff options
context:
space:
mode:
authorJustus Winter <[email protected]>2016-04-20 12:48:12 +0000
committerJustus Winter <[email protected]>2016-04-20 13:02:37 +0000
commitdefbc70b4a16264e067daf76678ecfb9d030dee4 (patch)
tree1ee8a06c87547926a047e3668b54c443b9b63237 /tests/migrations/from-classic.test
parentspeedo: Use swdb.lst to define the SQLite version. (diff)
downloadgnupg-defbc70b4a16264e067daf76678ecfb9d030dee4.tar.gz
gnupg-defbc70b4a16264e067daf76678ecfb9d030dee4.zip
tests: Test the migration from a classic GnuPG home directory.
* configure.ac: Add new directory. * tests/Makefile.am (SUBDIRS): Likewise. * tests/migrations/Makefile.am: New file. * tests/migrations/from-classic.gpghome/pubring.gpg.asc: Likewise. * tests/migrations/from-classic.gpghome/secring.gpg.asc: Likewise. * tests/migrations/from-classic.gpghome/trustdb.gpg.asc: Likewise. * tests/migrations/from-classic.test: Likewise. Signed-off-by: Justus Winter <[email protected]>
Diffstat (limited to 'tests/migrations/from-classic.test')
-rwxr-xr-xtests/migrations/from-classic.test52
1 files changed, 52 insertions, 0 deletions
diff --git a/tests/migrations/from-classic.test b/tests/migrations/from-classic.test
new file mode 100755
index 000000000..4ee3b616f
--- /dev/null
+++ b/tests/migrations/from-classic.test
@@ -0,0 +1,52 @@
+#!/bin/sh
+# Copyright 2016 g10 Code GmbH
+#
+# This file is free software; as a special exception the author gives
+# unlimited permission to copy and/or distribute it, with or without
+# modifications, as long as this notice is preserved. This file is
+# distributed in the hope that it will be useful, but WITHOUT ANY
+# WARRANTY, to the extent permitted by law; without even the implied
+# warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+
+if [ -z "$srcdir" ]; then
+ echo "not called from make" >&2
+ exit 1
+fi
+
+set -e
+
+# (We may not use a relative name for gpg-agent.)
+GPG_AGENT="$(cd ../../agent && /bin/pwd)/gpg-agent"
+GPG="../../g10/gpg --no-permission-warning --no-greeting --no-secmem-warning
+--batch --agent-program=${GPG_AGENT}|--debug-quick-random"
+
+export GNUPGHOME="from-classic.gpghome"
+
+setup_home()
+{
+ rm -rf -- "$GNUPGHOME"
+ mkdir "$GNUPGHOME"
+ for F in $srcdir/$GNUPGHOME/*.asc
+ do
+ $GPG --dearmor <"$F" >"$GNUPGHOME/`echo $F | sed -e 's/....$//'`"
+ done
+ chmod go-rwx $GNUPGHOME/*
+}
+
+trigger_migration()
+{
+ $GPG --list-secret-keys >/dev/null
+}
+
+assert_migrated()
+{
+ test -f $GNUPGHOME/.gpg-v21-migrated
+
+ for KEY in D74C5F22 C40FDECF ECABF51D; do
+ $GPG --list-secret-keys $KEY >/dev/null
+ done
+}
+
+setup_home
+trigger_migration
+assert_migrated