mirror of
git://git.gnupg.org/gnupg.git
synced 2024-12-22 10:19:57 +01:00
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@g10code.com>
This commit is contained in:
parent
b4d25082fd
commit
58eafd11ed
@ -316,6 +316,7 @@
|
|||||||
(display (make-random-string size) port))))
|
(display (make-random-string size) port))))
|
||||||
|
|
||||||
(define (create-file name . lines)
|
(define (create-file name . lines)
|
||||||
|
(catch #f (unlink name))
|
||||||
(letfd ((fd (open name (logior O_WRONLY O_CREAT O_BINARY) #o600)))
|
(letfd ((fd (open name (logior O_WRONLY O_CREAT O_BINARY) #o600)))
|
||||||
(let ((port (fdopen fd "wb")))
|
(let ((port (fdopen fd "wb")))
|
||||||
(for-each (lambda (line) (display line port) (newline port))
|
(for-each (lambda (line) (display line port) (newline port))
|
||||||
|
@ -18,7 +18,6 @@
|
|||||||
;; along with this program; if not, see <http://www.gnu.org/licenses/>.
|
;; along with this program; if not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
(load (in-srcdir "tests" "openpgp" "defs.scm"))
|
(load (in-srcdir "tests" "openpgp" "defs.scm"))
|
||||||
(setup-environment)
|
|
||||||
|
|
||||||
;; This is not a test, but can be used to inspect the test
|
;; This is not a test, but can be used to inspect the test
|
||||||
;; environment. Simply execute
|
;; environment. Simply execute
|
||||||
@ -27,7 +26,28 @@
|
|||||||
;;
|
;;
|
||||||
;; to run it.
|
;; to run it.
|
||||||
|
|
||||||
(echo "Note that gpg.conf includes 'batch'. If you want to use gpg")
|
(if (prompt-yes-no? "Load legacy test environment" #t)
|
||||||
(echo "interactively you should drop that.")
|
(setup-legacy-environment)
|
||||||
(echo)
|
(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)
|
(interactive-shell)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user