aboutsummaryrefslogtreecommitdiffstats
path: root/tests/migrations
diff options
context:
space:
mode:
Diffstat (limited to 'tests/migrations')
-rw-r--r--tests/migrations/Makefile.am3
-rw-r--r--tests/migrations/common.scm8
-rwxr-xr-xtests/migrations/extended-pkf.scm18
-rwxr-xr-xtests/migrations/from-classic.scm47
4 files changed, 34 insertions, 42 deletions
diff --git a/tests/migrations/Makefile.am b/tests/migrations/Makefile.am
index d0cd9ee60..0895aff04 100644
--- a/tests/migrations/Makefile.am
+++ b/tests/migrations/Makefile.am
@@ -28,12 +28,9 @@ include $(top_srcdir)/am/cmacros.am
AM_CFLAGS =
-TMP ?= /tmp
-
TESTS_ENVIRONMENT = GPG_AGENT_INFO= LC_ALL=C \
EXEEXT=$(EXEEXT) \
PATH=../gpgscm:$(PATH) \
- TMP=$(TMP) \
srcdir=$(abs_srcdir) \
objdir=$(abs_top_builddir) \
GPGSCM_PATH=$(abs_top_srcdir)/tests/gpgscm:$(abs_top_srcdir)/tests/migrations
diff --git a/tests/migrations/common.scm b/tests/migrations/common.scm
index 30ac62ba1..fa8f1295a 100644
--- a/tests/migrations/common.scm
+++ b/tests/migrations/common.scm
@@ -26,6 +26,7 @@
(string-append executable (getenv "EXEEXT")))
;; We may not use a relative name for gpg-agent.
+(define gpgconf (path-join (getenv "objdir") "tools" (qualify "gpgconf")))
(define GPG-AGENT (path-join (getenv "objdir") "agent" (qualify "gpg-agent")))
(define GPG `(,(path-join (getenv "objdir") "g10" (qualify "gpg"))
--no-permission-warning --no-greeting
@@ -51,4 +52,9 @@
(info message)
(untar-armored src-tarball)
(setenv "GNUPGHOME" (getcwd) #t)
- (test (getcwd))))
+
+ (catch (log "Warning: Creating socket directory failed:" (car *error*))
+ (call-popen `(,gpgconf --create-socketdir) ""))
+ (test (getcwd))
+ (catch (log "Warning: Removing socket directory failed.")
+ (call-popen `(,gpgconf --remove-socketdir) ""))))
diff --git a/tests/migrations/extended-pkf.scm b/tests/migrations/extended-pkf.scm
index bf2c49e20..1317cd4f8 100755
--- a/tests/migrations/extended-pkf.scm
+++ b/tests/migrations/extended-pkf.scm
@@ -22,15 +22,6 @@
(catch (skip "gpgtar not built")
(call-check `(,GPGTAR --help)))
-(define src-tarball (in-srcdir "extended-pkf.tar.asc"))
-
-(define (setup)
- (untar-armored src-tarball)
- (setenv "GNUPGHOME" (getcwd) #t))
-
-(define (trigger-migration)
- (call-check `(,@GPG --list-secret-keys)))
-
(define (assert-keys-usable)
(for-each
(lambda (keyid)
@@ -38,9 +29,10 @@
(call-check `(,@GPG --list-secret-keys ,keyid))))
'("C40FDECF" "ECABF51D")))
-(info "Testing the extended private key format ...")
-(with-temporary-working-directory
- (setup)
- (assert-keys-usable))
+(run-test
+ "Testing the extended private key format ..."
+ (in-srcdir "extended-pkf.tar.asc")
+ (lambda (gpghome)
+ (assert-keys-usable)))
;; XXX try changing a key, and check that the format is not changed.
diff --git a/tests/migrations/from-classic.scm b/tests/migrations/from-classic.scm
index d540470c3..ace458e22 100755
--- a/tests/migrations/from-classic.scm
+++ b/tests/migrations/from-classic.scm
@@ -22,12 +22,6 @@
(catch (skip "gpgtar not built")
(call-check `(,GPGTAR --help)))
-(define src-tarball (in-srcdir "from-classic.tar.asc"))
-
-(define (setup)
- (untar-armored src-tarball)
- (setenv "GNUPGHOME" (getcwd) #t))
-
(define (trigger-migration)
(call-check `(,@GPG --list-secret-keys)))
@@ -41,24 +35,27 @@
(call-check `(,@GPG --list-secret-keys ,keyid))))
'("D74C5F22" "C40FDECF" "ECABF51D")))
-(info "Testing a clean migration ...")
-(with-temporary-working-directory
- (setup)
- (trigger-migration)
- (assert-migrated))
-
-(info "Testing a migration with existing private-keys-v1.d ...")
-(with-temporary-working-directory
- (setup)
- (mkdir "private-keys-v1.d" "-rwx")
- (trigger-migration)
- (assert-migrated))
-
-(info "Testing a migration with existing but weird private-keys-v1.d ...")
-(with-temporary-working-directory
- (setup)
- (mkdir "private-keys-v1.d" "")
- (trigger-migration)
- (assert-migrated))
+(run-test
+ "Testing a clean migration ..."
+ (in-srcdir "from-classic.tar.asc")
+ (lambda (gpghome)
+ (trigger-migration)
+ (assert-migrated)))
+
+(run-test
+ "Testing a migration with existing private-keys-v1.d ..."
+ (in-srcdir "from-classic.tar.asc")
+ (lambda (gpghome)
+ (mkdir "private-keys-v1.d" "-rwx")
+ (trigger-migration)
+ (assert-migrated)))
+
+(run-test
+ "Testing a migration with existing but weird private-keys-v1.d ..."
+ (in-srcdir "from-classic.tar.asc")
+ (lambda (gpghome)
+ (mkdir "private-keys-v1.d" "")
+ (trigger-migration)
+ (assert-migrated)))
;; XXX Check a case where the migration fails.