diff options
author | Justus Winter <[email protected]> | 2017-03-20 09:30:08 +0000 |
---|---|---|
committer | Justus Winter <[email protected]> | 2017-05-11 16:12:37 +0000 |
commit | f4365790daa1d1400c7f0fe73ac9a6d25f0c6d0a (patch) | |
tree | 67fadb83cbe030e2a402cd7c356228f38bd19ae0 /tests/gpgscm | |
parent | tests: Move the makefile parser. (diff) | |
download | gnupg-f4365790daa1d1400c7f0fe73ac9a6d25f0c6d0a.tar.gz gnupg-f4365790daa1d1400c7f0fe73ac9a6d25f0c6d0a.zip |
tests: Make it possible to run all tests using our infrastructure.
* Makefile.am (TESTS_ENVIRONMENT): New variable.
(check-all): New phony target to run all tests.
* tests/gpgme/gpgme-defs.scm (have-gpgme?): New function that tests
whether the GPGME test suite is available instead of exiting the
process.
* tests/gpgscm/init.scm (export): New macro.
* tests/gpgscm/tests.scm (run-tests): New function.
(load-tests): Likewise.
* tests/gpgme/run-tests.scm: Simplify and move the parsing of the list
of tests to 'all-tests.scm'.
* tests/gpgsm/run-tests.scm: Likewise.
* tests/migrations/run-tests.scm: Likewise.
* tests/openpgp/run-tests.scm: Likewise.
* tests/gpgme/Makefile.am: To select the tests to run, use the
variable 'TESTS'. This harmonizes the interface with the automake
test suite.
* tests/gpgsm/Makefile.am: Likewise.
* tests/migrations/Makefile.am: Likewise.
* tests/openpgp/Makefile.am: Likewise.
* tests/openpgp/README: Likewise.
* agent/all-tests.scm: New file.
* common/all-tests.scm: Likewise.
* g10/all-tests.scm: Likewise.
* g13/all-tests.scm: Likewise.
* tests/gpgme/all-tests.scm: Likewise.
* tests/gpgsm/all-tests.scm: Likewise.
* tests/migrations/all-tests.scm: Likewise.
* tests/openpgp/all-tests.scm: Likewise.
* tests/run-tests.scm: Likewise.
--
This change allows us to run all tests in parallel and write one XML
report capturing the results of every test. It also lays the
foundation to parametrize test suites.
Signed-off-by: Justus Winter <[email protected]>
Diffstat (limited to 'tests/gpgscm')
-rw-r--r-- | tests/gpgscm/init.scm | 5 | ||||
-rw-r--r-- | tests/gpgscm/tests.scm | 14 |
2 files changed, 19 insertions, 0 deletions
diff --git a/tests/gpgscm/init.scm b/tests/gpgscm/init.scm index af386201e..3769ed00d 100644 --- a/tests/gpgscm/init.scm +++ b/tests/gpgscm/init.scm @@ -701,6 +701,11 @@ ,@(cdr form) (current-environment)))) +(define-macro (export name . expressions) + `(define ,name + (begin + ,@expressions))) + ;;;;; I/O (define (input-output-port? p) diff --git a/tests/gpgscm/tests.scm b/tests/gpgscm/tests.scm index 490f95a36..eee8ce56f 100644 --- a/tests/gpgscm/tests.scm +++ b/tests/gpgscm/tests.scm @@ -226,6 +226,7 @@ (define (dirname path) (let ((i (string-rindex path #\/))) (if i (substring path 0 i) "."))) +(assert (string=? "foo/bar" (dirname "foo/bar/baz"))) ;; Helper for (pipe). (define :read-end car) @@ -739,6 +740,19 @@ (loop (pool::add (test::run-sync)) (cdr tests')))))) +;; Run tests either in sequence or in parallel, depending on the +;; number of tests and the command line flags. +(define (run-tests tests) + (if (and (flag "--parallel" *args*) + (> (length tests) 1)) + (run-tests-parallel tests) + (run-tests-sequential tests))) + +;; Load all tests from the given path. +(define (load-tests . path) + (load (apply in-srcdir `(,@path "all-tests.scm"))) + all-tests) + ;; Helper to create environment caches from test functions. SETUP ;; must be a test implementing the producer side cache protocol. ;; Returns a promise containing the arguments that must be passed to a |