[Pkg-gnupg-commit] [gnupg2] 78/205: tests/openpgp: Make tests more portable.

Daniel Kahn Gillmor dkg at fifthhorseman.net
Wed May 11 08:38:19 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 1cdb744d91ab33563fc0b3156fb05694caa55278
Author: Uldis Anšmits <uldis.ansmits at tieto.com>
Date:   Wed Mar 2 17:55:56 2016 +0100

    tests/openpgp: Make tests more portable.
    
    * tests/openpgp/default-key.test: Avoid 'grep -q'.
    * tests/openpgp/gpgtar.test: Avoid 'grep -qe' and 'diff -q'.
    * tests/openpgp/use-exact-key.test: Avoid 'grep -q'.
    
    GnuPG-bug-id: 2262
    Signed-off-by: Justus Winter <justus at g10code.com>
---
 tests/openpgp/default-key.test   | 4 ++--
 tests/openpgp/gpgtar.test        | 4 ++--
 tests/openpgp/use-exact-key.test | 4 ++--
 3 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/tests/openpgp/default-key.test b/tests/openpgp/default-key.test
index bfb84ac..567f38d 100755
--- a/tests/openpgp/default-key.test
+++ b/tests/openpgp/default-key.test
@@ -35,7 +35,7 @@ do
     info "Trying --default-key $x"
 
     if ! echo | $GPG --default-key "$x" -s | $GPG --verify --status-fd=1 \
-            | grep -q 'VALIDSIG 5FBA84ACE02DCB17DA3DFF6BBCA43C441EA97479'
+            | grep 'VALIDSIG 5FBA84ACE02DCB17DA3DFF6BBCA43C441EA97479' >/dev/null
     then
         echo | $GPG --default-key "$x" -s | $GPG --verify --status-fd=2
         error "Unexpected key used for signing (not the signing subkey, specified \"$x\")."
@@ -59,7 +59,7 @@ do
                      --default-key "$x" --encrypt-to-default-key \
                      -r 439F02CA -e \
             | $GPG --list-packets \
-            | grep -q "keyid[ ][A-F0-9]*45117079"
+            | grep "keyid[ ][A-F0-9]*45117079" >/dev/null
     then
         echo | $GPG --trust-model=always \
                     --default-key "$x" --encrypt-to-default-key \
diff --git a/tests/openpgp/gpgtar.test b/tests/openpgp/gpgtar.test
index e6290b0..d92eeb1 100755
--- a/tests/openpgp/gpgtar.test
+++ b/tests/openpgp/gpgtar.test
@@ -59,7 +59,7 @@ do_test()
           >"$FILELIST"
     for F in $TESTFILES
     do
-	grep -qe "\\b${F}\\b" "$FILELIST"
+        awk '{print $NF}' "$FILELIST" | grep "^${F}$" >/dev/null
     done
 
     $TOOL --gpg "$GPG"  --gpg-args "$GPGARGS" $EXTRACT_FLAGS \
@@ -67,7 +67,7 @@ do_test()
           "${TESTDIR}/test.tar.pgp"
     for F in $TESTFILES
     do
-	diff -q "$F" "${TESTDIR}/$F"
+	cmp "$F" "${TESTDIR}/$F"
     done
   )
 }
diff --git a/tests/openpgp/use-exact-key.test b/tests/openpgp/use-exact-key.test
index cbbd009..3745a2d 100755
--- a/tests/openpgp/use-exact-key.test
+++ b/tests/openpgp/use-exact-key.test
@@ -32,7 +32,7 @@ fi
 for x in 8BC90111 3E880CFF F5F77B83 45117079 1EA97479
 do
     if ! echo | $GPG -s -u "$x" | $GPG --verify --status-fd=1 \
-            | grep -q 'VALIDSIG 5FBA84ACE02DCB17DA3DFF6BBCA43C441EA97479'
+            | grep 'VALIDSIG 5FBA84ACE02DCB17DA3DFF6BBCA43C441EA97479' >/dev/null
     then
         echo | $GPG -s -u "$x" | $GPG --verify --status-fd=2
         error "Unexpected key used for signing (not the signing subkey, specified \"$x\")."
@@ -44,7 +44,7 @@ done
 for x in 8BC90111 F5F77B83 1EA97479
 do
     if ! echo | $GPG -s -u "$x!" | $GPG --verify --status-fd=1 \
-            | grep -q "VALIDSIG [0-9A-F]*$x "
+            | grep "VALIDSIG [0-9A-F]*$x " >/dev/null
     then
         echo | $GPG -s -u "$x!" | $GPG --verify --status-fd=2
         error "Unexpected key used for signing (specified: \"$x!\")."

-- 
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