1
0
mirror of git://git.gnupg.org/gnupg.git synced 2024-06-02 22:38:02 +02:00

tests: Do not allow tests to be run in a shared environment.

* tests/openpgp/README: Update.
* tests/openpgp/run-tests.scm (run-tests-parallel-shared): Drop
function.
(run-tests-parallel-isolated): Rename to 'run-tests-parallel'.
(run-tests-sequential-shared): Drop function.
(run-tests-sequential-isolated): Rename to 'run-tests-sequential'.

Signed-off-by: Justus Winter <justus@g10code.com>
This commit is contained in:
Justus Winter 2016-11-07 14:57:51 +01:00
parent 37751d2b19
commit ac078469cb
2 changed files with 9 additions and 38 deletions

View File

@ -36,18 +36,13 @@ below. From your build directory, do:
run-tests.scm [test suite runner args] run-tests.scm [test suite runner args]
*** Arguments supported by the test suite runner *** Arguments supported by the test suite runner
The test suite runner supports four modes of operation, The test suite runner supports two modes of operation, '--sequential'
{sequential,parallel}x{isolated,shared}. You can select the mode of and '--parallel'. By default the tests are run in sequential order,
operation using a combination of the flags --parallel, --sequential, each one in a clean environment.
--shared, and --isolated.
By default the tests are run in sequential order, each one in a clean
environment.
You can specify the tests to run as positional arguments relative to You can specify the tests to run as positional arguments relative to
srcdir (e.g. just 'version.scm'). By default all tests listed in srcdir (e.g. just 'version.scm'). Note that you do not have to
run-tests.scm are executed. Note that you do not have to specify specify setup.scm and finish.scm, they are executed implicitly.
setup.scm and finish.scm, they are executed implicitly.
The test suite runner can be executed in any location that the current The test suite runner can be executed in any location that the current
user can write to. It will create temporary files and directories, user can write to. It will create temporary files and directories,

View File

@ -109,18 +109,7 @@
(define (report) (define (report)
(echo (string-append (status retcode) ":") name)))))) (echo (string-append (status retcode) ":") name))))))
(define (run-tests-parallel-shared setup teardown . tests) (define (run-tests-parallel setup teardown . tests)
(setup::run-sync)
(let loop ((pool (test-pool::new '())) (tests' tests))
(if (null? tests')
(let ((results (pool::wait)))
(for-each (lambda (t) (t::report)) results::procs)
(teardown::run-sync)
(exit (results::report)))
(let ((test (car tests')))
(loop (pool::add (test::run-async)) (cdr tests'))))))
(define (run-tests-parallel-isolated setup teardown . tests)
(lettmp (gpghome-tar) (lettmp (gpghome-tar)
(setup::run-sync '--create-tarball gpghome-tar) (setup::run-sync '--create-tarball gpghome-tar)
(let loop ((pool (test-pool::new '())) (tests' tests)) (let loop ((pool (test-pool::new '())) (tests' tests))
@ -140,16 +129,7 @@
(setup'::run-sync-quiet '--unpack-tarball gpghome-tar) (setup'::run-sync-quiet '--unpack-tarball gpghome-tar)
(loop (pool::add (test'::run-async)) (cdr tests'))))))) (loop (pool::add (test'::run-async)) (cdr tests')))))))
(define (run-tests-sequential-shared setup teardown . tests) (define (run-tests-sequential setup teardown . tests)
(let loop ((pool (test-pool::new '()))
(tests' `(,setup ,@tests ,teardown)))
(if (null? tests')
(let ((results (pool::wait)))
(exit (results::report)))
(let ((test (car tests')))
(loop (pool::add (test::run-sync)) (cdr tests'))))))
(define (run-tests-sequential-isolated setup teardown . tests)
(lettmp (gpghome-tar) (lettmp (gpghome-tar)
(setup::run-sync '--create-tarball gpghome-tar) (setup::run-sync '--create-tarball gpghome-tar)
(let loop ((pool (test-pool::new '())) (tests' tests)) (let loop ((pool (test-pool::new '())) (tests' tests))
@ -170,12 +150,8 @@
(loop (pool::add (test'::run-sync)) (cdr tests'))))))) (loop (pool::add (test'::run-sync)) (cdr tests')))))))
(let* ((runner (if (member "--parallel" *args*) (let* ((runner (if (member "--parallel" *args*)
(if (member "--shared" *args*) run-tests-parallel
run-tests-parallel-shared run-tests-sequential))
run-tests-parallel-isolated)
(if (member "--shared" *args*)
run-tests-sequential-shared
run-tests-sequential-isolated)))
(tests (filter (lambda (arg) (not (string-prefix? arg "--"))) *args*))) (tests (filter (lambda (arg) (not (string-prefix? arg "--"))) *args*)))
(apply runner (append (list (test::scm "setup.scm") (test::scm "finish.scm")) (apply runner (append (list (test::scm "setup.scm") (test::scm "finish.scm"))
(map test::scm tests)))) (map test::scm tests))))