From beb0fef1eef30923cb563c2a0efd38ce9847f53f Mon Sep 17 00:00:00 2001 From: Werner Koch Date: Fri, 9 Aug 2002 18:16:02 +0000 Subject: [PATCH] Tweaked the build system so that make distcheck finanly said Well Done. --- tests/ChangeLog | 9 +++++++++ tests/Makefile.am | 31 ++++++++++++------------------- tests/asschk.c | 22 +++++++++++++++++++--- tests/inittests | 23 +++++++++++++++-------- tests/runtest | 2 +- tests/samplekeys/distfiles | 4 ---- tests/sm-sign+verify | 3 ++- tests/sm-verify | 16 +++++++++------- 8 files changed, 67 insertions(+), 43 deletions(-) delete mode 100644 tests/samplekeys/distfiles diff --git a/tests/ChangeLog b/tests/ChangeLog index 1711e9529..627d02274 100644 --- a/tests/ChangeLog +++ b/tests/ChangeLog @@ -1,3 +1,12 @@ +2002-08-09 Werner Koch + + * asschk.c (cmd_getenv): New. + (expand_line): Allow / as variable name delimiter. + * sm-sign+verify, sm-verify: Use $srcdir so that a VPATH build works. + + * Makefile.am: Fixes for make dist. + * samplekets/Makefile.am: New. + 2002-08-08 Werner Koch * asschk.c: Added some new features. diff --git a/tests/Makefile.am b/tests/Makefile.am index ac0e6cb8c..442d86435 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -24,17 +24,23 @@ GPGSM = ../sm/gpgsm # We can't unset a variable here so we unset GPG_AGENT_INFO in runtest TESTS_ENVIRONMENT = GNUPGHOME=`pwd` LC_ALL=C GPGSM=$(GPGSM) $(srcdir)/runtest -EXTRA_DIST = runtest inittests \ +testscripts = sm-sign+verify sm-verify + +EXTRA_DIST = runtest inittests $(testscripts) \ 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 + text-2.osig.pem text-2.osig-bad.pem \ + samplekeys/32100C27173EF6E9C4E9A25D3D69F86D37A4F939.key \ + samplekeys/cert_g10code_pete1.pem \ + samplekeys/cert_g10code_test1.pem \ + samplekeys/cert_g10code_theo1.pem -TESTS = sm-sign+verify sm-verify +TESTS = $(testscripts) CLEANFILES = inittests.stamp x y y z out err *.lock .\#lk* -DISTCLEANFILES = keyring.kbx~ random_seed +DISTCLEANFILES = pubring.kbx~ random_seed noinst_PROGRAMS = asschk @@ -44,22 +50,9 @@ asschk_SOURCES = asschk.c all-local: inittests.stamp clean-local: - $(TESTS_ENVIRONMENT) $(srcdir)/inittests --clean + srcdir=$(srcdir) $(TESTS_ENVIRONMENT) $(srcdir)/inittests --clean inittests.stamp: inittests - $(TESTS_ENVIRONMENT) $(srcdir)/inittests + srcdir=$(srcdir) $(TESTS_ENVIRONMENT) $(srcdir)/inittests echo timestamp >./inittests.stamp -# Include all files listed in the samplekeys/distfiles -dist-hook: - @set -e; \ - dir=$(srcdir)/samplekeys ; \ - $(mkinstalldirs) $(distdir)/$$dir ; \ - for i in distfiles `cat $$dir/distfiles` ; do \ - ln $(srcdir)/$$dir/$$i $(distdir)/$$dir/$$i 2> /dev/null \ - || cp -p $(srcdir)/$$dir/$$i $(distdir)/$$dir/$$i; \ - done - - - - diff --git a/tests/asschk.c b/tests/asschk.c index 7b7321675..829c86273 100644 --- a/tests/asschk.c +++ b/tests/asschk.c @@ -30,8 +30,8 @@ a line is processed but after comment processing. Macros are only expanded once and non existing macros expand to the empty string. A macro is dereferenced by prefixing its name with a dollar sign; - the end of the name is currently indicated by a white space. To - use a dollor sign verbatim, double it. + the end of the name is currently indicated by a white space, a + dollar sign or a slash. To use a dollor sign verbatim, double it. A macro is assigned by prefixing a statement with the macro name and an equal sign. The value is assigned verbatim if it does not @@ -96,6 +96,9 @@ cmpfiles Returns true when the content of the files FIRST and SECOND match. + getenv + Return the value of the environment variable NAME. + */ #include @@ -571,7 +574,8 @@ expand_line (char *buffer) line = p + 1; continue; } - for (pend=p+1; *pend && !spacep (pend) && *pend != '$'; pend++) + for (pend=p+1; *pend && !spacep (pend) + && *pend != '$' && *pend != '/'; pend++) ; if (*pend) { @@ -854,6 +858,17 @@ cmd_cmpfiles (const char *assign_to, char *arg) fclose (fp2); } +static void +cmd_getenv (const char *assign_to, char *arg) +{ + const char *s; + s = *arg? getenv (arg):""; + set_var (assign_to, s? s:""); +} + + + + /* Process the current script line LINE. */ static int interpreter (char *line) @@ -875,6 +890,7 @@ interpreter (char *line) { "quit-if" , cmd_quit_if }, { "fail-if" , cmd_fail_if }, { "cmpfiles" , cmd_cmpfiles }, + { "getenv" , cmd_getenv }, { NULL } }; char *p, *save_p; diff --git a/tests/inittests b/tests/inittests index 1de903e57..b1860f5fd 100755 --- a/tests/inittests +++ b/tests/inittests @@ -11,7 +11,7 @@ set -e -sample_cert=' +sample_certs=' cert_g10code_test1.pem cert_g10code_pete1.pem cert_g10code_theo1.pem @@ -22,7 +22,7 @@ private_keys=' ' clean_files=' -gpgsm.conf gpg-agent.conf trustlist.txt keyring.kbx +gpgsm.conf gpg-agent.conf trustlist.txt pubring.kbx msg msg.sig msg.unsig ' @@ -34,8 +34,12 @@ if [ -d $srcdir/samplekeys ] \ && grep TESTS_ENVIRONMENT Makefile >/dev/null 2>&1; then : else - echo "inittests: please cd to the tests directory first" >&2 - exit 1 + # During make distclean the Makefile has already been removed, + # so we need this extra test. + if ! grep gnupg-test-directory testdir.stamp >/dev/null 2>&1; then + echo "inittests: please cd to the tests directory first" >&2 + exit 1 + fi fi if [ "$1" = "--clean" ]; then @@ -43,7 +47,7 @@ if [ "$1" = "--clean" ]; then rm private-keys-v1.d/* 2>/dev/null || true rmdir private-keys-v1.d fi - rm ${clean_files} 2>/dev/null || true + rm ${clean_files} testdir.stamp 2>/dev/null || true exit 0 fi @@ -57,13 +61,15 @@ if [ -n "$GPG_AGENT_INFO" ]; then exit 1 fi +# A stamp file used with --clean +echo gnupg-test-directory > testdir.stamp # Create the private key directy if it does not exists and copy # the sample keys. [ -d private-keys-v1.d ] || mkdir private-keys-v1.d for i in ${private_keys}; do - cp ${srcdir}/samplekeys/$i.key private-keys-v1.d/$i.key + cat ${srcdir}/samplekeys/$i.key >private-keys-v1.d/$i.key done # Create the configuration scripts @@ -83,7 +89,8 @@ cat > trustlist.txt <