[Pkg-gnupg-commit] [gnupg2] 144/205: tests: Make migration test more robust and silent.

Daniel Kahn Gillmor dkg at fifthhorseman.net
Wed May 11 08:38:30 UTC 2016


This is an automated email from the git hooks/post-receive script.

dkg pushed a commit to branch experimental
in repository gnupg2.

commit 0c35e09278514f1e3377a4b0a9b1f44dd39b1bf4
Author: Justus Winter <justus at g10code.com>
Date:   Thu Apr 21 14:36:21 2016 +0200

    tests: Make migration test more robust and silent.
    
    * tests/migrations/from-classic.test: Fix in-tree build, silence test.
    
    Fixes-commit: defbc70b
    Signed-off-by: Justus Winter <justus at g10code.com>
---
 tests/migrations/from-classic.test | 26 ++++++++++++++++++--------
 1 file changed, 18 insertions(+), 8 deletions(-)

diff --git a/tests/migrations/from-classic.test b/tests/migrations/from-classic.test
index a61a5c3..9b81d45 100755
--- a/tests/migrations/from-classic.test
+++ b/tests/migrations/from-classic.test
@@ -13,6 +13,7 @@ if [ -z "$srcdir" ]; then
    exit 1
 fi
 
+unset GNUPGHOME
 set -e
 
 # (We may not use a relative name for gpg-agent.)
@@ -20,22 +21,28 @@ 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"
+TEST="from-classic"
 
 setup_home()
 {
-    rm -rf -- "$GNUPGHOME"
-    mkdir "$GNUPGHOME"
-    for F in $srcdir/$GNUPGHOME/*.asc
-    do
-	$GPG --dearmor <"$F" >"$GNUPGHOME/`echo $F | sed -e 's/....$//'`"
+    XGNUPGHOME="`mktemp -d`"
+    rm -rf -- scratch
+    mkdir -p "$XGNUPGHOME"
+    for F in $srcdir/$TEST.gpghome/*.asc; do
+	$GPG --dearmor <"$F" >"$XGNUPGHOME/`basename $F .asc`"
     done
-    chmod go-rwx $GNUPGHOME/*
+    chmod go-rwx $XGNUPGHOME/*
+    export GNUPGHOME="$XGNUPGHOME"
+}
+
+cleanup_home()
+{
+    rm -rf -- "$XGNUPGHOME"
 }
 
 trigger_migration()
 {
-    $GPG --list-secret-keys >/dev/null
+    $GPG --list-secret-keys >/dev/null 2>&1
 }
 
 assert_migrated()
@@ -50,12 +57,14 @@ assert_migrated()
 setup_home
 trigger_migration
 assert_migrated
+cleanup_home
 
 # Test with an existing private-keys-v1.d.
 setup_home
 mkdir "$GNUPGHOME/private-keys-v1.d"
 trigger_migration
 assert_migrated
+cleanup_home
 
 # Test with an existing private-keys-v1.d with weird permissions.
 setup_home
@@ -63,5 +72,6 @@ mkdir "$GNUPGHOME/private-keys-v1.d"
 chmod 0 "$GNUPGHOME/private-keys-v1.d"
 trigger_migration
 assert_migrated
+cleanup_home
 
 # XXX Check a case where the migration fails.

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-gnupg/gnupg2.git



More information about the Pkg-gnupg-commit mailing list