summaryrefslogtreecommitdiffstats
path: root/tests/openpgp
diff options
context:
space:
mode:
authorJustus Winter <justus@g10code.com>2017-01-10 15:50:57 +0100
committerJustus Winter <justus@g10code.com>2017-01-10 15:50:57 +0100
commit88e42ef08d65d4d1bc29c6cea48df19ca0d5e2bd (patch)
treef8aebf78fafa3e7f78a8a4cc126e564f48063a37 /tests/openpgp
parenttools: Fix memory leaks and improve error handling. (diff)
downloadgnupg2-88e42ef08d65d4d1bc29c6cea48df19ca0d5e2bd.tar.xz
gnupg2-88e42ef08d65d4d1bc29c6cea48df19ca0d5e2bd.zip
tests: Improve gpgconf test.
* tests/openpgp/defs.scm (valgrind): New variable. (gpg-config): Fix clearing an option. * tests/openpgp/gpgconf.scm: Also toggle 'quiet'. Signed-off-by: Justus Winter <justus@g10code.com>
Diffstat (limited to 'tests/openpgp')
-rw-r--r--tests/openpgp/defs.scm11
-rw-r--r--tests/openpgp/gpgconf.scm20
2 files changed, 25 insertions, 6 deletions
diff --git a/tests/openpgp/defs.scm b/tests/openpgp/defs.scm
index 1895a7587..548476bdb 100644
--- a/tests/openpgp/defs.scm
+++ b/tests/openpgp/defs.scm
@@ -131,6 +131,15 @@
(string-append bin-prefix "/" (basename (caddr t)))
(string-append (getenv "objdir") "/" (caddr t)))))))
+;; You can splice VALGRIND into your argument vector to run programs
+;; under valgrind. For example, to run valgrind on gpg, you may want
+;; to redefine gpg:
+;;
+;; (set! gpg `(,@valgrind ,@gpg))
+;;
+(define valgrind
+ '("/usr/bin/valgrind" --leak-check=full --error-exitcode=154))
+
(define (gpg-conf . args)
(gpg-conf' "" args))
(define (gpg-conf' input args)
@@ -149,7 +158,7 @@
(gpg-conf' (string-append key ":0:" (percent-encode value))
`(--change-options ,component)))
(define (clear)
- (gpg-conf' (string-append key ":1:")
+ (gpg-conf' (string-append key ":16:")
`(--change-options ,component)))))
diff --git a/tests/openpgp/gpgconf.scm b/tests/openpgp/gpgconf.scm
index cdb6b760a..b4cc9cb13 100644
--- a/tests/openpgp/gpgconf.scm
+++ b/tests/openpgp/gpgconf.scm
@@ -27,15 +27,25 @@
""
(lambda (progress)
(do ((i 0 (+ 1 i))) ((> i 12) #t)
- (opt::update (make-value i))
- (assert (string=? (make-value i) (list-ref (opt::value) 9)))
+ (let ((value (make-value i)))
+ (if value
+ (begin
+ (opt::update value)
+ (assert (string=? value (list-ref (opt::value) 9))))
+ (begin
+ (opt::clear)
+ (let ((v (opt::value)))
+ (assert (or (< (length v) 10)
+ (string=? "" (list-ref v 9))))))))
(progress ".")))))
(lambda (name . rest) name)
- (list "keyserver" "verbose")
+ (list "keyserver" "verbose" "quiet")
(list (gpg-config 'gpg "keyserver")
- (gpg-config 'gpg "verbose"))
+ (gpg-config 'gpg "verbose")
+ (gpg-config 'gpg "quiet"))
(list (lambda (i) (if (even? i) "\"hkp://foo.bar" "\"hkps://bar.baz"))
(lambda (i) (number->string
;; gpgconf: argument for option verbose of type 0
;; (none) must be positive
- (+ 1 i)))))
+ (+ 1 i)))
+ (lambda (i) (if (even? i) #f "1"))))