4dd6d6fe17bc7156b4e93dd34777e93c74d44306
[platform/upstream/gpg2.git] / tests / openpgp / all-tests.scm
1 ;; Copyright (C) 2017 g10 Code GmbH
2 ;;
3 ;; This file is part of GnuPG.
4 ;;
5 ;; GnuPG is free software; you can redistribute it and/or modify
6 ;; it under the terms of the GNU General Public License as published by
7 ;; the Free Software Foundation; either version 3 of the License, or
8 ;; (at your option) any later version.
9 ;;
10 ;; GnuPG is distributed in the hope that it will be useful,
11 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
12 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13 ;; GNU General Public License for more details.
14 ;;
15 ;; You should have received a copy of the GNU General Public License
16 ;; along with this program; if not, see <http://www.gnu.org/licenses/>.
17
18 (export all-tests
19  ;; Parse the Makefile.am to find all tests.
20
21  (load (with-path "makefile.scm"))
22
23  (define (expander filename port key)
24    (parse-makefile port key))
25
26  (define (parse filename key)
27    (parse-makefile-expand filename expander key))
28
29  (define setup
30    (make-environment-cache
31     (test::scm
32      #f
33      (path-join "tests" "openpgp" "setup.scm")
34      (in-srcdir "tests" "openpgp" "setup.scm"))))
35
36  (define (qualify path variant)
37    (string-append "<" variant ">" path))
38
39  (define (setup* variant)
40    (make-environment-cache
41     (test::scm
42      #f
43      (qualify (path-join "tests" "openpgp" "setup.scm") variant)
44      (in-srcdir "tests" "openpgp" "setup.scm")
45      (string-append "--" variant))))
46
47  (define setup-use-keyring (setup* "use-keyring"))
48  (define setup-extended-key-format (setup* "extended-key-format"))
49
50  (define all-tests
51    (parse-makefile-expand (in-srcdir "tests" "openpgp" "Makefile.am")
52                           (lambda (filename port key) (parse-makefile port key))
53                           "XTESTS"))
54  (append
55   (map (lambda (name)
56          (test::scm setup
57                     (path-join "tests" "openpgp" name)
58                     (in-srcdir "tests" "openpgp" name))) all-tests)
59   (map (lambda (name)
60          (test::scm setup-use-keyring
61                     (qualify (path-join "tests" "openpgp" name) "use-keyring")
62                     (in-srcdir "tests" "openpgp" name)
63                     "--use-keyring")) all-tests)
64   (map (lambda (name)
65          (test::scm setup-extended-key-format
66                     (qualify (path-join "tests" "openpgp" name) "extended-key-format")
67                     (in-srcdir "tests" "openpgp" name)
68                     "--extended-key-format")) all-tests)))