[Pkg-gnupg-commit] [gnupg2] 97/185: tests: Improve 'shell.scm' script.
Daniel Kahn Gillmor
dkg at fifthhorseman.net
Mon Aug 7 11:55:24 UTC 2017
This is an automated email from the git hooks/post-receive script.
dkg pushed a commit to branch experimental
in repository gnupg2.
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>
---
tests/openpgp/defs.scm | 1 +
tests/openpgp/shell.scm | 28 ++++++++++++++++++++++++----
2 files changed, 25 insertions(+), 4 deletions(-)
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)
--
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