Tweaked the build system so that make distcheck finanly said Well

Done.
This commit is contained in:
Werner Koch 2002-08-09 18:16:02 +00:00
parent 5b0ccaf949
commit beb0fef1ee
8 changed files with 67 additions and 43 deletions

View File

@ -1,3 +1,12 @@
2002-08-09 Werner Koch <wk@gnupg.org>
* 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 <wk@gnupg.org> 2002-08-08 Werner Koch <wk@gnupg.org>
* asschk.c: Added some new features. * asschk.c: Added some new features.

View File

@ -24,17 +24,23 @@ GPGSM = ../sm/gpgsm
# We can't unset a variable here so we unset GPG_AGENT_INFO in runtest # 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 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.txt text-2.txt text-3.txt \
text-1.osig.pem text-1.dsig.pem text-1.osig-bad.pem \ 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 CLEANFILES = inittests.stamp x y y z out err
*.lock .\#lk* *.lock .\#lk*
DISTCLEANFILES = keyring.kbx~ random_seed DISTCLEANFILES = pubring.kbx~ random_seed
noinst_PROGRAMS = asschk noinst_PROGRAMS = asschk
@ -44,22 +50,9 @@ asschk_SOURCES = asschk.c
all-local: inittests.stamp all-local: inittests.stamp
clean-local: clean-local:
$(TESTS_ENVIRONMENT) $(srcdir)/inittests --clean srcdir=$(srcdir) $(TESTS_ENVIRONMENT) $(srcdir)/inittests --clean
inittests.stamp: inittests inittests.stamp: inittests
$(TESTS_ENVIRONMENT) $(srcdir)/inittests srcdir=$(srcdir) $(TESTS_ENVIRONMENT) $(srcdir)/inittests
echo timestamp >./inittests.stamp 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

View File

@ -30,8 +30,8 @@
a line is processed but after comment processing. Macros are only a line is processed but after comment processing. Macros are only
expanded once and non existing macros expand to the empty string. expanded once and non existing macros expand to the empty string.
A macro is dereferenced by prefixing its name with a dollar sign; 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 the end of the name is currently indicated by a white space, a
use a dollor sign verbatim, double it. 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 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 and an equal sign. The value is assigned verbatim if it does not
@ -96,6 +96,9 @@
cmpfiles <first> <second> cmpfiles <first> <second>
Returns true when the content of the files FIRST and SECOND match. Returns true when the content of the files FIRST and SECOND match.
getenv <name>
Return the value of the environment variable NAME.
*/ */
#include <stdio.h> #include <stdio.h>
@ -571,7 +574,8 @@ expand_line (char *buffer)
line = p + 1; line = p + 1;
continue; continue;
} }
for (pend=p+1; *pend && !spacep (pend) && *pend != '$'; pend++) for (pend=p+1; *pend && !spacep (pend)
&& *pend != '$' && *pend != '/'; pend++)
; ;
if (*pend) if (*pend)
{ {
@ -854,6 +858,17 @@ cmd_cmpfiles (const char *assign_to, char *arg)
fclose (fp2); 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. */ /* Process the current script line LINE. */
static int static int
interpreter (char *line) interpreter (char *line)
@ -875,6 +890,7 @@ interpreter (char *line)
{ "quit-if" , cmd_quit_if }, { "quit-if" , cmd_quit_if },
{ "fail-if" , cmd_fail_if }, { "fail-if" , cmd_fail_if },
{ "cmpfiles" , cmd_cmpfiles }, { "cmpfiles" , cmd_cmpfiles },
{ "getenv" , cmd_getenv },
{ NULL } { NULL }
}; };
char *p, *save_p; char *p, *save_p;

View File

@ -11,7 +11,7 @@
set -e set -e
sample_cert=' sample_certs='
cert_g10code_test1.pem cert_g10code_test1.pem
cert_g10code_pete1.pem cert_g10code_pete1.pem
cert_g10code_theo1.pem cert_g10code_theo1.pem
@ -22,7 +22,7 @@ private_keys='
' '
clean_files=' 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 msg msg.sig msg.unsig
' '
@ -34,8 +34,12 @@ if [ -d $srcdir/samplekeys ] \
&& grep TESTS_ENVIRONMENT Makefile >/dev/null 2>&1; then && grep TESTS_ENVIRONMENT Makefile >/dev/null 2>&1; then
: :
else else
echo "inittests: please cd to the tests directory first" >&2 # During make distclean the Makefile has already been removed,
exit 1 # 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 fi
if [ "$1" = "--clean" ]; then if [ "$1" = "--clean" ]; then
@ -43,7 +47,7 @@ if [ "$1" = "--clean" ]; then
rm private-keys-v1.d/* 2>/dev/null || true rm private-keys-v1.d/* 2>/dev/null || true
rmdir private-keys-v1.d rmdir private-keys-v1.d
fi fi
rm ${clean_files} 2>/dev/null || true rm ${clean_files} testdir.stamp 2>/dev/null || true
exit 0 exit 0
fi fi
@ -57,13 +61,15 @@ if [ -n "$GPG_AGENT_INFO" ]; then
exit 1 exit 1
fi 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 # Create the private key directy if it does not exists and copy
# the sample keys. # the sample keys.
[ -d private-keys-v1.d ] || mkdir private-keys-v1.d [ -d private-keys-v1.d ] || mkdir private-keys-v1.d
for i in ${private_keys}; do 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 done
# Create the configuration scripts # Create the configuration scripts
@ -83,7 +89,8 @@ cat > trustlist.txt <<EOF
3CF405464F66ED4A7DF45BBDD1E4282E33BDB76E S 3CF405464F66ED4A7DF45BBDD1E4282E33BDB76E S
EOF EOF
# Make sure that the sample certs are available # Make sure that the sample certs are available but ignore errors here
# because we are not a test script.
for i in ${sample_certs}; do for i in ${sample_certs}; do
$GPGSM --import ${srcdir}/samplekeys/$i.pem $GPGSM --import ${srcdir}/samplekeys/$i || true
done done

View File

@ -1,5 +1,5 @@
#!/bin/sh #!/bin/sh
unset GPG_AGENT_INFO unset GPG_AGENT_INFO
[ -x "$1" ] && exec "$1" [ -x "$1" ] && exec $1 $2
exec ./asschk --no-echo -DGPGSM=${GPGSM} <"$1" exec ./asschk --no-echo -DGPGSM=${GPGSM} <"$1"

View File

@ -1,4 +0,0 @@
32100C27173EF6E9C4E9A25D3D69F86D37A4F939.key
cert_g10code_pete1.pem
cert_g10code_test1.pem
cert_g10code_theo1.pem

View File

@ -3,7 +3,8 @@
# Creating a signature and verifying it # Creating a signature and verifying it
# Requirements: a plain file "text-1.txt" # Requirements: a plain file "text-1.txt"
plaintext = text-1.txt srcdir = getenv srcdir
plaintext = let $srcdir/text-1.txt
in = openfile $plaintext in = openfile $plaintext
out = createfile msg.sig out = createfile msg.sig

View File

@ -4,8 +4,10 @@
# Requirements: # Requirements:
# #
srcdir = getenv srcdir
# Check an opaque signature # Check an opaque signature
sig = openfile text-1.osig.pem sig = openfile $srcdir/text-1.osig.pem
out = createfile msg.unsig out = createfile msg.unsig
pipeserver $GPGSM pipeserver $GPGSM
send INPUT FD=$sig send INPUT FD=$sig
@ -26,12 +28,12 @@ expect-ok
sig = sig =
out = out =
cmpfiles text-1.txt msg.unsig cmpfiles $srcdir/text-1.txt msg.unsig
fail-if !$? fail-if !$?
# Check a detached signature. # Check a detached signature.
sig = openfile text-1.dsig.pem sig = openfile $srcdir/text-1.dsig.pem
plain = openfile text-1.txt plain = openfile $srcdir/text-1.txt
pipeserver $GPGSM pipeserver $GPGSM
send INPUT FD=$sig send INPUT FD=$sig
expect-ok expect-ok
@ -50,7 +52,7 @@ send BYE
expect-ok expect-ok
# Check a tampered opaque message # Check a tampered opaque message
sig = openfile text-1.osig-bad.pem sig = openfile $srcdir/text-1.osig-bad.pem
out = createfile msg.unsig out = createfile msg.unsig
pipeserver $GPGSM pipeserver $GPGSM
@ -71,7 +73,7 @@ send BYE
expect-ok expect-ok
# Check another opaque signature but without asking for the output. # Check another opaque signature but without asking for the output.
sig = openfile text-2.osig.pem sig = openfile $srcdir/text-2.osig.pem
pipeserver $GPGSM pipeserver $GPGSM
send INPUT FD=$sig send INPUT FD=$sig
@ -89,7 +91,7 @@ send BYE
expect-ok expect-ok
# We als have tampered version. # We als have tampered version.
sig = openfile text-2.osig-bad.pem sig = openfile $srcdir/text-2.osig-bad.pem
pipeserver $GPGSM pipeserver $GPGSM
send INPUT FD=$sig send INPUT FD=$sig