aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--tests/Makefile.am28
-rw-r--r--tests/t-decrypt.c19
2 files changed, 45 insertions, 2 deletions
diff --git a/tests/Makefile.am b/tests/Makefile.am
index 7b599581..5e03d459 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -1,8 +1,10 @@
## Process this file with automake to create Makefile.in
+TESTS_ENVIRONMENT = GNUPGHOME=.
+
TESTS = t-encrypt t-sign t-decrypt t-verify t-keylist
-EXTRA_DIST = cipher-1.asc geheim.txt
+EXTRA_DIST = mkdemodirs pubdemo.asc secdemo.asc cipher-1.asc geheim.txt
INCLUDES = -I$(top_srcdir)/include -I$(top_srcdir)/intl
@@ -11,4 +13,28 @@ LDADD = ../gpgme/libgpgme.la
noinst_PROGRAMS = $(TESTS)
+distclean-local:
+ $(srcdir)/mkdemodirs --clean
+
+all-local: ./pubring.gpg ./secring.gpg
+
+./pubring.gpg: $(srcdir)/pubdemo.asc
+ -gpg --homedir . --import $(srcdir)/pubdemo.asc
+
+./secring.gpg: ./Alpha/Secret.gpg
+ -gpg --homedir . --import Alpha/Secret.gpg Zulu/Secret.gpg
+
+./Alpha/Secret.gpg: secdemo.asc
+ srcdir=$(srcdir) $(srcdir)/mkdemodirs
+
+
+
+
+
+
+
+
+
+
+
diff --git a/tests/t-decrypt.c b/tests/t-decrypt.c
index 0b066f5e..bf96112d 100644
--- a/tests/t-decrypt.c
+++ b/tests/t-decrypt.c
@@ -51,6 +51,22 @@ print_data ( GpgmeData dh )
}
+static char *
+mk_fname ( const char *fname )
+{
+ const char *srcdir = getenv ("srcdir");
+ char *buf;
+
+ if (!srcdir)
+ srcdir = ".";
+ buf = malloc (strlen(srcdir) + strlen(fname) + 2 );
+ if (!buf )
+ exit (8);
+ strcpy (buf, srcdir);
+ strcat (buf, "/");
+ strcat (buf, fname );
+ return buf;
+}
int
main (int argc, char **argv )
@@ -58,12 +74,13 @@ main (int argc, char **argv )
GpgmeCtx ctx;
GpgmeError err;
GpgmeData in, out;
+ const char *cipher_1_asc = mk_fname ("cipher-1.asc");
do {
err = gpgme_new (&ctx);
fail_if_err (err);
- err = gpgme_data_new_from_file ( &in, "cipher-1.asc", 1 );
+ err = gpgme_data_new_from_file ( &in, cipher_1_asc, 1 );
fail_if_err (err);
err = gpgme_data_new ( &out );