1;; Copyright (C) 2016 g10 Code GmbH 2;; 3;; This file is part of GnuPG. 4;; 5;; GnuPG is free software; you can redistribute it and/or modify 6;; it under the terms of the GNU General Public License as published by 7;; the Free Software Foundation; either version 3 of the License, or 8;; (at your option) any later version. 9;; 10;; GnuPG is distributed in the hope that it will be useful, 11;; but WITHOUT ANY WARRANTY; without even the implied warranty of 12;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13;; GNU General Public License for more details. 14;; 15;; You should have received a copy of the GNU General Public License 16;; along with this program; if not, see <http://www.gnu.org/licenses/>. 17 18(if (string=? "" (getenv "abs_top_srcdir")) 19 (error "not called from make")) 20 21(let ((verbose (string->number (getenv "verbose")))) 22 (if (number? verbose) 23 (*set-verbose!* verbose))) 24 25(define (qualify executable) 26 (string-append executable (getenv "EXEEXT"))) 27 28;; We may not use a relative name for gpg-agent. 29(define gpgconf (path-join (getenv "objdir") "tools" (qualify "gpgconf"))) 30(define GPG-AGENT (path-join (getenv "objdir") "agent" (qualify "gpg-agent"))) 31(define GPG `(,(path-join (getenv "objdir") "g10" (qualify "gpg")) 32 --no-permission-warning --no-greeting 33 --no-secmem-warning --batch 34 ,(string-append "--agent-program=" GPG-AGENT 35 "|--debug-quick-random"))) 36(define GPG-no-batch 37 (filter (lambda (arg) (not (equal? arg '--batch))) GPG)) 38 39(define GPGTAR (path-join (getenv "objdir") "tools" (qualify "gpgtar"))) 40 41(define (untar-armored source-name) 42 (with-ephemeral-home-directory (lambda ()) (lambda ()) 43 (pipe:do 44 (pipe:open source-name (logior O_RDONLY O_BINARY)) 45 (pipe:spawn `(,@GPG --dearmor)) 46 (pipe:spawn `(,GPGTAR --extract --directory=. -))))) 47 48(define (run-test message src-tarball test) 49 (catch (skip "gpgtar not built") 50 (call-check `(,GPGTAR --help))) 51 52 (with-temporary-working-directory 53 (info message) 54 (untar-armored src-tarball) 55 (setenv "GNUPGHOME" (getcwd) #t) 56 57 (catch (log "Warning: Creating socket directory failed:" (car *error*)) 58 (call-popen `(,gpgconf --create-socketdir) "")) 59 (test (getcwd)) 60 (catch (log "Warning: Removing socket directory failed.") 61 (call-popen `(,gpgconf --remove-socketdir) "")))) 62