aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJustus Winter <[email protected]>2016-12-06 14:21:30 +0000
committerJustus Winter <[email protected]>2016-12-06 14:25:55 +0000
commit5b5d881f47c82f320abf440c20b7a1bac078a987 (patch)
tree7e5252d2696113d411c235d1c5fe8759085ec4ae
parenttests: Remove debugging display. (diff)
downloadgnupg-5b5d881f47c82f320abf440c20b7a1bac078a987.tar.gz
gnupg-5b5d881f47c82f320abf440c20b7a1bac078a987.zip
tests: Rename 'error' to 'fail'.
* tests/gpgscm/tests.scm (error): Rename to 'fail'. 'error' is a primitive function (an opcode) of the TinySCHEME vm, and 'error' is also defined by R6RS. Better avoid redefining that. Fix all call sites. * tests/openpgp/4gb-packet.scm: Adapt. * tests/openpgp/decrypt-multifile.scm: Likewise. * tests/openpgp/ecc.scm: Likewise. * tests/openpgp/export.scm: Likewise. * tests/openpgp/gpgtar.scm: Likewise. * tests/openpgp/gpgv-forged-keyring.scm: Likewise. * tests/openpgp/import.scm: Likewise. * tests/openpgp/issue2015.scm: Likewise. * tests/openpgp/issue2346.scm: Likewise. * tests/openpgp/issue2419.scm: Likewise. * tests/openpgp/key-selection.scm: Likewise. * tests/openpgp/mds.scm: Likewise. * tests/openpgp/multisig.scm: Likewise. * tests/openpgp/setup.scm: Likewise. * tests/openpgp/signencrypt.scm: Likewise. * tests/openpgp/ssh-import.scm: Likewise. * tests/openpgp/tofu.scm: Likewise. * tests/openpgp/verify.scm: Likewise. Signed-off-by: Justus Winter <[email protected]>
-rw-r--r--tests/gpgscm/tests.scm12
-rwxr-xr-xtests/openpgp/4gb-packet.scm2
-rwxr-xr-xtests/openpgp/decrypt-multifile.scm2
-rwxr-xr-xtests/openpgp/ecc.scm4
-rwxr-xr-xtests/openpgp/export.scm4
-rwxr-xr-xtests/openpgp/gpgtar.scm4
-rwxr-xr-xtests/openpgp/gpgv-forged-keyring.scm2
-rwxr-xr-xtests/openpgp/import.scm2
-rwxr-xr-xtests/openpgp/issue2015.scm2
-rwxr-xr-xtests/openpgp/issue2346.scm2
-rwxr-xr-xtests/openpgp/issue2419.scm2
-rw-r--r--tests/openpgp/key-selection.scm2
-rwxr-xr-xtests/openpgp/mds.scm2
-rwxr-xr-xtests/openpgp/multisig.scm2
-rwxr-xr-xtests/openpgp/setup.scm2
-rwxr-xr-xtests/openpgp/signencrypt.scm2
-rwxr-xr-xtests/openpgp/ssh-import.scm6
-rwxr-xr-xtests/openpgp/tofu.scm16
-rwxr-xr-xtests/openpgp/verify.scm6
19 files changed, 38 insertions, 38 deletions
diff --git a/tests/gpgscm/tests.scm b/tests/gpgscm/tests.scm
index 1c170b083..e2b38f5c7 100644
--- a/tests/gpgscm/tests.scm
+++ b/tests/gpgscm/tests.scm
@@ -42,7 +42,7 @@
(if (> (*verbose*) 0)
(apply info msg)))
-(define (error . msg)
+(define (fail . msg)
(apply info msg)
(exit 1))
@@ -325,7 +325,7 @@
(lettmp (sink)
(transformer source sink)
(if (not (file=? source sink))
- (error "mismatch"))))
+ (fail "mismatch"))))
;;
;; Monadic pipe support.
@@ -440,7 +440,7 @@
(define (tr:spawn input command)
(lambda (tmpfiles source)
(if (and (member '**in** command) (not source))
- (error (string-append (stringify cmd) " needs an input")))
+ (fail (string-append (stringify cmd) " needs an input")))
(let* ((t (make-temporary-file))
(cmd (map (lambda (x)
(cond
@@ -450,7 +450,7 @@
(catch (list (cons t tmpfiles) t *error*)
(call-popen cmd input)
(if (and (member '**out** command) (not (file-exists? t)))
- (error (string-append (stringify cmd)
+ (fail (string-append (stringify cmd)
" did not produce '" t "'.")))
(list (cons t tmpfiles) t #f)))))
@@ -471,13 +471,13 @@
(define (tr:assert-identity reference)
(lambda (tmpfiles source)
(if (not (file=? source reference))
- (error "mismatch"))
+ (fail "mismatch"))
(list tmpfiles source #f)))
(define (tr:assert-weak-identity reference)
(lambda (tmpfiles source)
(if (not (text-file=? source reference))
- (error "mismatch"))
+ (fail "mismatch"))
(list tmpfiles source #f)))
(define (tr:call-with-content function . args)
diff --git a/tests/openpgp/4gb-packet.scm b/tests/openpgp/4gb-packet.scm
index 9c387af30..b827181a6 100755
--- a/tests/openpgp/4gb-packet.scm
+++ b/tests/openpgp/4gb-packet.scm
@@ -25,4 +25,4 @@
(if (= 0 (call `(,@GPG --list-packets ,(in-srcdir "4gb-packet.asc"))))
(info "Can parse 4GB packets.")
- (error "Failed to parse 4GB packet."))
+ (fail "Failed to parse 4GB packet."))
diff --git a/tests/openpgp/decrypt-multifile.scm b/tests/openpgp/decrypt-multifile.scm
index 4efdf6631..a7695b1f0 100755
--- a/tests/openpgp/decrypt-multifile.scm
+++ b/tests/openpgp/decrypt-multifile.scm
@@ -43,5 +43,5 @@
"Verifying files:"
(lambda (name)
(unless (file=? (path-join my-wd name) name)
- (error "decrypted file differs")))
+ (fail "decrypted file differs")))
plain-files))
diff --git a/tests/openpgp/ecc.scm b/tests/openpgp/ecc.scm
index 2190b9b89..a40869db4 100755
--- a/tests/openpgp/ecc.scm
+++ b/tests/openpgp/ecc.scm
@@ -103,7 +103,7 @@ Ic1RdzgeCfosMF+l/zVRchcLKzenEQA=
x (lambda (p) (display (eval test (current-environment)) p)))
(call-check `(,(tool 'gpg) --verify ,x))
(call-check `(,(tool 'gpg) --output ,y ,x))
- (unless (file=? y z) (error "mismatch"))))
+ (unless (file=? y z) (fail "mismatch"))))
'(msg_opaque_signed_256 msg_opaque_signed_384 msg_opaque_signed_521)))
;;
@@ -182,7 +182,7 @@ Rg==
(call-with-output-file
x (lambda (p) (display (eval test (current-environment)) p)))
(call-check `(,@GPG --yes --output ,y ,x))
- (unless (file=? y z) (error "mismatch"))))
+ (unless (file=? y z) (fail "mismatch"))))
'(msg_encrypted_256 msg_encrypted_384 msg_encrypted_521)))
;;
diff --git a/tests/openpgp/export.scm b/tests/openpgp/export.scm
index a79411c87..c10fc81cb 100755
--- a/tests/openpgp/export.scm
+++ b/tests/openpgp/export.scm
@@ -22,7 +22,7 @@
(define (check-for predicate lines message)
(unless (any predicate lines)
- (error message)))
+ (fail message)))
(define (check-exported-key dump keyid)
(check-for (lambda (l)
@@ -68,7 +68,7 @@
(lambda (port)
(unless
(eof-object? (peek-char port))
- (error (string-append
+ (fail (string-append
"Expected all passphrases to be consumed, but found: "
(read-all port)))))))
diff --git a/tests/openpgp/gpgtar.scm b/tests/openpgp/gpgtar.scm
index cd692de84..c88589f5f 100755
--- a/tests/openpgp/gpgtar.scm
+++ b/tests/openpgp/gpgtar.scm
@@ -43,7 +43,7 @@
(tr:call-with-content
(lambda (c)
(unless (all (lambda (f) (string-contains? c f)) testfiles)
- (error "some file(s) are missing from archive")))))
+ (fail "some file(s) are missing from archive")))))
(with-temporary-working-directory
(call-check `(,(tool 'gpgtar) --gpg ,(tool 'gpg) --gpg-args ,gpgargs
@@ -53,7 +53,7 @@
(for-each
(lambda (f) (unless (call-with-input-file f (lambda (x) #t))
- (error (string-append "missing file: " f))))
+ (fail (string-append "missing file: " f))))
testfiles))))
(info "Checking gpgtar without encryption")
diff --git a/tests/openpgp/gpgv-forged-keyring.scm b/tests/openpgp/gpgv-forged-keyring.scm
index 65d21c537..6885cd9fc 100755
--- a/tests/openpgp/gpgv-forged-keyring.scm
+++ b/tests/openpgp/gpgv-forged-keyring.scm
@@ -64,5 +64,5 @@ N1Glbw1OJfP1q+QFPMPKoCsTYmZpuugq2b5gV/eH0Abvk2pG4Fo/YTDPHhec7Jk=
(pipe:do
(pipe:echo (eval armored-file (current-environment)))
(pipe:spawn `(,@GPGV --keyring ,(in-srcdir "forged-keyring.gpg"))))
- (error "verification succeeded but should not")))
+ (fail "verification succeeded but should not")))
'(msg_signed_asc))
diff --git a/tests/openpgp/import.scm b/tests/openpgp/import.scm
index c3547533d..3b41746eb 100755
--- a/tests/openpgp/import.scm
+++ b/tests/openpgp/import.scm
@@ -58,4 +58,4 @@
(string-contains? line ":4096:1:DDA252EBB8EBE1AF:")))
(string-split-newlines c))))
(unless (= 2 (length keys))
- (error "Importing keys with long id collision failed"))))))
+ (fail "Importing keys with long id collision failed"))))))
diff --git a/tests/openpgp/issue2015.scm b/tests/openpgp/issue2015.scm
index 4f151aaf2..39df3338b 100755
--- a/tests/openpgp/issue2015.scm
+++ b/tests/openpgp/issue2015.scm
@@ -28,4 +28,4 @@
"GET_PASSPHRASE --no-ask some_id X X X")))
(unless (string=? (string-rtrim char-whitespace? response)
"OK 736F6D655F70617373706872617365")
- (error "Could not retrieve passphrase from cache:" response)))
+ (fail "Could not retrieve passphrase from cache:" response)))
diff --git a/tests/openpgp/issue2346.scm b/tests/openpgp/issue2346.scm
index cbe03f9b7..9765453ea 100755
--- a/tests/openpgp/issue2346.scm
+++ b/tests/openpgp/issue2346.scm
@@ -25,4 +25,4 @@
(info "Checking import statistics (issue2346)...")
(let ((status (call-popen `(,@GPG --status-fd=1 --import ,key) "")))
(unless (string-contains? status "IMPORT_RES 1 0 1 0 0 0 0 0 0 1 1 0 0 0 0")
- (error "Unexpected number of keys imported" status)))
+ (fail "Unexpected number of keys imported" status)))
diff --git a/tests/openpgp/issue2419.scm b/tests/openpgp/issue2419.scm
index 9b6785154..e397a8877 100755
--- a/tests/openpgp/issue2419.scm
+++ b/tests/openpgp/issue2419.scm
@@ -26,4 +26,4 @@
(dearmor (in-srcdir "samplemsgs/issue2419.asc") onebyte)
(catch (assert (string-contains? (car *error*) "invalid packet"))
(call-popen `(,@GPG --list-packets ,onebyte) "")
- (error "Expected an error but got none")))
+ (fail "Expected an error but got none")))
diff --git a/tests/openpgp/key-selection.scm b/tests/openpgp/key-selection.scm
index 93bd001d7..020c9b422 100644
--- a/tests/openpgp/key-selection.scm
+++ b/tests/openpgp/key-selection.scm
@@ -76,7 +76,7 @@
(display (call-popen `(,@gpg --locate-key ,mailbox) ""))
(echo "This is the key we expected:")
(display (call-popen `(,@gpg --list-keys ,expected) ""))
- (error "Expected" expected "but got" fpr)))
+ (fail "Expected" expected "but got" fpr)))
(delete-keys set))
(lambda (set)
(length set))
diff --git a/tests/openpgp/mds.scm b/tests/openpgp/mds.scm
index bf598eb66..fb468e5de 100755
--- a/tests/openpgp/mds.scm
+++ b/tests/openpgp/mds.scm
@@ -49,7 +49,7 @@
(define (test-hash hash ref)
(unless (eq? #f ref)
(if (not (string=? (:value hash) (:value ref)))
- (error "failed"))))
+ (fail "failed"))))
;; Test whether the hashes computed over S match the REFERENCE set.
(define (test-hashes msg s reference)
diff --git a/tests/openpgp/multisig.scm b/tests/openpgp/multisig.scm
index 7f1c4c509..c643ac88d 100755
--- a/tests/openpgp/multisig.scm
+++ b/tests/openpgp/multisig.scm
@@ -164,6 +164,6 @@ cnksIEkgY2FuJ3QgZG8gdGhhdAo=
(pipe:write-to file (logior O_WRONLY O_CREAT O_BINARY) #o600))
(if (= 0 (call `(,@GPG --verify ,file)))
- (error "Bad signature verified ok"))))
+ (fail "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 d2e125e4e..fc0615fc8 100755
--- a/tests/openpgp/setup.scm
+++ b/tests/openpgp/setup.scm
@@ -20,7 +20,7 @@
(load (with-path "defs.scm"))
(unless (member "--create-tarball" *args*)
- (error "Usage: setup.scm --create-tarball <file>"))
+ (fail "Usage: setup.scm --create-tarball <file>"))
(with-temporary-working-directory
(setenv "GNUPGHOME" (getcwd) #t)
diff --git a/tests/openpgp/signencrypt.scm b/tests/openpgp/signencrypt.scm
index b4c3bd6df..35ac89a0f 100755
--- a/tests/openpgp/signencrypt.scm
+++ b/tests/openpgp/signencrypt.scm
@@ -37,4 +37,4 @@
usrpass1)
(if (not (string=? "4336AE2A528FAE091E73E59E325B588FEE795F9B"
(cadar (gpg-hash-string `(--print-md SHA1 ,tmp) ""))))
- (error "bug537-test.data.asc: mismatch (bug 537)")))
+ (fail "bug537-test.data.asc: mismatch (bug 537)")))
diff --git a/tests/openpgp/ssh-import.scm b/tests/openpgp/ssh-import.scm
index a825409d6..e8f12d36c 100755
--- a/tests/openpgp/ssh-import.scm
+++ b/tests/openpgp/ssh-import.scm
@@ -22,7 +22,7 @@
(define GNUPGHOME (getenv "GNUPGHOME"))
(if (string=? "" GNUPGHOME)
- (error "GNUPGHOME not set"))
+ (fail "GNUPGHOME not set"))
(setenv "SSH_AUTH_SOCK"
(call-check `(,(tool 'gpgconf) --null --list-dirs agent-ssh-socket))
@@ -51,7 +51,7 @@
(pipe:open file (logior O_RDONLY O_BINARY))
(pipe:spawn `(,SSH-ADD -)))
(unless (string-contains? (call-popen `(,SSH-ADD -l "-E" md5) "") hash)
- (error "key not added"))))
+ (fail "key not added"))))
car keys)
(info "Checking for issue2316...")
@@ -64,4 +64,4 @@
(unless
(string-contains? (call-popen `(,SSH-ADD -l "-E" md5) "")
"c9:85:b5:55:00:84:a9:82:5a:df:d6:62:1b:5a:28:22")
- (error "known private key not (re-)added to sshcontrol"))
+ (fail "known private key not (re-)added to sshcontrol"))
diff --git a/tests/openpgp/tofu.scm b/tests/openpgp/tofu.scm
index f9dc41102..47c3dd0a4 100755
--- a/tests/openpgp/tofu.scm
+++ b/tests/openpgp/tofu.scm
@@ -25,7 +25,7 @@
--faked-system-time=1480943782))
(define GNUPGHOME (getenv "GNUPGHOME"))
(if (string=? "" GNUPGHOME)
- (error "GNUPGHOME not set"))
+ (fail "GNUPGHOME not set"))
(catch (skip "Tofu not supported")
(call-check `(,@GPG --trust-model=tofu --list-config)))
@@ -37,7 +37,7 @@
(call-check `(,@GPG --import
,(in-srcdir "tofu/conflicting/"
(string-append keyid ".gpg"))))
- (catch (error "Missing key" keyid)
+ (catch (fail "Missing key" keyid)
(call-check `(,@GPG --list-keys ,keyid))))
KEYS)
@@ -52,7 +52,7 @@
,@args
--list-keys ,keyid))) 5)))
(unless (member policy '("auto" "good" "unknown" "bad" "ask"))
- (error "Bad policy:" policy))
+ (fail "Bad policy:" policy))
policy))
;; Check that KEYID's tofu policy matches EXPECTED-POLICY. Any
@@ -62,7 +62,7 @@
(define (checkpolicy keyid expected-policy . args)
(let ((policy (apply getpolicy `(,keyid ,@args))))
(unless (string=? policy expected-policy)
- (error keyid ": Expected policy to be" expected-policy
+ (fail keyid ": Expected policy to be" expected-policy
"but got" policy))))
;; Get the trust level for KEYID. Any remaining arguments are simply
@@ -77,7 +77,7 @@
--list-keys ,keyid))) 1)))
(unless (and (= 1 (string-length trust))
(member (string-ref trust 0) (string->list "oidreqnmfuws-")))
- (error "Bad trust value:" trust))
+ (fail "Bad trust value:" trust))
trust))
;; Check that KEYID's trust level matches EXPECTED-TRUST. Any
@@ -87,7 +87,7 @@
(define (checktrust keyid expected-trust . args)
(let ((trust (apply gettrust `(,keyid ,@args))))
(unless (string=? trust expected-trust)
- (error keyid ": Expected trust to be" expected-trust
+ (fail keyid ": Expected trust to be" expected-trust
"but got" trust))))
;; Set key KEYID's policy to POLICY. Any remaining arguments are
@@ -177,10 +177,10 @@
(sigs (string->number (list-ref tfs 3)))
(encs (string->number (list-ref tfs 4))))
(unless (= sigs expected-sigs)
- (error keyid ": # signatures (" sigs ") does not match expected"
+ (fail keyid ": # signatures (" sigs ") does not match expected"
"# signatures (" expected-sigs ").\n"))
(unless (= encs expected-encs)
- (error keyid ": # encryptions (" encs ") does not match expected"
+ (fail keyid ": # encryptions (" encs ") does not match expected"
"# encryptions (" expected-encs ").\n"))
))
diff --git a/tests/openpgp/verify.scm b/tests/openpgp/verify.scm
index 2c2c14a7f..a398a1483 100755
--- a/tests/openpgp/verify.scm
+++ b/tests/openpgp/verify.scm
@@ -33,7 +33,7 @@
(display (make-string 64 (integer->char (string->number char)))
port)))
(if (= 0 (call `(,@GPG --verify ,x data-500)))
- (error "no error code from verify"))))
+ (fail "no error code from verify"))))
'("#x2d" "#xca"))
;; A plain signed message created using
@@ -324,7 +324,7 @@ GisM
(pipe:defer (lambda (sink)
(display armored-file (fdopen sink "w"))))
(pipe:spawn `(,@GPG --verify)))
- (error "verification succeeded but should not")))
+ (fail "verification succeeded but should not")))
'(msg_olsols_asc_multiple msg_clsclss_asc_multiple))
(for-each-p
@@ -334,7 +334,7 @@ GisM
(pipe:do
(pipe:echo (eval armored-file (current-environment)))
(pipe:spawn `(,@GPG --verify)))
- (error "verification succeeded but should not")))
+ (fail "verification succeeded but should not")))
'(bad_ls_asc bad_fols_asc bad_olsf_asc bad_ools_asc))