1
0
mirror of git://git.gnupg.org/gnupg.git synced 2024-12-22 10:19:57 +01:00

tests: Fix to support --enable-all-tests and variants.

* tests/gpgscm/tests.scm (test::scm): Add VARIANT argument.
(tests::new): Likewise.
(open-log-file, report): Support VARIANT.
* tests/gpgme/all-tests.scm (setup-c, setup-py): Follow the change.
* tests/cms/all-tests.scm: Likewise.
* tests/cms/run-tests.scm: Likewise.
* tests/migrations/all-tests.scm: Likewise.
* tests/migrations/run-tests.scm: Likewise.
* tests/openpgp/all-tests.scm: Likewise.
* tests/openpgp/run-tests.scm: Likewise.

--

Forward port from 2.2 branch of:
	0fd7a902070ad9bdd835fa57dbadff25917bca42

Fixes-commit: 1c88104a3f00f7ca3790fbaab8f67b2b68cd6e18
Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>
This commit is contained in:
NIIBE Yutaka 2022-11-24 15:22:32 +09:00
parent 7071f30762
commit 1246e16432
No known key found for this signature in database
GPG Key ID: 640114AF89DE6054
8 changed files with 36 additions and 16 deletions

View File

@ -29,13 +29,17 @@
(define setup (define setup
(make-environment-cache (make-environment-cache
(test::scm (test::scm
#f
#f #f
(path-join "tests" "cms" "setup.scm") (path-join "tests" "cms" "setup.scm")
(in-srcdir "tests" "cms" "setup.scm") (in-srcdir "tests" "cms" "setup.scm")
(path-join "tests" "gpgsm" "setup.scm")
(in-srcdir "tests" "gpgsm" "setup.scm")
"--" "tests" "gpg"))) "--" "tests" "gpg")))
(map (lambda (name) (map (lambda (name)
(test::scm setup (test::scm setup
#f
(path-join "tests" "cms" name) (path-join "tests" "cms" name)
(in-srcdir "tests" "cms" name))) (in-srcdir "tests" "cms" name)))
(parse-makefile-expand (in-srcdir "tests" "cms" "Makefile.am") (parse-makefile-expand (in-srcdir "tests" "cms" "Makefile.am")

View File

@ -27,6 +27,7 @@
(define setup (define setup
(make-environment-cache (test::scm (make-environment-cache (test::scm
#f
#f #f
(path-join "tests" "cms" "setup.scm") (path-join "tests" "cms" "setup.scm")
(in-srcdir "tests" "cms" "setup.scm")))) (in-srcdir "tests" "cms" "setup.scm"))))
@ -35,5 +36,6 @@
(load-tests "tests" "cms") (load-tests "tests" "cms")
(map (lambda (name) (map (lambda (name)
(test::scm setup (test::scm setup
#f
(path-join "tests" "cms" name) (path-join "tests" "cms" name)
(in-srcdir "tests" "cms" name))) tests))) (in-srcdir "tests" "cms" name))) tests)))

View File

@ -39,6 +39,7 @@
(define setup-c (define setup-c
(make-environment-cache (make-environment-cache
(test::scm (test::scm
#f
#f #f
(path-join "tests" "gpgme" "setup.scm" "tests" "gpg") (path-join "tests" "gpgme" "setup.scm" "tests" "gpg")
(in-srcdir "tests" "gpgme" "setup.scm") (in-srcdir "tests" "gpgme" "setup.scm")
@ -46,6 +47,7 @@
(define setup-py (define setup-py
(make-environment-cache (make-environment-cache
(test::scm (test::scm
#f
#f #f
(path-join "tests" "gpgme" "setup.scm" "lang" "python" "tests") (path-join "tests" "gpgme" "setup.scm" "lang" "python" "tests")
(in-srcdir "tests" "gpgme" "setup.scm") (in-srcdir "tests" "gpgme" "setup.scm")
@ -71,6 +73,7 @@
(map (lambda (name) (map (lambda (name)
(apply test::scm (apply test::scm
`(,(:setup cmpnts) `(,(:setup cmpnts)
#f
,(apply path-join ,(apply path-join
`("tests" "gpgme" ,@(:path cmpnts) ,name)) `("tests" "gpgme" ,@(:path cmpnts) ,name))
,(in-srcdir "tests" "gpgme" "wrap.scm") ,(in-srcdir "tests" "gpgme" "wrap.scm")

View File

@ -679,14 +679,14 @@
name)) name))
(package (package
(define (scm setup name path . args) (define (scm setup variant name path . args)
;; Start the process. ;; Start the process.
(define (spawn-scm args' in out err) (define (spawn-scm args' in out err)
(spawn-process-fd `(,*argv0* ,@(verbosity (*verbose*)) (spawn-process-fd `(,*argv0* ,@(verbosity (*verbose*))
,(locate-test (test-name path)) ,(locate-test (test-name path))
,@(if setup (force setup) '()) ,@(if setup (force setup) '())
,@args' ,@args) in out err)) ,@args' ,@args) in out err))
(new name #f spawn-scm #f #f CLOSED_FD (expect-failure? name))) (new variant name #f spawn-scm #f #f CLOSED_FD (expect-failure? name)))
(define (binary setup name path . args) (define (binary setup name path . args)
;; Start the process. ;; Start the process.
@ -694,9 +694,9 @@
(spawn-process-fd `(,(test-name path) (spawn-process-fd `(,(test-name path)
,@(if setup (force setup) '()) ,@args' ,@args) ,@(if setup (force setup) '()) ,@args' ,@args)
in out err)) in out err))
(new name #f spawn-binary #f #f CLOSED_FD (expect-failure? name))) (new #f name #f spawn-binary #f #f CLOSED_FD (expect-failure? name)))
(define (new name directory spawn pid retcode logfd expect-failure) (define (new variant name directory spawn pid retcode logfd expect-failure)
(package (package
;; XXX: OO glue. ;; XXX: OO glue.
@ -727,7 +727,9 @@
(unless log-file-name (unless log-file-name
(set! log-file-name (path-join (set! log-file-name (path-join
(getenv "objdir") (getenv "objdir")
(string-append name ".log")))) (if variant
(string-append name "." variant ".log")
(string-append name ".log")))))
(catch '() (unlink log-file-name)) (catch '() (unlink log-file-name))
(open log-file-name (logior O_RDWR O_BINARY O_CREAT) #o600)) (open log-file-name (logior O_RDWR O_BINARY O_CREAT) #o600))
@ -776,7 +778,10 @@
(seek logfd 0 SEEK_SET) (seek logfd 0 SEEK_SET)
(splice logfd STDERR_FILENO) (splice logfd STDERR_FILENO)
(close logfd)) (close logfd))
(echo (string-append (status-string) ":") name)) (echo (string-append (status-string) ":")
(if variant
(string-append "<" variant ">" name)
name)))
(define (xml) (define (xml)
(xx::tag (xx::tag

View File

@ -28,6 +28,7 @@
(map (lambda (name) (map (lambda (name)
(test::scm #f (test::scm #f
#f
(path-join "tests" "migrations" name) (path-join "tests" "migrations" name)
(in-srcdir "tests" "migrations" name))) (in-srcdir "tests" "migrations" name)))
(parse-makefile-expand (in-srcdir "tests" "migrations" "Makefile.am") (parse-makefile-expand (in-srcdir "tests" "migrations" "Makefile.am")

View File

@ -23,5 +23,6 @@
(load-tests "tests" "migrations") (load-tests "tests" "migrations")
(map (lambda (name) (map (lambda (name)
(test::scm #f (test::scm #f
#f
(path-join "tests" "migrations" name) (path-join "tests" "migrations" name)
(in-srcdir "tests" "migrations" name))) tests))) (in-srcdir "tests" "migrations" name))) tests)))

View File

@ -29,6 +29,7 @@
(define setup (define setup
(make-environment-cache (make-environment-cache
(test::scm (test::scm
#f
#f #f
(path-join "tests" "openpgp" "setup.scm") (path-join "tests" "openpgp" "setup.scm")
(in-srcdir "tests" "openpgp" "setup.scm")))) (in-srcdir "tests" "openpgp" "setup.scm"))))
@ -40,7 +41,8 @@
(make-environment-cache (make-environment-cache
(test::scm (test::scm
#f #f
(qualify (path-join "tests" "openpgp" "setup.scm") variant) variant
(path-join "tests" "openpgp" "setup.scm")
(in-srcdir "tests" "openpgp" "setup.scm") (in-srcdir "tests" "openpgp" "setup.scm")
(string-append "--" variant)))) (string-append "--" variant))))
@ -62,7 +64,8 @@
(define tests (define tests
(map (lambda (name) (map (lambda (name)
(test::scm setup (test::scm setup
(qualify (path-join "tests" "openpgp" name) "standard") "standard"
(path-join "tests" "openpgp" name)
(in-srcdir "tests" "openpgp" name))) all-tests)) (in-srcdir "tests" "openpgp" name))) all-tests))
(when *run-all-tests* (when *run-all-tests*
@ -73,17 +76,16 @@
(if keyboxd-enabled? (if keyboxd-enabled?
(map (lambda (name) (map (lambda (name)
(test::scm setup-use-keyboxd (test::scm setup-use-keyboxd
(qualify (path-join "tests" "openpgp" name) "keyboxd"
"keyboxd") (path-join "tests" "openpgp" name)
(in-srcdir "tests" "openpgp" name) (in-srcdir "tests" "openpgp" name)
"--use-keyboxd")) all-tests)) "--use-keyboxd")) all-tests))
;; The third pass uses the legact pubring.gpg ;; The third pass uses the legact pubring.gpg
(map (lambda (name) (map (lambda (name)
(test::scm setup-use-keyring (test::scm setup-use-keyring
(qualify (path-join "tests" "openpgp" name) "keyring"
"keyring") (path-join "tests" "openpgp" name)
(in-srcdir "tests" "openpgp" name) (in-srcdir "tests" "openpgp" name)
"--use-keyring")) all-tests) "--use-keyring")) all-tests))))
)))
tests) tests)

View File

@ -28,6 +28,7 @@
(define setup (define setup
(make-environment-cache (test::scm (make-environment-cache (test::scm
#f
#f #f
(path-join "tests" "openpgp" "setup.scm") (path-join "tests" "openpgp" "setup.scm")
(in-srcdir "tests" "openpgp" "setup.scm")))) (in-srcdir "tests" "openpgp" "setup.scm"))))
@ -55,11 +56,12 @@
(if use-keyboxd? (if use-keyboxd?
(map (lambda (name) (map (lambda (name)
(test::scm setup-use-keyboxd (test::scm setup-use-keyboxd
(qualify (path-join "tests" "openpgp" name) "keyboxd"
"keyboxd") (path-join "tests" "openpgp" name)
(in-srcdir "tests" "openpgp" name) (in-srcdir "tests" "openpgp" name)
"--use-keyboxd")) tests) "--use-keyboxd")) tests)
(map (lambda (name) (map (lambda (name)
(test::scm setup (test::scm setup
#f
(path-join "tests" "openpgp" name) (path-join "tests" "openpgp" name)
(in-srcdir "tests" "openpgp" name))) tests)))) (in-srcdir "tests" "openpgp" name))) tests))))