tests: Rename subdir gpgsm to cms and move sample dirs.

--

It does not make sense to have the cms stuff at the top level but the
openpgp at a dedicated directory.  This patch fixes that.
This commit is contained in:
Werner Koch 2021-05-31 15:29:18 +02:00
parent 31c0aa2ff3
commit a8209b001c
No known key found for this signature in database
GPG Key ID: E3FDFF218E45B72B
70 changed files with 70 additions and 73 deletions

View File

@ -2144,9 +2144,9 @@ doc/Makefile
tests/Makefile
tests/gpgscm/Makefile
tests/openpgp/Makefile
tests/tpm2dtests/Makefile
tests/cms/Makefile
tests/migrations/Makefile
tests/gpgsm/Makefile
tests/tpm2dtests/Makefile
tests/gpgme/Makefile
tests/pkits/Makefile
g10/gpg.w32-manifest

View File

@ -24,60 +24,23 @@ else
tpm2dtests =
endif
SUBDIRS = gpgscm openpgp migrations gpgsm gpgme pkits $(tpm2dtests) .
SUBDIRS = gpgscm openpgp cms migrations gpgme pkits $(tpm2dtests) .
GPGSM = ../sm/gpgsm
# Note that we need to use /bin/pwd so that we don't get into trouble
# if the shell used for inittests would uses an internal version of
# pwd which handles symlinks differently.
TESTS_ENVIRONMENT = GNUPGHOME=`/bin/pwd` GPG_AGENT_INFO= LC_ALL=C \
GPGSM="$(GPGSM)" "$(srcdir)/runtest"
testscripts = sm-sign+verify sm-verify
EXTRA_DIST = runtest inittests $(testscripts) ChangeLog-2011 \
text-1.txt text-2.txt text-3.txt \
text-1.osig.pem text-1.dsig.pem text-1.osig-bad.pem \
text-2.osig.pem text-2.osig-bad.pem \
EXTRA_DIST = run-tests.scm \
fake-pinentries/README.txt \
fake-pinentries/fake-pinentry.php \
fake-pinentries/fake-pinentry.pl \
fake-pinentries/fake-pinentry.py \
fake-pinentries/fake-pinentry.sh \
samplekeys/steed-self-signing-nonthority.pem \
samplekeys/68A638998DFABAC510EA645CE34F9686B2EDF7EA.key \
samplekeys/32100C27173EF6E9C4E9A25D3D69F86D37A4F939.key \
samplekeys/cert_g10code_pete1.pem \
samplekeys/cert_g10code_test1.pem \
samplekeys/cert_g10code_theo1.pem \
run-tests.scm
ChangeLog-2011
# We used to run $(testscripts) here but these asschk scripts are not
# completely reliable in all environments and thus we better disable
# them. The tests are anyway way too minimal. We will eventually
# write new tests based on gpg-connect-agent which has a full fledged
# script language and thus makes it far easier to write tests than to
# use that low-level asschk stuff.
TESTS =
CLEANFILES = inittests.stamp x y y z out err \
*.lock .\#lk*
DISTCLEANFILES = pubring.kbx~ random_seed
CLEANFILES = x y z out err
if !HAVE_W32_SYSTEM
noinst_PROGRAMS = asschk
endif
asschk_SOURCES = asschk.c
all-local: inittests.stamp
clean-local:
srcdir=$(srcdir) $(TESTS_ENVIRONMENT) $(srcdir)/inittests --clean
inittests.stamp: inittests
srcdir=$(srcdir) $(TESTS_ENVIRONMENT) $(srcdir)/inittests
echo timestamp >./inittests.stamp

View File

@ -28,6 +28,12 @@ include $(top_srcdir)/am/cmacros.am
AM_CFLAGS =
# Note that we need to use /bin/pwd so that we don't get into trouble
# if the shell used for inittests would uses an internal version of
# pwd which handles symlinks differently.
OLD_TESTS_ENVIRONMENT = GNUPGHOME=`/bin/pwd` GPG_AGENT_INFO= LC_ALL=C \
GPGSM="$(GPGSM)" "$(srcdir)/runtest"
TESTS_ENVIRONMENT = LC_ALL=C \
EXEEXT=$(EXEEXT) \
PATH="../gpgscm:$(PATH)" \
@ -65,11 +71,38 @@ TEST_FILES = plain-1.cms.asc \
plain-3.cms.asc \
plain-large.cms.asc
EXTRA_DIST = $(XTESTS) $(KEYS) $(CERTS) $(TEST_FILES) \
gpgsm-defs.scm run-tests.scm setup.scm all-tests.scm
# We used to run $(testscripts) here but these asschk scripts are not
# completely reliable in all environments and thus we better disable
# them. The tests are anyway way too minimal. We will eventually
# write new tests based on gpg-connect-agent which has a full fledged
# script language and thus makes it far easier to write tests than to
# use that low-level asschk stuff.
testscripts = sm-sign+verify sm-verify
CLEANFILES = *.log report.xml
EXTRA_DIST = $(XTESTS) $(KEYS) $(CERTS) $(TEST_FILES) \
samplekeys/steed-self-signing-nonthority.pem \
samplekeys/68A638998DFABAC510EA645CE34F9686B2EDF7EA.key \
samplekeys/32100C27173EF6E9C4E9A25D3D69F86D37A4F939.key \
samplekeys/cert_g10code_pete1.pem \
samplekeys/cert_g10code_test1.pem \
samplekeys/cert_g10code_theo1.pem \
text-1.txt text-2.txt text-3.txt \
text-1.osig.pem text-1.dsig.pem text-1.osig-bad.pem \
text-2.osig.pem text-2.osig-bad.pem \
runtest inittests $(testscripts) \
gpgsm-defs.scm run-tests.scm setup.scm all-tests.scm
CLEANFILES = inittests.stamp *.lock *.log report.xml .\#lk*
DISTCLEANFILES = pubring.kbx~ random_seed
# We need to depend on a couple of programs so that the tests don't
# start before all programs are built.
all-local: $(required_pgms)
all-local: $(required_pgms) inittests.stamp
clean-local:
srcdir=$(srcdir) $(OLD_TESTS_ENVIRONMENT) $(srcdir)/inittests --clean
inittests.stamp: inittests
srcdir=$(srcdir) $(OLD_TESTS_ENVIRONMENT) $(srcdir)/inittests
echo timestamp >./inittests.stamp

View File

@ -30,14 +30,14 @@
(make-environment-cache
(test::scm
#f
(path-join "tests" "gpgsm" "setup.scm")
(in-srcdir "tests" "gpgsm" "setup.scm")
(path-join "tests" "cms" "setup.scm")
(in-srcdir "tests" "cms" "setup.scm")
"--" "tests" "gpg")))
(map (lambda (name)
(test::scm setup
(path-join "tests" "gpgsm" name)
(in-srcdir "tests" "gpgsm" name)))
(parse-makefile-expand (in-srcdir "tests" "gpgsm" "Makefile.am")
(path-join "tests" "cms" name)
(in-srcdir "tests" "cms" name)))
(parse-makefile-expand (in-srcdir "tests" "cms" "Makefile.am")
(lambda (filename port key) (parse-makefile port key))
"XTESTS")))

View File

@ -17,14 +17,14 @@
;; You should have received a copy of the GNU General Public License
;; along with this program; if not, see <http://www.gnu.org/licenses/>.
(load (in-srcdir "tests" "gpgsm" "gpgsm-defs.scm"))
(load (in-srcdir "tests" "cms" "gpgsm-defs.scm"))
(setup-gpgsm-environment)
(for-each-p
"Checking decryption of supplied files."
(lambda (name)
(tr:do
(tr:open (in-srcdir "tests" "gpgsm" (string-append name ".cms.asc")))
(tr:open (in-srcdir "tests" "cms" (string-append name ".cms.asc")))
(tr:gpgsm "" '(--decrypt))
(tr:assert-identity name)))
plain-files)

View File

@ -17,7 +17,7 @@
;; You should have received a copy of the GNU General Public License
;; along with this program; if not, see <http://www.gnu.org/licenses/>.
(load (in-srcdir "tests" "gpgsm" "gpgsm-defs.scm"))
(load (in-srcdir "tests" "cms" "gpgsm-defs.scm"))
(setup-gpgsm-environment)
(for-each-p

View File

@ -17,7 +17,7 @@
;; You should have received a copy of the GNU General Public License
;; along with this program; if not, see <http://www.gnu.org/licenses/>.
(load (in-srcdir "tests" "gpgsm" "gpgsm-defs.scm"))
(load (in-srcdir "tests" "cms" "gpgsm-defs.scm"))
(setup-gpgsm-environment)
(for-each-p'

View File

@ -78,13 +78,14 @@
(log "Storing private keys")
(for-each
(lambda (name)
(file-copy (in-srcdir "tests" "gpgsm" name)
(file-copy (in-srcdir "tests" "cms" name)
(path-join "private-keys-v1.d"
(string-append name ".key"))))
'("32100C27173EF6E9C4E9A25D3D69F86D37A4F939"))
(log "Importing public demo and test keys")
(call-check `(,@gpgsm --import ,(in-srcdir "tests" "gpgsm" "cert_g10code_test1.der")))
(call-check `(,@gpgsm --import ,(in-srcdir "tests" "cms"
"cert_g10code_test1.der")))
(create-sample-files)
(stop-agent))

View File

@ -17,7 +17,7 @@
;; You should have received a copy of the GNU General Public License
;; along with this program; if not, see <http://www.gnu.org/licenses/>.
(load (in-srcdir "tests" "gpgsm" "gpgsm-defs.scm"))
(load (in-srcdir "tests" "cms" "gpgsm-defs.scm"))
(setup-gpgsm-environment)
(define certs-for-import
@ -47,7 +47,7 @@
"Checking certificate import."
(lambda (test)
(assert (not (sm-have-public-key? (:cert test))))
(call-check `(,@gpgsm --import ,(in-srcdir "tests" "gpgsm" (:name test))))
(call-check `(,@gpgsm --import ,(in-srcdir "tests" "cms" (:name test))))
(assert (sm-have-public-key? (:cert test))))
(lambda (test) (:name test))
certs-for-import)

View File

@ -28,10 +28,10 @@ msg msg.sig msg.unsig
[ -z "$srcdir" ] && srcdir=.
[ -z "$GPGSM" ] && GPGSM=../sm/gpgsm
[ -z "$GPGSM" ] && GPGSM=../../sm/gpgsm
if [ -d $srcdir/samplekeys ] \
&& grep TESTS_ENVIRONMENT Makefile >/dev/null 2>&1; then
&& grep OLD_TESTS_ENVIRONMENT Makefile >/dev/null 2>&1; then
:
else
# During make distclean the Makefile has already been removed,

View File

@ -20,7 +20,7 @@
(if (string=? "" (getenv "abs_top_srcdir"))
(begin
(echo "Environment variable 'abs_top_srcdir' not set. Please point it to"
"tests/gpgsm.")
"tests/cms.")
(exit 2)))
(define tests (filter (lambda (arg) (not (string-prefix? arg "--"))) *args*))
@ -28,12 +28,12 @@
(define setup
(make-environment-cache (test::scm
#f
(path-join "tests" "gpgsm" "setup.scm")
(in-srcdir "tests" "gpgsm" "setup.scm"))))
(path-join "tests" "cms" "setup.scm")
(in-srcdir "tests" "cms" "setup.scm"))))
(run-tests (if (null? tests)
(load-tests "tests" "gpgsm")
(load-tests "tests" "cms")
(map (lambda (name)
(test::scm setup
(path-join "tests" "gpgsm" name)
(in-srcdir "tests" "gpgsm" name))) tests)))
(path-join "tests" "cms" name)
(in-srcdir "tests" "cms" name))) tests)))

View File

@ -17,7 +17,7 @@
;; You should have received a copy of the GNU General Public License
;; along with this program; if not, see <http://www.gnu.org/licenses/>.
(load (in-srcdir "tests" "gpgsm" "gpgsm-defs.scm"))
(load (in-srcdir "tests" "cms" "gpgsm-defs.scm"))
(define tarball (flag "--create-tarball" *args*))
(unless (and tarball (not (null? tarball)))

View File

@ -17,7 +17,7 @@
;; You should have received a copy of the GNU General Public License
;; along with this program; if not, see <http://www.gnu.org/licenses/>.
(load (in-srcdir "tests" "gpgsm" "gpgsm-defs.scm"))
(load (in-srcdir "tests" "cms" "gpgsm-defs.scm"))
(setup-gpgsm-environment)
;; This is not a test, but can be used to inspect the test

View File

@ -17,7 +17,7 @@
;; You should have received a copy of the GNU General Public License
;; along with this program; if not, see <http://www.gnu.org/licenses/>.
(load (in-srcdir "tests" "gpgsm" "gpgsm-defs.scm"))
(load (in-srcdir "tests" "cms" "gpgsm-defs.scm"))
(setup-gpgsm-environment)
(for-each-p

View File

@ -17,7 +17,7 @@
;; You should have received a copy of the GNU General Public License
;; along with this program; if not, see <http://www.gnu.org/licenses/>.
(load (in-srcdir "tests" "gpgsm" "gpgsm-defs.scm"))
(load (in-srcdir "tests" "cms" "gpgsm-defs.scm"))
(setup-gpgsm-environment)
;;

View File

@ -34,8 +34,8 @@
(load-tests-with-log "g13")
(load-tests-with-log "agent")
(load-tests-with-log "tests" "openpgp")
(load-tests-with-log "tests" "cms")
(load-tests-with-log "tests" "migrations")
(load-tests-with-log "tests" "gpgsm")
(load-tests-with-log "tests" "gpgme"))))
(run-tests (if prefix
(filter