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:
	0fd7a90207

Fixes-commit: 1c88104a3f
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
(make-environment-cache
(test::scm
#f
#f
(path-join "tests" "cms" "setup.scm")
(in-srcdir "tests" "cms" "setup.scm")
(path-join "tests" "gpgsm" "setup.scm")
(in-srcdir "tests" "gpgsm" "setup.scm")
"--" "tests" "gpg")))
(map (lambda (name)
(test::scm setup
#f
(path-join "tests" "cms" name)
(in-srcdir "tests" "cms" name)))
(parse-makefile-expand (in-srcdir "tests" "cms" "Makefile.am")

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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