1
0
mirror of git://git.gnupg.org/gnupg.git synced 2025-02-01 16:33:02 +01:00

tests/openpgp: Improve tests.

* tests/openpgp/multisig.scm: Simplify test.
* tests/openpgp/setup.scm (dearmor): Use pipe.

Signed-off-by: Justus Winter <justus@g10code.com>
This commit is contained in:
Justus Winter 2016-06-23 17:14:07 +02:00
parent 332fa86982
commit 1e822654c1
2 changed files with 14 additions and 15 deletions

View File

@ -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 `(,@GPG --dearmor)))
;; XXX: this is ugly
(lambda args
(if (catch #f ;; verifikation failed, this is what we want
(apply (tr:spawn "" `(,@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 `(,@GPG --dearmor))
(pipe:write-to file (logior O_WRONLY O_CREAT O_BINARY) #o600))
(if (= 0 (call `(,@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))

View File

@ -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 `(,@GPG --dearmor) source sink STDERR_FILENO)))
(pipe:do
(pipe:open source-name (logior O_RDONLY O_BINARY))
(pipe:spawn `(,@GPG --dearmor))
(pipe:write-to sink-name
(logior O_WRONLY O_CREAT O_BINARY)
#o600)))
(for-each-p "Unpacking samples"
(lambda (name)