1
0
Fork 0
mirror of git://git.gnupg.org/gnupg.git synced 2025-07-03 22:56:33 +02:00

tests: Locate resources and scripts relative to top source dir.

--

Locate every resource and every script used in the tests using a path
relative to the top of the source tree.

This is a purely mechanical change, mostly done using regular
expressions, with a few manual fixups here and there.

Signed-off-by: Justus Winter <justus@g10code.com>
This commit is contained in:
Justus Winter 2017-03-22 12:40:42 +01:00
parent f03d6897be
commit ed4d23d75e
No known key found for this signature in database
GPG key ID: DD1A52F9DA8C9020
87 changed files with 208 additions and 182 deletions

View file

@ -31,9 +31,9 @@ AM_CFLAGS =
TESTS_ENVIRONMENT = LC_ALL=C \
EXEEXT=$(EXEEXT) \
PATH=../gpgscm:$(PATH) \
srcdir=$(abs_srcdir) \
abs_top_srcdir=$(abs_top_srcdir) \
objdir=$(abs_top_builddir) \
GPGSCM_PATH=$(abs_top_srcdir)/tests/gpgscm:$(abs_top_srcdir)/tests/openpgp:$(abs_top_srcdir)/tests/gpgsm
GPGSCM_PATH=$(abs_top_srcdir)/tests/gpgscm
XTESTS = \
import.scm \

View file

@ -17,14 +17,14 @@
;; You should have received a copy of the GNU General Public License
;; along with this program; if not, see <http://www.gnu.org/licenses/>.
(load (with-path "gpgsm-defs.scm"))
(load (in-srcdir "tests" "gpgsm" "gpgsm-defs.scm"))
(setup-gpgsm-environment)
(for-each-p
"Checking decryption of supplied files."
(lambda (name)
(tr:do
(tr:open (in-srcdir (string-append name ".cms.asc")))
(tr:open (in-srcdir "tests" "gpgsm" (string-append name ".cms.asc")))
(tr:gpgsm "" '(--decrypt))
(tr:assert-identity name)))
plain-files)

View file

@ -17,7 +17,7 @@
;; You should have received a copy of the GNU General Public License
;; along with this program; if not, see <http://www.gnu.org/licenses/>.
(load (with-path "gpgsm-defs.scm"))
(load (in-srcdir "tests" "gpgsm" "gpgsm-defs.scm"))
(setup-gpgsm-environment)
(for-each-p

View file

@ -17,7 +17,7 @@
;; You should have received a copy of the GNU General Public License
;; along with this program; if not, see <http://www.gnu.org/licenses/>.
(load (with-path "gpgsm-defs.scm"))
(load (in-srcdir "tests" "gpgsm" "gpgsm-defs.scm"))
(setup-gpgsm-environment)
(for-each-p'

View file

@ -17,7 +17,7 @@
;; You should have received a copy of the GNU General Public License
;; along with this program; if not, see <http://www.gnu.org/licenses/>.
(load (with-path "defs.scm"))
(load (in-srcdir "tests" "openpgp" "defs.scm"))
;; This is the list of certificates that we install in the test
;; environment.
@ -83,13 +83,13 @@
(log "Storing private keys")
(for-each
(lambda (name)
(file-copy (in-srcdir name)
(file-copy (in-srcdir "tests" "gpgsm" name)
(path-join "private-keys-v1.d"
(string-append name ".key"))))
'("32100C27173EF6E9C4E9A25D3D69F86D37A4F939"))
(log "Importing public demo and test keys")
(call-check `(,@gpgsm --import ,(in-srcdir "cert_g10code_test1.der")))
(call-check `(,@gpgsm --import ,(in-srcdir "tests" "gpgsm" "cert_g10code_test1.der")))
(create-sample-files)
(stop-agent))

View file

@ -17,7 +17,7 @@
;; You should have received a copy of the GNU General Public License
;; along with this program; if not, see <http://www.gnu.org/licenses/>.
(load (with-path "gpgsm-defs.scm"))
(load (in-srcdir "tests" "gpgsm" "gpgsm-defs.scm"))
(setup-gpgsm-environment)
(define certs-for-import
@ -47,7 +47,7 @@
"Checking certificate import."
(lambda (test)
(assert (not (sm-have-public-key? (:cert test))))
(call-check `(,@gpgsm --import ,(in-srcdir (:name test))))
(call-check `(,@gpgsm --import ,(in-srcdir "tests" "gpgsm" (:name test))))
(assert (sm-have-public-key? (:cert test))))
(lambda (test) (:name test))
certs-for-import)

View file

@ -17,16 +17,22 @@
;; You should have received a copy of the GNU General Public License
;; along with this program; if not, see <http://www.gnu.org/licenses/>.
(if (string=? "" (getenv "srcdir"))
(if (string=? "" (getenv "abs_top_srcdir"))
(begin
(echo "Environment variable 'srcdir' not set. Please point it to"
(echo "Environment variable 'abs_top_srcdir' not set. Please point it to"
"tests/gpgsm.")
(exit 2)))
(let* ((tests (filter (lambda (arg) (not (string-prefix? arg "--"))) *args*))
(setup (make-environment-cache (test::scm #f "setup.scm" "setup.scm")))
(setup (make-environment-cache (test::scm
#f
(path-join "tests" "gpgsm" "setup.scm")
(in-srcdir "tests" "gpgsm" "setup.scm"))))
(runner (if (and (member "--parallel" *args*)
(> (length tests) 1))
run-tests-parallel
run-tests-sequential)))
(runner (map (lambda (t) (test::scm setup t t)) tests)))
(runner (map (lambda (name)
(test::scm setup
(path-join "tests" "gpgsm" name)
(in-srcdir "tests" "gpgsm" name))) tests)))

View file

@ -17,7 +17,7 @@
;; You should have received a copy of the GNU General Public License
;; along with this program; if not, see <http://www.gnu.org/licenses/>.
(load (with-path "gpgsm-defs.scm"))
(load (in-srcdir "tests" "gpgsm" "gpgsm-defs.scm"))
(define tarball (flag "--create-tarball" *args*))
(unless (and tarball (not (null? tarball)))

View file

@ -17,7 +17,7 @@
;; You should have received a copy of the GNU General Public License
;; along with this program; if not, see <http://www.gnu.org/licenses/>.
(load (with-path "gpgsm-defs.scm"))
(load (in-srcdir "tests" "gpgsm" "gpgsm-defs.scm"))
(setup-gpgsm-environment)
;; This is not a test, but can be used to inspect the test

View file

@ -17,7 +17,7 @@
;; You should have received a copy of the GNU General Public License
;; along with this program; if not, see <http://www.gnu.org/licenses/>.
(load (with-path "gpgsm-defs.scm"))
(load (in-srcdir "tests" "gpgsm" "gpgsm-defs.scm"))
(setup-gpgsm-environment)
(for-each-p

View file

@ -17,7 +17,7 @@
;; You should have received a copy of the GNU General Public License
;; along with this program; if not, see <http://www.gnu.org/licenses/>.
(load (with-path "gpgsm-defs.scm"))
(load (in-srcdir "tests" "gpgsm" "gpgsm-defs.scm"))
(setup-gpgsm-environment)
;;