[git] GnuPG - branch, master, updated. gnupg-2.1.21-97-g58eafd1

by Justus Winter cvs at cvs.gnupg.org
Fri Jul 14 14:22:07 CEST 2017


This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "The GNU Privacy Guard".

The branch, master has been updated
       via  58eafd11ed5501c0b72fcb553eb3e097ad29b3c6 (commit)
       via  b4d25082fd4502ec01d511c22fecd60d513b81f4 (commit)
       via  7a6e6ad2880bbff54a75ff608d0ec97d6c405733 (commit)
      from  956da89193370d5aa970cff5b77f605534481a02 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit 58eafd11ed5501c0b72fcb553eb3e097ad29b3c6
Author: Justus Winter <justus at g10code.com>
Date:   Fri Jul 14 12:59:00 2017 +0200

    tests: Improve 'shell.scm' script.
    
    * tests/openpgp/defs.scm (create-file): Unlink file first.
    * tests/openpgp/shell.scm: Ask whether to import legacy test keys or
    not, and whether to drop 'batch' from the configuration.  Add paths to
    all the programs to 'PATH'.
    
    Signed-off-by: Justus Winter <justus at g10code.com>

diff --git a/tests/openpgp/defs.scm b/tests/openpgp/defs.scm
index 50976b9..b5e3078 100644
--- a/tests/openpgp/defs.scm
+++ b/tests/openpgp/defs.scm
@@ -316,6 +316,7 @@
      (display (make-random-string size) port))))
 
 (define (create-file name . lines)
+  (catch #f (unlink name))
   (letfd ((fd (open name (logior O_WRONLY O_CREAT O_BINARY) #o600)))
     (let ((port (fdopen fd "wb")))
       (for-each (lambda (line) (display line port) (newline port))
diff --git a/tests/openpgp/shell.scm b/tests/openpgp/shell.scm
index bd6059a..347b3a0 100644
--- a/tests/openpgp/shell.scm
+++ b/tests/openpgp/shell.scm
@@ -18,7 +18,6 @@
 ;; along with this program; if not, see <http://www.gnu.org/licenses/>.
 
 (load (in-srcdir "tests" "openpgp" "defs.scm"))
-(setup-environment)
 
 ;; This is not a test, but can be used to inspect the test
 ;; environment.  Simply execute
@@ -27,7 +26,28 @@
 ;;
 ;; to run it.
 
-(echo "Note that gpg.conf includes 'batch'.  If you want to use gpg")
-(echo "interactively you should drop that.")
-(echo)
+(if (prompt-yes-no? "Load legacy test environment" #t)
+    (setup-legacy-environment)
+    (setup-environment))
+
+(if (prompt-yes-no? "Drop 'batch' from gpg.conf" #t)
+    (apply create-file
+	   (cons "gpg.conf"
+		 (filter (lambda (line) (not (equal? "batch" line)))
+			 (string-split-newlines
+			  (call-with-input-file "gpg.conf" read-all)))))
+    (begin
+      (echo "Note that gpg.conf includes 'batch'.  If you want to use gpg")
+      (echo "interactively you should drop that.")))
+
+;; Add paths to tools to PATH.
+(setenv "PATH" (pathsep-join
+		(append (map (lambda (t) (dirname (tool t)))
+			     '(gpg gpg-agent scdaemon gpgsm dirmngr gpgconf))
+			(pathsep-split (getenv "PATH"))))
+	#t)
+
+(echo "\nEnjoy your test environment. "
+      "Type 'exit' to exit it, it will be cleaned up after you.\n")
+
 (interactive-shell)

commit b4d25082fd4502ec01d511c22fecd60d513b81f4
Author: Justus Winter <justus at g10code.com>
Date:   Fri Jul 14 12:57:41 2017 +0200

    gpgscm: Library improvements.
    
    * tests/gpgscm/repl.scm (prompt-yes-no?): New function.
    * tests/gpgscm/tests.scm (pathsep-split): Likewise.
    (pathsep-join): Likewise.
    (with-path): Use the new function.
    
    Signed-off-by: Justus Winter <justus at g10code.com>

diff --git a/tests/gpgscm/repl.scm b/tests/gpgscm/repl.scm
index 84454dc..833ec0d 100644
--- a/tests/gpgscm/repl.scm
+++ b/tests/gpgscm/repl.scm
@@ -55,3 +55,15 @@
 (define (interactive-repl . environment)
   (repl (lambda (p) (prompt-append-prefix "gpgscm " p))
 	(if (null? environment) (interaction-environment) (car environment))))
+
+;; Ask a yes/no question.
+(define (prompt-yes-no? question default)
+  (let ((answer (prompt (string-append question "? ["
+				       (if default "Y/n" "y/N") "] "))))
+    (cond
+     ((= 0 (string-length answer))
+      default)
+     ((or (equal? "y" answer) (equal? "Y" answer))
+      #t)
+     (else
+      #f))))
diff --git a/tests/gpgscm/tests.scm b/tests/gpgscm/tests.scm
index 06084de..40ba7e3 100644
--- a/tests/gpgscm/tests.scm
+++ b/tests/gpgscm/tests.scm
@@ -192,6 +192,16 @@
 (define (in-srcdir . names)
   (canonical-path (apply path-join (cons (getenv "abs_top_srcdir") names))))
 
+;; Split a list of paths.
+(define (pathsep-split s)
+  (string-split s *pathsep*))
+
+;; Join a list of paths.
+(define (pathsep-join paths)
+  (foldr (lambda (a b) (string-append a (string *pathsep*) b))
+	 (car paths)
+	 (cdr paths)))
+
 ;; Try to find NAME in PATHS.  Returns the full path name on success,
 ;; or raises an error.
 (define (path-expand name paths)
@@ -209,7 +219,7 @@
 ;;   (load (with-path "library.scm"))
 (define (with-path name)
   (catch name
-	 (path-expand name (string-split (getenv "GPGSCM_PATH") *pathsep*))))
+	 (path-expand name (pathsep-split (getenv "GPGSCM_PATH")))))
 
 (define (basename path)
   (let ((i (string-index path #\/)))

commit 7a6e6ad2880bbff54a75ff608d0ec97d6c405733
Author: Justus Winter <justus at g10code.com>
Date:   Fri Jul 14 12:55:01 2017 +0200

    gpgscm: Fail early if the test setup fails.
    
    * tests/gpgscm/tests.scm (make-environment-cache): Check status code
    of setup script.
    
    Signed-off-by: Justus Winter <justus at g10code.com>

diff --git a/tests/gpgscm/tests.scm b/tests/gpgscm/tests.scm
index a6772d1..06084de 100644
--- a/tests/gpgscm/tests.scm
+++ b/tests/gpgscm/tests.scm
@@ -838,6 +838,8 @@
 	  (let ((tarball (make-temporary-file "environment-cache")))
 	    (atexit (lambda () (remove-temporary-file tarball)))
 	    (setup::run-sync '--create-tarball tarball)
+	    (if (not (equal? 'PASS (setup::status)))
+		(fail "Setup failed."))
 	    `(--unpack-tarball ,tarball)))))
 
 ;; Command line flag handling.  Returns the elements following KEY in

-----------------------------------------------------------------------

Summary of changes:
 tests/gpgscm/repl.scm   | 12 ++++++++++++
 tests/gpgscm/tests.scm  | 14 +++++++++++++-
 tests/openpgp/defs.scm  |  1 +
 tests/openpgp/shell.scm | 28 ++++++++++++++++++++++++----
 4 files changed, 50 insertions(+), 5 deletions(-)


hooks/post-receive
-- 
The GNU Privacy Guard
http://git.gnupg.org




More information about the Gnupg-commits mailing list