[Pkg-gnupg-commit] [gnupg2] 54/116: tests: Improve gpgconf test.

Daniel Kahn Gillmor dkg at fifthhorseman.net
Tue Jan 24 04:40:53 UTC 2017


This is an automated email from the git hooks/post-receive script.

dkg pushed a commit to branch master
in repository gnupg2.

commit 88e42ef08d65d4d1bc29c6cea48df19ca0d5e2bd
Author: Justus Winter <justus at g10code.com>
Date:   Tue Jan 10 15:50:57 2017 +0100

    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 at g10code.com>
---
 tests/openpgp/defs.scm    | 11 ++++++++++-
 tests/openpgp/gpgconf.scm | 20 +++++++++++++++-----
 2 files changed, 25 insertions(+), 6 deletions(-)

diff --git a/tests/openpgp/defs.scm b/tests/openpgp/defs.scm
index 1895a75..548476b 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 `(, at valgrind , at 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 cdb6b76..b4cc9cb 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"))))

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