[Pkg-gnupg-commit] [gnupg2] 46/160: tests/openpgp: Improve tests.
Daniel Kahn Gillmor
dkg at fifthhorseman.net
Fri Jul 15 09:36:35 UTC 2016
This is an automated email from the git hooks/post-receive script.
dkg pushed a commit to branch upstream
in repository gnupg2.
commit 1e822654c1dcfc23a9ef689f4e18c0ebba18baca
Author: Justus Winter <justus at g10code.com>
Date: Thu Jun 23 17:14:07 2016 +0200
tests/openpgp: Improve tests.
* tests/openpgp/multisig.scm: Simplify test.
* tests/openpgp/setup.scm (dearmor): Use pipe.
Signed-off-by: Justus Winter <justus at g10code.com>
---
tests/openpgp/multisig.scm | 20 ++++++++------------
tests/openpgp/setup.scm | 9 ++++++---
2 files changed, 14 insertions(+), 15 deletions(-)
diff --git a/tests/openpgp/multisig.scm b/tests/openpgp/multisig.scm
index 3788f67..53c905f 100755
--- a/tests/openpgp/multisig.scm
+++ b/tests/openpgp/multisig.scm
@@ -156,17 +156,13 @@ cnksIEkgY2FuJ3QgZG8gdGhhdAo=
(for-each-p
"Checking that an invalid signature is verified as such"
(lambda (armored-file)
- (tr:do
- (tr:pipe-do
- (pipe:echo (eval armored-file (current-environment)))
- (pipe:spawn `(, at GPG --dearmor)))
- ;; XXX: this is ugly
- (lambda args
- (if (catch #f ;; verifikation failed, this is what we want
- (apply (tr:spawn "" `(, at GPG --verify **in**)) args)
- ;; verification succeded, this is an error.
- #t)
- (error "invalid signature is valid")
- args))))
+ (lettmp (file)
+ (pipe:do
+ (pipe:echo (eval armored-file (current-environment)))
+ (pipe:spawn `(, at GPG --dearmor))
+ (pipe:write-to file (logior O_WRONLY O_CREAT O_BINARY) #o600))
+
+ (if (= 0 (call `(, at GPG --verify ,file)))
+ (error "Bad signature verified ok")))
'(sig-1ls1ls-valid sig-ls-valid sig-1lsls-invalid
sig-lsls-invalid sig-lss-invalid sig-slsl-invalid))
diff --git a/tests/openpgp/setup.scm b/tests/openpgp/setup.scm
index 6518dae..ce2e42c 100755
--- a/tests/openpgp/setup.scm
+++ b/tests/openpgp/setup.scm
@@ -56,9 +56,12 @@
'(500 9000 32000 80000))
(define (dearmor source-name sink-name)
- (letfd ((source (open source-name (logior O_RDONLY O_BINARY)))
- (sink (open sink-name (logior O_WRONLY O_CREAT O_BINARY) #o600)))
- (call-with-fds `(, at GPG --dearmor) source sink STDERR_FILENO)))
+ (pipe:do
+ (pipe:open source-name (logior O_RDONLY O_BINARY))
+ (pipe:spawn `(, at GPG --dearmor))
+ (pipe:write-to sink-name
+ (logior O_WRONLY O_CREAT O_BINARY)
+ #o600)))
(for-each-p "Unpacking samples"
(lambda (name)
--
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