diff options
author | Justus Winter <justus@g10code.com> | 2017-07-14 12:59:00 +0200 |
---|---|---|
committer | Justus Winter <justus@g10code.com> | 2017-07-14 12:59:00 +0200 |
commit | 58eafd11ed5501c0b72fcb553eb3e097ad29b3c6 (patch) | |
tree | 5d1a989cd7ecfeee8fc92a87d216e1d7076b5010 /tests | |
parent | gpgscm: Library improvements. (diff) | |
download | gnupg2-58eafd11ed5501c0b72fcb553eb3e097ad29b3c6.tar.xz gnupg2-58eafd11ed5501c0b72fcb553eb3e097ad29b3c6.zip |
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>
Diffstat (limited to 'tests')
-rw-r--r-- | tests/openpgp/defs.scm | 1 | ||||
-rw-r--r-- | 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 50976b9eb..b5e307880 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 bd6059a86..347b3a08c 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) |