diff --git a/common/Makefile.am b/common/Makefile.am
index bd281d603..1cc89a08f 100644
--- a/common/Makefile.am
+++ b/common/Makefile.am
@@ -1,235 +1,234 @@
# Makefile for common gnupg modules
# Copyright (C) 2001, 2003, 2007, 2010 Free Software Foundation, Inc.
#
# This file is part of GnuPG.
#
# GnuPG is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 3 of the License, or
# (at your option) any later version.
#
# GnuPG is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, see .
## Process this file with automake to produce Makefile.in
EXTRA_DIST = mkstrtable.awk exaudit.awk exstatus.awk ChangeLog-2011 \
audit-events.h status-codes.h ChangeLog.jnlib \
ChangeLog-2011.include w32info-rc.h.in gnupg.ico \
all-tests.scm
noinst_LIBRARIES = libcommon.a libcommonpth.a libgpgrl.a
if !HAVE_W32CE_SYSTEM
noinst_LIBRARIES += libsimple-pwquery.a
endif
noinst_PROGRAMS = $(module_tests) $(module_maint_tests)
if DISABLE_TESTS
TESTS =
else
TESTS = $(module_tests)
endif
BUILT_SOURCES = audit-events.h status-codes.h
MAINTAINERCLEANFILES = audit-events.h status-codes.h
AM_CPPFLAGS =
AM_CFLAGS = $(LIBGCRYPT_CFLAGS) $(LIBASSUAN_CFLAGS) $(KSBA_CFLAGS)
include $(top_srcdir)/am/cmacros.am
common_sources = \
common-defs.h \
util.h utilproto.h fwddecl.h i18n.c i18n.h \
types.h host2net.h dynload.h w32help.h \
mapstrings.c stringhelp.c stringhelp.h \
strlist.c strlist.h \
utf8conv.c utf8conv.h \
argparse.c argparse.h \
logging.c logging.h \
dotlock.c dotlock.h \
mischelp.c mischelp.h \
status.c status.h\
shareddefs.h \
openpgpdefs.h \
gc-opt-flags.h \
sexp-parse.h \
tlv.c tlv.h tlv-builder.c \
init.c init.h \
sexputil.c \
sysutils.c sysutils.h \
homedir.c \
gettime.c gettime.h \
yesno.c \
b64enc.c b64dec.c zb32.c zb32.h \
convert.c \
percent.c \
mbox-util.c mbox-util.h \
miscellaneous.c \
xasprintf.c \
xreadline.c \
membuf.c membuf.h \
ccparray.c ccparray.h \
iobuf.c iobuf.h \
ttyio.c ttyio.h \
asshelp.c asshelp2.c asshelp.h \
exechelp.h \
signal.c \
audit.c audit.h \
localename.c \
session-env.c session-env.h \
userids.c userids.h \
openpgp-oid.c \
ssh-utils.c ssh-utils.h \
agent-opt.c \
helpfile.c \
mkdir_p.c mkdir_p.h \
strlist.c strlist.h \
exectool.c exectool.h \
server-help.c server-help.h \
name-value.c name-value.h \
recsel.c recsel.h \
ksba-io-support.c ksba-io-support.h \
openpgp-fpr.c \
compliance.c compliance.h
if HAVE_W32_SYSTEM
common_sources += w32-reg.c w32-cmdline.c
endif
# To make the code easier to read we have split home some code into
# separate source files.
if HAVE_W32_SYSTEM
if HAVE_W32CE_SYSTEM
common_sources += exechelp-w32ce.c
else
common_sources += exechelp-w32.c
endif
else
common_sources += exechelp-posix.c
endif
# Sources only useful without NPTH.
without_npth_sources = \
get-passphrase.c get-passphrase.h
# Sources only useful with NPTH.
with_npth_sources = \
call-gpg.c call-gpg.h
libcommon_a_SOURCES = $(common_sources) $(without_npth_sources)
libcommon_a_CFLAGS = $(AM_CFLAGS) $(LIBASSUAN_CFLAGS) -DWITHOUT_NPTH=1
libcommonpth_a_SOURCES = $(common_sources) $(with_npth_sources)
libcommonpth_a_CFLAGS = $(AM_CFLAGS) $(LIBASSUAN_CFLAGS) $(NPTH_CFLAGS)
if !HAVE_W32CE_SYSTEM
libsimple_pwquery_a_SOURCES = \
simple-pwquery.c simple-pwquery.h asshelp.c asshelp.h
libsimple_pwquery_a_CFLAGS = $(AM_CFLAGS) $(LIBASSUAN_CFLAGS)
endif
libgpgrl_a_SOURCES = \
gpgrlhelp.c
if MAINTAINER_MODE
# Note: Due to the dependency on Makefile, the file will always be
# rebuilt, so we allow this only in maintainer mode.
# Create the audit-events.h include file from audit.h
# Note: We create the target file in the source directory because it
# is a distributed built source. If we would not do that we may end
# up with two files and then it is not clear which version of the
# files will be picked up.
audit-events.h: Makefile.am mkstrtable.awk exaudit.awk audit.h
$(AWK) -f $(srcdir)/exaudit.awk $(srcdir)/audit.h \
| $(AWK) -f $(srcdir)/mkstrtable.awk -v textidx=3 -v nogettext=1 \
-v pkg_namespace=eventstr_ > $(srcdir)/audit-events.h
# Create the status-codes.h include file from status.h
status-codes.h: Makefile.am mkstrtable.awk exstatus.awk status.h
$(AWK) -f $(srcdir)/exstatus.awk $(srcdir)/status.h \
| $(AWK) -f $(srcdir)/mkstrtable.awk -v textidx=3 -v nogettext=1 \
-v pkg_namespace=statusstr_ > $(srcdir)/status-codes.h
endif
#
# Module tests
#
module_tests = t-stringhelp t-timestuff \
t-convert t-percent t-gettime t-sysutils t-sexputil \
t-session-env t-openpgp-oid t-ssh-utils \
t-mapstrings t-zb32 t-mbox-util t-iobuf t-strlist \
t-name-value t-ccparray t-recsel t-w32-cmdline
-if !HAVE_W32CE_SYSTEM
-module_tests += t-exechelp t-exectool
-endif
if HAVE_W32_SYSTEM
module_tests += t-w32-reg
+else
+module_tests += t-exechelp t-exectool
endif
if MAINTAINER_MODE
module_maint_tests = t-helpfile t-b64
else
module_maint_tests =
endif
t_extra_src = t-support.h
t_common_cflags = $(KSBA_CFLAGS) $(LIBGCRYPT_CFLAGS) \
$(LIBASSUAN_CFLAGS) $(GPG_ERROR_CFLAGS) $(INCICONV)
t_common_ldadd = libcommon.a \
$(LIBGCRYPT_LIBS) $(LIBASSUAN_LIBS) $(GPG_ERROR_LIBS) \
$(LIBINTL) $(LIBICONV) $(NETLIBS)
# Common tests
t_stringhelp_SOURCES = t-stringhelp.c $(t_extra_src)
t_stringhelp_LDADD = $(t_common_ldadd)
t_timestuff_SOURCES = t-timestuff.c $(t_extra_src)
t_timestuff_LDADD = $(t_common_ldadd)
t_convert_LDADD = $(t_common_ldadd)
t_percent_LDADD = $(t_common_ldadd)
t_gettime_LDADD = $(t_common_ldadd)
t_sysutils_LDADD = $(t_common_ldadd)
t_helpfile_LDADD = $(t_common_ldadd)
t_sexputil_LDADD = $(t_common_ldadd)
t_b64_LDADD = $(t_common_ldadd)
t_exechelp_LDADD = $(t_common_ldadd)
t_exectool_LDADD = $(t_common_ldadd)
t_session_env_LDADD = $(t_common_ldadd)
t_openpgp_oid_LDADD = $(t_common_ldadd)
t_ssh_utils_LDADD = $(t_common_ldadd)
t_mapstrings_LDADD = $(t_common_ldadd)
t_zb32_SOURCES = t-zb32.c $(t_extra_src)
t_zb32_LDADD = $(t_common_ldadd)
t_mbox_util_LDADD = $(t_common_ldadd)
t_iobuf_LDADD = $(t_common_ldadd)
t_strlist_LDADD = $(t_common_ldadd)
t_name_value_LDADD = $(t_common_ldadd)
t_ccparray_LDADD = $(t_common_ldadd)
t_recsel_LDADD = $(t_common_ldadd)
t_w32_cmdline_SOURCES = t-w32-cmdline.c w32-cmdline.c $(t_extra_src)
t_w32_cmdline_LDADD = $(t_common_ldadd)
# System specific test
if HAVE_W32_SYSTEM
t_w32_reg_SOURCES = t-w32-reg.c $(t_extra_src)
t_w32_reg_LDADD = $(t_common_ldadd)
endif
# All programs should depend on the created libs.
$(PROGRAMS) : libcommon.a libcommonpth.a
diff --git a/common/t-stringhelp.c b/common/t-stringhelp.c
index d76991f91..7d25cbd18 100644
--- a/common/t-stringhelp.c
+++ b/common/t-stringhelp.c
@@ -1,1319 +1,1327 @@
/* t-stringhelp.c - Regression tests for stringhelp.c
* Copyright (C) 2007 Free Software Foundation, Inc.
* 2015, 2021 g10 Code GmbH
*
* This file is part of GnuPG.
*
* GnuPG is free software; you can redistribute and/or modify this
* part of GnuPG under the terms of either
*
* - the GNU Lesser General Public License as published by the Free
* Software Foundation; either version 3 of the License, or (at
* your option) any later version.
*
* or
*
* - the GNU General Public License as published by the Free
* Software Foundation; either version 2 of the License, or (at
* your option) any later version.
*
* or both in parallel, as here.
*
* GnuPG is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copies of the GNU General Public License
* and the GNU Lesser General Public License along with this program;
* if not, see .
* SPDX-License-Identifier: (LGPL-3.0-or-later OR GPL-2.0-or-later)
*/
#include
#include
#include
#include
#include
#ifdef HAVE_PWD_H
# include
#endif
#include
#include
#include
#include
#include "t-support.h"
#include "sysutils.h"
#include "stringhelp.h"
static char *home_buffer;
const char *
gethome (void)
{
if (!home_buffer)
{
char *home = getenv("HOME");
if(home)
home_buffer = xstrdup (home);
#if defined(HAVE_GETPWUID) && defined(HAVE_PWD_H)
else
{
struct passwd *pwd;
pwd = getpwuid (getuid());
if (pwd)
home_buffer = xstrdup (pwd->pw_dir);
}
#endif
}
return home_buffer;
}
static char *
mygetcwd (void)
{
char *buffer;
size_t size = 100;
for (;;)
{
buffer = xmalloc (size+1);
#ifdef HAVE_W32CE_SYSTEM
strcpy (buffer, "/"); /* Always "/". */
return buffer;
#else
if (getcwd (buffer, size) == buffer)
- return buffer;
+ {
+#ifdef HAVE_W32_SYSTEM
+ char *p;
+ for (p = buffer; *p; p++)
+ if (*p == '\\')
+ *p = '/';
+#endif
+ return buffer;
+ }
xfree (buffer);
if (errno != ERANGE)
{
fprintf (stderr,"error getting current cwd: %s\n",
strerror (errno));
exit (2);
}
size *= 2;
#endif
}
}
static void
test_percent_escape (void)
{
char *result;
static struct {
const char *extra;
const char *value;
const char *expected;
} tests[] =
{
{ NULL, "", "" },
{ NULL, "%", "%25" },
{ NULL, "%%", "%25%25" },
{ NULL, " %", " %25" },
{ NULL, ":", "%3a" },
{ NULL, " :", " %3a" },
{ NULL, ": ", "%3a " },
{ NULL, " : ", " %3a " },
{ NULL, "::", "%3a%3a" },
{ NULL, ": :", "%3a %3a" },
{ NULL, "%:", "%25%3a" },
{ NULL, ":%", "%3a%25" },
{ "\\\n:", ":%", "%3a%25" },
{ "\\\n:", "\\:%", "%5c%3a%25" },
{ "\\\n:", "\n:%", "%0a%3a%25" },
{ "\\\n:", "\xff:%", "\xff%3a%25" },
{ "\\\n:", "\xfe:%", "\xfe%3a%25" },
{ "\\\n:", "\x01:%", "\x01%3a%25" },
{ "\x01", "\x01:%", "%01%3a%25" },
{ "\xfe", "\xfe:%", "%fe%3a%25" },
{ "\xfe", "\xff:%", "\xff%3a%25" },
{ NULL, NULL, NULL }
};
int testno;
result = percent_escape (NULL, NULL);
if (result)
fail (0);
for (testno=0; tests[testno].value; testno++)
{
result = percent_escape (tests[testno].value, tests[testno].extra);
if (!result)
fail (testno);
else if (strcmp (result, tests[testno].expected))
fail (testno);
xfree (result);
}
}
static void
test_compare_filenames (void)
{
struct {
const char *a;
const char *b;
int result;
} tests[] = {
{ "", "", 0 },
{ "", "a", -1 },
{ "a", "", 1 },
{ "a", "a", 0 },
{ "a", "aa", -1 },
{ "aa", "a", 1 },
{ "a", "b", -1 },
#ifdef HAVE_W32_SYSTEM
{ "a", "A", 0 },
{ "A", "a", 0 },
{ "foo/bar", "foo\\bar", 0 },
{ "foo\\bar", "foo/bar", 0 },
{ "foo\\", "foo/", 0 },
{ "foo/", "foo\\", 0 },
#endif /*HAVE_W32_SYSTEM*/
{ NULL, NULL, 0}
};
int testno, result;
for (testno=0; tests[testno].a; testno++)
{
result = compare_filenames (tests[testno].a, tests[testno].b);
result = result < 0? -1 : result > 0? 1 : 0;
if (result != tests[testno].result)
fail (testno);
}
}
static void
test_strconcat (void)
{
char *out;
out = strconcat ("1", "2", "3", "4", "5", "6", "7", "8", "9", "10",
"1", "2", "3", "4", "5", "6", "7", "8", "9", "10",
"1", "2", "3", "4", "5", "6", "7", "8", "9", "10",
"1", "2", "3", "4", "5", "6", "7", "8", "9", "10",
"1", "2", "3", "4", "5", "6", "7", NULL);
if (!out)
fail (0);
else
xfree (out);
out = strconcat ("1", "2", "3", "4", "5", "6", "7", "8", "9", "10",
"1", "2", "3", "4", "5", "6", "7", "8", "9", "10",
"1", "2", "3", "4", "5", "6", "7", "8", "9", "10",
"1", "2", "3", "4", "5", "6", "7", "8", "9", "10",
"1", "2", "3", "4", "5", "6", "7", "8", NULL);
if (out)
fail (0);
else if (errno != EINVAL)
fail (0);
out = strconcat ("1", "2", "3", "4", "5", "6", "7", "8", "9", "10",
"1", "2", "3", "4", "5", "6", "7", "8", "9", "10",
"1", "2", "3", "4", "5", "6", "7", "8", "9", "10",
"1", "2", "3", "4", "5", "6", "7", "8", "9", "10",
"1", "2", "3", "4", "5", "6", "7", "8", "9", NULL);
if (out)
fail (0);
else if (errno != EINVAL)
fail (0);
xfree (out);
#if __GNUC__ < 4 /* gcc 4.0 has a sentinel attribute. */
out = strconcat (NULL);
if (!out || *out)
fail (1);
#endif
out = strconcat (NULL, NULL);
if (!out || *out)
fail (1);
xfree (out);
out = strconcat ("", NULL);
if (!out || *out)
fail (1);
xfree (out);
out = strconcat ("", "", NULL);
if (!out || *out)
fail (2);
xfree (out);
out = strconcat ("a", "b", NULL);
if (!out || strcmp (out, "ab"))
fail (3);
xfree (out);
out = strconcat ("a", "b", "c", NULL);
if (!out || strcmp (out, "abc"))
fail (3);
xfree (out);
out = strconcat ("a", "b", "cc", NULL);
if (!out || strcmp (out, "abcc"))
fail (4);
xfree (out);
out = strconcat ("a1", "b1", "c1", NULL);
if (!out || strcmp (out, "a1b1c1"))
fail (4);
xfree (out);
out = strconcat ("", " long b ", "", "--even-longer--", NULL);
if (!out || strcmp (out, " long b --even-longer--"))
fail (5);
xfree (out);
out = strconcat ("", " long b ", "", "--even-longer--", NULL);
if (!out || strcmp (out, " long b --even-longer--"))
fail (5);
xfree (out);
}
static void
test_xstrconcat (void)
{
char *out;
out = xstrconcat ("1", "2", "3", "4", "5", "6", "7", "8", "9", "10",
"1", "2", "3", "4", "5", "6", "7", "8", "9", "10",
"1", "2", "3", "4", "5", "6", "7", "8", "9", "10",
"1", "2", "3", "4", "5", "6", "7", "8", "9", "10",
"1", "2", "3", "4", "5", "6", "7", NULL);
if (!out)
fail (0);
xfree (out);
#if __GNUC__ < 4 /* gcc 4.0 has a sentinel attribute. */
out = xstrconcat (NULL);
if (!out)
fail (1);
#endif
out = xstrconcat (NULL, NULL);
if (!out)
fail (1);
xfree (out);
out = xstrconcat ("", NULL);
if (!out || *out)
fail (1);
xfree (out);
out = xstrconcat ("", "", NULL);
if (!out || *out)
fail (2);
xfree (out);
out = xstrconcat ("a", "b", NULL);
if (!out || strcmp (out, "ab"))
fail (3);
xfree (out);
out = xstrconcat ("a", "b", "c", NULL);
if (!out || strcmp (out, "abc"))
fail (3);
xfree (out);
out = xstrconcat ("a", "b", "cc", NULL);
if (!out || strcmp (out, "abcc"))
fail (4);
xfree (out);
out = xstrconcat ("a1", "b1", "c1", NULL);
if (!out || strcmp (out, "a1b1c1"))
fail (4);
xfree (out);
out = xstrconcat ("", " long b ", "", "--even-longer--", NULL);
if (!out || strcmp (out, " long b --even-longer--"))
fail (5);
xfree (out);
out = xstrconcat ("", " long b ", "", "--even-longer--", NULL);
if (!out || strcmp (out, " long b --even-longer--"))
fail (5);
xfree (out);
}
static void
test_make_filename_try (void)
{
char *out;
const char *home = gethome ();
size_t homelen = home? strlen (home):0;
out = make_filename_try ("1", "2", "3", "4", "5", "6", "7", "8", "9", "10",
"1", "2", "3", "4", "5", "6", "7", "8", "9", "10",
"1", "2", "3", "4", "5", "6", "7", "8", "9", "10",
"1", "2", "3", NULL);
if (out)
fail (0);
else if (errno != EINVAL)
fail (0);
xfree (out);
out = make_filename_try ("1", "2", "3", "4", "5", "6", "7", "8", "9", "10",
"1", "2", "3", "4", "5", "6", "7", "8", "9", "10",
"1", "2", "3", "4", "5", "6", "7", "8", "9", "10",
"1", "2", "3", "4", NULL);
if (out)
fail (0);
else if (errno != EINVAL)
fail (0);
xfree (out);
out = make_filename_try ("1", "2", "3", "4", "5", "6", "7", "8", "9", "10",
"1", "2", "3", "4", "5", "6", "7", "8", "9", "10",
"1", "2", "3", "4", "5", "6", "7", "8", "9", "10",
"1", "2", NULL);
if (!out || strcmp (out,
"1/2/3/4/5/6/7/8/9/10/"
"1/2/3/4/5/6/7/8/9/10/"
"1/2/3/4/5/6/7/8/9/10/"
"1/2"))
fail (0);
xfree (out);
out = make_filename_try ("foo", "~/bar", "baz/cde", NULL);
if (!out || strcmp (out, "foo/~/bar/baz/cde"))
fail (1);
xfree (out);
out = make_filename_try ("foo", "~/bar", "baz/cde/", NULL);
if (!out || strcmp (out, "foo/~/bar/baz/cde/"))
fail (1);
xfree (out);
out = make_filename_try ("/foo", "~/bar", "baz/cde/", NULL);
if (!out || strcmp (out, "/foo/~/bar/baz/cde/"))
fail (1);
xfree (out);
out = make_filename_try ("//foo", "~/bar", "baz/cde/", NULL);
if (!out || strcmp (out, "//foo/~/bar/baz/cde/"))
fail (1);
xfree (out);
out = make_filename_try ("", "~/bar", "baz/cde", NULL);
if (!out || strcmp (out, "/~/bar/baz/cde"))
fail (1);
xfree (out);
out = make_filename_try ("~/foo", "bar", NULL);
if (!out)
fail (2);
else if (home)
{
if (strlen (out) < homelen + 7)
fail (2);
else if (strncmp (out, home, homelen))
fail (2);
else if (strcmp (out+homelen, "/foo/bar"))
fail (2);
}
else
{
if (strcmp (out, "~/foo/bar"))
fail (2);
}
xfree (out);
out = make_filename_try ("~", "bar", NULL);
if (!out)
fail (2);
else if (home)
{
if (strlen (out) < homelen + 3)
fail (2);
else if (strncmp (out, home, homelen))
fail (2);
else if (strcmp (out+homelen, "/bar"))
fail (2);
}
else
{
if (strcmp (out, "~/bar"))
fail (2);
}
xfree (out);
}
static void
test_make_absfilename_try (void)
{
char *out;
char *cwd = mygetcwd ();
size_t cwdlen = strlen (cwd);
out = make_absfilename_try ("foo", "bar", NULL);
if (!out)
fail (0);
else if (strlen (out) < cwdlen + 7)
fail (0);
else if (strncmp (out, cwd, cwdlen))
fail (0);
else if (strcmp (out+cwdlen, "/foo/bar"))
fail (0);
xfree (out);
out = make_absfilename_try ("./foo", NULL);
if (!out)
fail (1);
else if (strlen (out) < cwdlen + 5)
fail (1);
else if (strncmp (out, cwd, cwdlen))
fail (1);
else if (strcmp (out+cwdlen, "/./foo"))
fail (1);
xfree (out);
out = make_absfilename_try (".", NULL);
if (!out)
fail (2);
else if (strlen (out) < cwdlen)
fail (2);
else if (strncmp (out, cwd, cwdlen))
fail (2);
else if (strcmp (out+cwdlen, ""))
fail (2);
xfree (out);
xfree (cwd);
}
static void
test_strsplit (void)
{
struct {
const char *s;
char delim;
char replacement;
const char *fields_expected[10];
} tv[] = {
{
"a:bc:cde:fghi:jklmn::foo:", ':', '\0',
{ "a", "bc", "cde", "fghi", "jklmn", "", "foo", "", NULL }
},
{
",a,bc,,def,", ',', '!',
{ "!a!bc!!def!", "a!bc!!def!", "bc!!def!", "!def!", "def!", "", NULL }
},
{
"", ':', ',',
{ "", NULL }
}
};
int tidx;
for (tidx = 0; tidx < DIM(tv); tidx++)
{
char *s2;
int field_count;
char **fields;
int field_count_expected;
int i;
/* Count the fields. */
for (field_count_expected = 0;
tv[tidx].fields_expected[field_count_expected];
field_count_expected ++)
;
/* We need to copy s since strsplit modifies it in place. */
s2 = xstrdup (tv[tidx].s);
fields = strsplit (s2, tv[tidx].delim, tv[tidx].replacement,
&field_count);
if (field_count != field_count_expected)
fail (tidx * 1000);
for (i = 0; i < field_count_expected; i ++)
if (strcmp (tv[tidx].fields_expected[i], fields[i]) != 0)
{
printf ("For field %d, expected '%s', but got '%s'\n",
i, tv[tidx].fields_expected[i], fields[i]);
fail (tidx * 1000 + i + 1);
}
xfree (fields);
xfree (s2);
}
}
static void
test_strtokenize (void)
{
struct {
const char *s;
const char *delim;
const char *fields_expected[10];
} tv[] = {
{
"", ":",
{ "", NULL }
},
{
"a", ":",
{ "a", NULL }
},
{
":", ":",
{ "", "", NULL }
},
{
"::", ":",
{ "", "", "", NULL }
},
{
"a:b:c", ":",
{ "a", "b", "c", NULL }
},
{
"a:b:", ":",
{ "a", "b", "", NULL }
},
{
"a:b", ":",
{ "a", "b", NULL }
},
{
"aa:b:cd", ":",
{ "aa", "b", "cd", NULL }
},
{
"aa::b:cd", ":",
{ "aa", "", "b", "cd", NULL }
},
{
"::b:cd", ":",
{ "", "", "b", "cd", NULL }
},
{
"aa: : b:cd ", ":",
{ "aa", "", "b", "cd", NULL }
},
{
" aa: : b: cd ", ":",
{ "aa", "", "b", "cd", NULL }
},
{
" ", ":",
{ "", NULL }
},
{
" :", ":",
{ "", "", NULL }
},
{
" : ", ":",
{ "", "", NULL }
},
{
": ", ":",
{ "", "", NULL }
},
{
": x ", ":",
{ "", "x", NULL }
},
{
"a:bc:cde:fghi:jklmn::foo:", ":",
{ "a", "bc", "cde", "fghi", "jklmn", "", "foo", "", NULL }
},
{
",a,bc,,def,", ",",
{ "", "a", "bc", "", "def", "", NULL }
},
{
" a ", " ",
{ "", "a", "", NULL }
},
{
" ", " ",
{ "", "", NULL }
},
{
"", " ",
{ "", NULL }
}
};
int tidx;
for (tidx = 0; tidx < DIM(tv); tidx++)
{
char **fields;
int field_count;
int field_count_expected;
int i;
for (field_count_expected = 0;
tv[tidx].fields_expected[field_count_expected];
field_count_expected ++)
;
fields = strtokenize (tv[tidx].s, tv[tidx].delim);
if (!fields)
fail (tidx * 1000);
else
{
for (field_count = 0; fields[field_count]; field_count++)
;
if (field_count != field_count_expected)
fail (tidx * 1000);
else
{
for (i = 0; i < field_count_expected; i++)
if (strcmp (tv[tidx].fields_expected[i], fields[i]))
{
printf ("For field %d, expected '%s', but got '%s'\n",
i, tv[tidx].fields_expected[i], fields[i]);
fail (tidx * 1000 + i + 1);
}
}
}
xfree (fields);
}
}
static void
test_strtokenize_nt (void)
{
struct {
const char *s;
const char *delim;
const char *fields_expected[10];
} tv[] = {
{
"", ":",
{ "", NULL }
},
{
"a", ":",
{ "a", NULL }
},
{
":", ":",
{ "", "", NULL }
},
{
"::", ":",
{ "", "", "", NULL }
},
{
"a:b:c", ":",
{ "a", "b", "c", NULL }
},
{
"a:b:", ":",
{ "a", "b", "", NULL }
},
{
"a:b", ":",
{ "a", "b", NULL }
},
{
"aa:b:cd", ":",
{ "aa", "b", "cd", NULL }
},
{
"aa::b:cd", ":",
{ "aa", "", "b", "cd", NULL }
},
{
"::b:cd", ":",
{ "", "", "b", "cd", NULL }
},
{
"aa: : b:cd ", ":",
{ "aa", " ", " b", "cd ", NULL }
},
{
" aa: : b: cd ", ":",
{ " aa", " ", " b", " cd ", NULL }
},
{
" ", ":",
{ " ", NULL }
},
{
" :", ":",
{ " ", "", NULL }
},
{
" : ", ":",
{ " ", " ", NULL }
},
{
": ", ":",
{ "", " ", NULL }
},
{
": x ", ":",
{ "", " x ", NULL }
},
{
"a:bc:cde:fghi:jklmn::foo:", ":",
{ "a", "bc", "cde", "fghi", "jklmn", "", "foo", "", NULL }
},
{
",a,bc,,def,", ",",
{ "", "a", "bc", "", "def", "", NULL }
},
{
" a ", " ",
{ "", "a", "", NULL }
},
{
" ", " ",
{ "", "", NULL }
},
{
"", " ",
{ "", NULL }
}
};
int tidx;
for (tidx = 0; tidx < DIM(tv); tidx++)
{
char **fields;
int field_count;
int field_count_expected;
int i;
for (field_count_expected = 0;
tv[tidx].fields_expected[field_count_expected];
field_count_expected ++)
;
fields = strtokenize_nt (tv[tidx].s, tv[tidx].delim);
if (!fields)
fail (tidx * 1000);
else
{
for (field_count = 0; fields[field_count]; field_count++)
;
if (field_count != field_count_expected)
fail (tidx * 1000);
else
{
for (i = 0; i < field_count_expected; i++)
if (strcmp (tv[tidx].fields_expected[i], fields[i]))
{
printf ("For field %d, expected '%s', but got '%s'\n",
i, tv[tidx].fields_expected[i], fields[i]);
fail (tidx * 1000 + i + 1);
}
}
}
xfree (fields);
}
}
static void
test_split_fields (void)
{
struct {
const char *s;
int nfields;
const char *fields_expected[10];
} tv[] = {
{
"a bc cde fghi jklmn foo ", 6,
{ "a", "bc", "cde", "fghi", "jklmn", "foo", NULL }
},
{
" a bc def ", 2,
{ "a", "bc", "def", NULL }
},
{
" a bc def ", 3,
{ "a", "bc", "def", NULL }
},
{
" a bc def ", 4,
{ "a", "bc", "def", NULL }
},
{
"", 0,
{ NULL }
}
};
int tidx;
char *fields[10];
int field_count_expected, nfields, field_count, i;
char *s2;
for (tidx = 0; tidx < DIM(tv); tidx++)
{
nfields = tv[tidx].nfields;
assert (nfields <= DIM (fields));
/* Count the fields. */
for (field_count_expected = 0;
tv[tidx].fields_expected[field_count_expected];
field_count_expected ++)
;
if (field_count_expected > nfields)
field_count_expected = nfields;
/* We need to copy s since split_fields modifies in place. */
s2 = xstrdup (tv[tidx].s);
field_count = split_fields (s2, fields, nfields);
if (field_count != field_count_expected)
{
printf ("%s: tidx %d: expected %d, got %d\n",
__func__, tidx, field_count_expected, field_count);
fail (tidx * 1000);
}
else
{
for (i = 0; i < field_count_expected; i ++)
if (strcmp (tv[tidx].fields_expected[i], fields[i]))
{
printf ("%s: tidx %d, field %d: expected '%s', got '%s'\n",
__func__,
tidx, i, tv[tidx].fields_expected[i], fields[i]);
fail (tidx * 1000 + i + 1);
}
}
xfree (s2);
}
}
static void
test_split_fields_colon (void)
{
struct {
const char *s;
int nfields;
const char *fields_expected[10];
} tv[] = {
{
"a:bc:cde:fghi:jklmn: foo ", 6,
{ "a", "bc", "cde", "fghi", "jklmn", " foo ", NULL }
},
{
" a:bc: def ", 2,
{ " a", "bc", NULL }
},
{
" a:bc :def ", 3,
{ " a", "bc ", "def ", NULL }
},
{
" a:bc: def ", 4,
{ " a", "bc", " def ", NULL }
},
{
"", 0,
{ NULL }
}
};
int tidx;
char *fields[10];
int field_count_expected, nfields, field_count, i;
char *s2;
for (tidx = 0; tidx < DIM(tv); tidx++)
{
nfields = tv[tidx].nfields;
assert (nfields <= DIM (fields));
/* Count the fields. */
for (field_count_expected = 0;
tv[tidx].fields_expected[field_count_expected];
field_count_expected ++)
;
if (field_count_expected > nfields)
field_count_expected = nfields;
/* We need to copy s since split_fields modifies in place. */
s2 = xstrdup (tv[tidx].s);
field_count = split_fields_colon (s2, fields, nfields);
if (field_count != field_count_expected)
{
printf ("%s: tidx %d: expected %d, got %d\n",
__func__, tidx, field_count_expected, field_count);
fail (tidx * 1000);
}
else
{
for (i = 0; i < field_count_expected; i ++)
if (strcmp (tv[tidx].fields_expected[i], fields[i]))
{
printf ("%s: tidx %d, field %d: expected '%s', got '%s'\n",
__func__,
tidx, i, tv[tidx].fields_expected[i], fields[i]);
fail (tidx * 1000 + i + 1);
}
}
xfree (s2);
}
}
static char *
stresc (char *s)
{
char *p;
int l = strlen (s) + 1;
for (p = s; *p; p ++)
if (*p == '\n')
l ++;
p = xmalloc (l);
for (l = 0; *s; s ++, l ++)
{
if (*s == ' ')
p[l] = '_';
else if (*p == '\n')
{
p[l ++] = '\\';
p[l ++] = 'n';
p[l] = '\n';
}
else
p[l] = *s;
}
p[l] = *s;
return p;
}
static void
test_format_text (void)
{
struct test
{
int target_cols, max_cols;
char *input;
char *expected;
};
struct test tests[] = {
{
10, 12,
"",
"",
},
{
10, 12,
" ",
"",
},
{
10, 12,
" ",
"",
},
{
10, 12,
" \n ",
" \n",
},
{
10, 12,
" \n \n ",
" \n \n",
},
{
10, 12,
"0123456789 0123456789 0",
"0123456789\n0123456789\n0",
},
{
10, 12,
" 0123456789 0123456789 0 ",
" 0123456789\n0123456789\n0",
},
{
10, 12,
"01 34 67 90 23 56 89 12 45 67 89 1",
"01 34 67\n90 23 56\n89 12 45\n67 89 1"
},
{
10, 12,
"01 34 67 90 23 56 89 12 45 67 89 1",
"01 34 67\n90 23 56\n89 12 45\n67 89 1"
},
{
72, 80,
"Warning: if you think you've seen more than 10 messages "
"signed by this key, then this key might be a forgery! "
"Carefully examine the email address for small variations "
"(e.g., additional white space). If the key is suspect, "
"then use 'gpg --tofu-policy bad \"FINGERPRINT\"' to mark it as being bad.\n",
"Warning: if you think you've seen more than 10 messages signed by this\n"
"key, then this key might be a forgery! Carefully examine the email\n"
"address for small variations (e.g., additional white space). If the key\n"
"is suspect, then use 'gpg --tofu-policy bad \"FINGERPRINT\"' to mark it as\n"
"being bad.\n"
},
{
72, 80,
"Normally, there is only a single key associated with an email "
"address. However, people sometimes generate a new key if "
"their key is too old or they think it might be compromised. "
"Alternatively, a new key may indicate a man-in-the-middle "
"attack! Before accepting this key, you should talk to or "
"call the person to make sure this new key is legitimate.",
"Normally, there is only a single key associated with an email "
"address.\nHowever, people sometimes generate a new key if "
"their key is too old or\nthey think it might be compromised. "
"Alternatively, a new key may indicate\na man-in-the-middle "
"attack! Before accepting this key, you should talk\nto or "
"call the person to make sure this new key is legitimate.",
}
};
int i;
int failed = 0;
for (i = 0; i < sizeof (tests) / sizeof (tests[0]); i ++)
{
struct test *test = &tests[i];
char *result =
format_text (test->input, test->target_cols, test->max_cols);
if (!result)
{
fail (1);
exit (2);
}
if (strcmp (result, test->expected) != 0)
{
printf ("%s: Test #%d failed.\nExpected: '%s'\nResult: '%s'\n",
__func__, i + 1, stresc (test->expected), stresc (result));
failed ++;
}
xfree (result);
}
if (failed)
fail(0);
}
static void
test_compare_version_strings (void)
{
struct { const char *a; const char *b; int okay; } tests[] = {
{ "1.0.0", "1.0.0", 0 },
{ "1.0.0-", "1.0.0", 1 },
{ "1.0.0-1", "1.0.0", 1 },
{ "1.0.0.1", "1.0.0", 1 },
{ "1.0.0", "1.0.1", -1 },
{ "1.0.0-", "1.0.1", -1 },
{ "1.0.0-1", "1.0.1", -1 },
{ "1.0.0.1", "1.0.1", -1 },
{ "1.0.0", "1.1.0", -1 },
{ "1.0.0-", "1.1.0", -1 },
{ "1.0.0-1", "1.1.0", -1 },
{ "1.0.0.1", "1.1.0", -1 },
{ "1.0.0", "1.0.0-", -1 },
{ "1.0.0", "1.0.0-1", -1 },
{ "1.0.0", "1.0.0.1", -1 },
{ "1.1.0", "1.0.0", 1 },
{ "1.1.1", "1.1.0", 1 },
{ "1.1.2", "1.1.2", 0 },
{ "1.1.2", "1.0.2", 1 },
{ "1.1.2", "0.0.2", 1 },
{ "1.1.2", "1.1.3", -1 },
{ "0.99.1", "0.9.9", 1 },
{ "0.9.1", "0.91.0", -1 },
{ "1.5.3", "1.5", 1 },
{ "1.5.0", "1.5", 0 },
{ "1.4.99", "1.5", -1 },
{ "1.5", "1.4.99", 1 },
{ "1.5", "1.5.0", 0 },
{ "1.5", "1.5.1", -1 },
{ "1.5.3-x17", "1.5-23", 1 },
{ "1.5.3a", "1.5.3", 1 },
{ "1.5.3a", "1.5.3b", -1 },
{ "3.1.4-ab", "3.1.4-ab", 0 },
{ "3.1.4-ab", "3.1.4-ac", -1 },
{ "3.1.4-ac", "3.1.4-ab", 1 },
{ "3.1.4-ab", "3.1.4-abb", -1 },
{ "3.1.4-abb", "3.1.4-ab", 1 },
{ "", "", INT_MIN },
{ NULL, "", INT_MIN },
{ "1.2.3", "", INT_MIN },
{ "1.2.3", "2", INT_MIN },
/* Test cases for validity of A. */
{ "", NULL, INT_MIN },
{ "1", NULL, INT_MIN },
{ "1.", NULL, 0 },
{ "1.0", NULL, 0 },
{ "1.0.", NULL, 0 },
{ "a1.2", NULL, INT_MIN },
{ NULL, NULL, INT_MIN }
};
int idx;
int res;
for (idx=0; idx < DIM(tests); idx++)
{
res = compare_version_strings (tests[idx].a, tests[idx].b);
/* printf ("test %d: '%s' '%s' %d -> %d\n", */
/* idx, tests[idx].a, tests[idx].b, tests[idx].okay, res); */
if (res != tests[idx].okay)
fail (idx);
}
}
static void
test_substitute_envvars (void)
{
struct {
const char *name;
const char *value;
} envvars[] = {
{ "HOME", "/home/joe" },
{ "AVAR", "avar" },
{ "AVAR1", "avarx" },
{ "AVAR2", "avarxy" },
{ "AVAR3", "avarxyz" },
{ "AVAR0", "ava" },
{ "MY_VAR", "my_vars_value" },
{ "STRANGE{X}VAR", "strange{x}vars-value" },
{ "ZERO", "" }
};
struct {
const char *string;
const char *result;
} tests[] = {
{ "foo bar",
"foo bar"
},
{ "foo $HOME",
"foo /home/joe"
},
{ "foo $HOME ",
"foo /home/joe "
},
{ "foo $HOME$$",
"foo /home/joe$"
},
{ "foo ${HOME}/.ssh",
"foo /home/joe/.ssh"
},
{ "foo $HOME/.ssh",
"foo /home/joe/.ssh"
},
{ "foo $HOME_/.ssh",
"foo /.ssh"
},
{ "foo $HOME/.ssh/$MY_VAR:1",
"foo /home/joe/.ssh/my_vars_value:1"
},
{ "foo $HOME${MY_VAR}:1",
"foo /home/joemy_vars_value:1"
},
{ "${STRANGE{X}VAR}-bla",
"strange{x}vars-value-bla"
},
{ "${STRANGE{X}{VAR}-bla", /* missing "}" */
"${STRANGE{X}{VAR}-bla"
},
{ "zero->$ZERO<-",
"zero-><-"
},
{ "->$AVAR.$AVAR1.$AVAR2.$AVAR3.$AVAR0<-",
"->avar.avarx.avarxy.avarxyz.ava<-"
},
{ "",
""
}
};
int idx;
char *res;
for (idx=0; idx < DIM(envvars); idx++)
if (gnupg_setenv (envvars[idx].name, envvars[idx].value, 1))
{
fprintf (stderr,"error setting envvar '%s' to '%s': %s\n",
envvars[idx].name, envvars[idx].value,
strerror (errno));
exit (2);
}
for (idx=0; idx < DIM(tests); idx++)
{
res = substitute_envvars (tests[idx].string);
if (!res)
{
fprintf (stderr,"error substituting '%s' (test %d): %s\n",
tests[idx].string, idx, strerror (errno));
exit (2);
}
if (strcmp (res, tests[idx].result))
{
fprintf (stderr, "substituted '%s'\n", tests[idx].string);
fprintf (stderr, " wanted '%s'\n", tests[idx].result);
fprintf (stderr, " got '%s'\n", res);
fail (idx);
}
xfree (res);
}
}
int
main (int argc, char **argv)
{
(void)argc;
(void)argv;
test_percent_escape ();
test_compare_filenames ();
test_strconcat ();
test_xstrconcat ();
test_make_filename_try ();
test_make_absfilename_try ();
test_strsplit ();
test_strtokenize ();
test_strtokenize_nt ();
test_split_fields ();
test_split_fields_colon ();
test_compare_version_strings ();
test_format_text ();
test_substitute_envvars ();
xfree (home_buffer);
return !!errcount;
}
diff --git a/tests/gpgme/Makefile.am b/tests/gpgme/Makefile.am
index 60fb01df9..8b1f3c7df 100644
--- a/tests/gpgme/Makefile.am
+++ b/tests/gpgme/Makefile.am
@@ -1,57 +1,57 @@
# Makefile.am - For tests/gpgme
# Copyright (C) 2016 g10 Code GmbH
#
# This file is part of GnuPG.
#
# GnuPG is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 3 of the License, or
# (at your option) any later version.
#
# GnuPG is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, see .
# Process this file with automake to create Makefile.in
# Programs required before we can run these tests.
required_pgms = ../../g10/gpg$(EXEEXT) ../../agent/gpg-agent$(EXEEXT) \
../../tools/gpg-connect-agent$(EXEEXT) \
../gpgscm/gpgscm$(EXEEXT)
AM_CPPFLAGS = -I$(top_srcdir)/common
include $(top_srcdir)/am/cmacros.am
AM_CFLAGS =
TESTS_ENVIRONMENT = LC_ALL=C \
EXEEXT=$(EXEEXT) \
PATH="../gpgscm:$(PATH)" \
abs_top_srcdir=$(abs_top_srcdir) \
objdir=$(abs_top_builddir) \
GPGSCM_PATH=$(abs_top_srcdir)/tests/gpgscm
# XXX: Currently, one cannot override automake's 'check' target. As a
# workaround, we avoid defining 'TESTS', thus automake will not emit
# the 'check' target. For extra robustness, we merely define a
# dependency on 'xcheck', so this hack should also work even if
# automake would emit the 'check' target, as adding dependencies to
# targets is okay.
check: xcheck
.PHONY: xcheck
xcheck:
- $(TESTS_ENVIRONMENT) $(abs_top_builddir)/tests/gpgscm/gpgscm \
+ $(TESTS_ENVIRONMENT) $(abs_top_builddir)/tests/gpgscm/gpgscm$(EXEEXT) \
$(abs_srcdir)/run-tests.scm $(TESTFLAGS) $(TESTS)
EXTRA_DIST = gpgme-defs.scm run-tests.scm setup.scm wrap.scm all-tests.scm
CLEANFILES = *.log report.xml
# 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)
diff --git a/tests/migrations/Makefile.am b/tests/migrations/Makefile.am
index 6d2d2e8a6..4eaacb945 100644
--- a/tests/migrations/Makefile.am
+++ b/tests/migrations/Makefile.am
@@ -1,66 +1,66 @@
# Makefile.am - For tests/openpgp
# Copyright (C) 2016 g10 Code GmbH
#
# This file is part of GnuPG.
#
# GnuPG is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 3 of the License, or
# (at your option) any later version.
#
# GnuPG is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, see .
# Process this file with automake to create Makefile.in
# Programs required before we can run these tests.
required_pgms = ../../g10/gpg$(EXEEXT) ../../agent/gpg-agent$(EXEEXT) \
../../tools/gpgtar$(EXEEXT) \
../gpgscm/gpgscm$(EXEEXT)
AM_CPPFLAGS = -I$(top_srcdir)/common
include $(top_srcdir)/am/cmacros.am
AM_CFLAGS =
TESTS_ENVIRONMENT = GPG_AGENT_INFO= LC_ALL=C \
EXEEXT=$(EXEEXT) \
PATH="../gpgscm:$(PATH)" \
abs_top_srcdir="$(abs_top_srcdir)" \
objdir="$(abs_top_builddir)" \
GPGSCM_PATH="$(abs_top_srcdir)/tests/gpgscm"
XTESTS = from-classic.scm \
extended-pkf.scm \
issue2276.scm
TEST_FILES = from-classic.tar.asc \
extended-pkf.tar.asc \
issue2276.tar.asc
# XXX: Currently, one cannot override automake's 'check' target. As a
# workaround, we avoid defining 'TESTS', thus automake will not emit
# the 'check' target. For extra robustness, we merely define a
# dependency on 'xcheck', so this hack should also work even if
# automake would emit the 'check' target, as adding dependencies to
# targets is okay.
check: xcheck
.PHONY: xcheck
xcheck:
- $(TESTS_ENVIRONMENT) $(abs_top_builddir)/tests/gpgscm/gpgscm \
+ $(TESTS_ENVIRONMENT) $(abs_top_builddir)/tests/gpgscm/gpgscm$(EXEEXT) \
$(abs_srcdir)/run-tests.scm $(TESTFLAGS) $(TESTS)
EXTRA_DIST = common.scm run-tests.scm setup.scm all-tests.scm \
$(XTESTS) $(TEST_FILES)
CLEANFILES = *.log report.xml
# 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)
diff --git a/tests/openpgp/Makefile.am b/tests/openpgp/Makefile.am
index 59f39e2f7..2b06fb18c 100644
--- a/tests/openpgp/Makefile.am
+++ b/tests/openpgp/Makefile.am
@@ -1,290 +1,290 @@
# Makefile.am - For tests/openpgp
# Copyright (C) 1998, 1999, 2000, 2001, 2003,
# 2010 Free Software Foundation, Inc.
#
# This file is part of GnuPG.
#
# GnuPG is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 3 of the License, or
# (at your option) any later version.
#
# GnuPG is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, see .
# Process this file with automake to create Makefile.in
# Programs required before we can run these tests.
required_pgms = ../../g10/gpg$(EXEEXT) ../../agent/gpg-agent$(EXEEXT) \
../../tools/gpg-connect-agent$(EXEEXT) \
../gpgscm/gpgscm$(EXEEXT)
AM_CPPFLAGS = -I$(top_srcdir)/common
include $(top_srcdir)/am/cmacros.am
AM_CFLAGS =
noinst_PROGRAMS = fake-pinentry
fake_pinentry_SOURCES = fake-pinentry.c
TESTS_ENVIRONMENT = LC_ALL=C \
EXEEXT=$(EXEEXT) \
PATH="../gpgscm:$(PATH)" \
abs_top_srcdir="$(abs_top_srcdir)" \
objdir="$(abs_top_builddir)" \
GPGSCM_PATH="$(abs_top_srcdir)/tests/gpgscm"
XTESTS = \
version.scm \
enarmor.scm \
mds.scm \
decrypt.scm \
decrypt-multifile.scm \
decrypt-dsa.scm \
decrypt-session-key.scm \
decrypt-unwrap-verify.scm \
sigs.scm \
sigs-dsa.scm \
encrypt.scm \
encrypt-multifile.scm \
encrypt-dsa.scm \
compression.scm \
seat.scm \
clearsig.scm \
encryptp.scm \
detach.scm \
detachm.scm \
armsigs.scm \
armencrypt.scm \
armencryptp.scm \
signencrypt.scm \
signencrypt-dsa.scm \
armsignencrypt.scm \
armdetach.scm \
armdetachm.scm \
genkey1024.scm \
conventional.scm \
conventional-mdc.scm \
multisig.scm \
verify.scm \
verify-multifile.scm \
gpgv.scm \
gpgv-forged-keyring.scm \
armor.scm \
import.scm \
import-revocation-certificate.scm \
ecc.scm \
4gb-packet.scm \
tofu.scm \
trust-pgp-1.scm \
trust-pgp-2.scm \
trust-pgp-3.scm \
gpgtar.scm \
use-exact-key.scm \
default-key.scm \
export.scm \
ssh-import.scm \
ssh-export.scm \
quick-key-manipulation.scm \
key-selection.scm \
delete-keys.scm \
gpgconf.scm \
issue2015.scm \
issue2346.scm \
issue2417.scm \
issue2419.scm \
issue2929.scm \
issue2941.scm
# Temporary removed tests:
# trust-pgp-4.scm
# XXX: Currently, one cannot override automake's 'check' target. As a
# workaround, we avoid defining 'TESTS', thus automake will not emit
# the 'check' target. For extra robustness, we merely define a
# dependency on 'xcheck', so this hack should also work even if
# automake would emit the 'check' target, as adding dependencies to
# targets is okay.
check: xcheck
.PHONY: xcheck
xcheck:
- $(TESTS_ENVIRONMENT) $(abs_top_builddir)/tests/gpgscm/gpgscm \
+ $(TESTS_ENVIRONMENT) $(abs_top_builddir)/tests/gpgscm/gpgscm$(EXEEXT) \
$(abs_srcdir)/run-tests.scm $(TESTFLAGS) $(TESTS)
TEST_FILES = pubring.asc secring.asc plain-1o.asc plain-2o.asc plain-3o.asc \
plain-1.asc plain-2.asc plain-3.asc plain-1-pgp.asc \
plain-largeo.asc plain-large.asc \
pubring.pkr.asc secring.skr.asc secdemo.asc pubdemo.asc \
bug537-test.data.asc bug894-test.asc \
bug1223-good.asc bug1223-bogus.asc 4gb-packet.asc \
tofu/conflicting/1C005AF3.gpg \
tofu/conflicting/1C005AF3-secret.gpg \
tofu/conflicting/1C005AF3-1.txt \
tofu/conflicting/1C005AF3-2.txt \
tofu/conflicting/1C005AF3-3.txt \
tofu/conflicting/1C005AF3-4.txt \
tofu/conflicting/1C005AF3-5.txt \
tofu/conflicting/B662E42F.gpg \
tofu/conflicting/B662E42F-secret.gpg \
tofu/conflicting/B662E42F-1.txt \
tofu/conflicting/B662E42F-2.txt \
tofu/conflicting/B662E42F-3.txt \
tofu/conflicting/B662E42F-4.txt \
tofu/conflicting/B662E42F-5.txt \
tofu/conflicting/BE04EB2B.gpg \
tofu/conflicting/BE04EB2B-secret.gpg \
tofu/conflicting/BE04EB2B-1.txt \
tofu/conflicting/BE04EB2B-2.txt \
tofu/conflicting/BE04EB2B-3.txt \
tofu/conflicting/BE04EB2B-4.txt \
tofu/conflicting/BE04EB2B-5.txt \
tofu/cross-sigs/EC38277E-secret.gpg \
tofu/cross-sigs/EC38277E-1.gpg \
tofu/cross-sigs/EC38277E-1.txt \
tofu/cross-sigs/EC38277E-2.gpg \
tofu/cross-sigs/EC38277E-2.txt \
tofu/cross-sigs/EC38277E-3.txt \
tofu/cross-sigs/871C2247-secret.gpg \
tofu/cross-sigs/871C2247-1.gpg \
tofu/cross-sigs/871C2247-1.txt \
tofu/cross-sigs/871C2247-2.gpg \
tofu/cross-sigs/871C2247-2.txt \
tofu/cross-sigs/871C2247-3.gpg \
tofu/cross-sigs/871C2247-3.txt \
tofu/cross-sigs/871C2247-4.gpg \
tofu/cross-sigs/README \
key-selection/0.asc \
key-selection/1.asc \
key-selection/2.asc \
key-selection/3.asc \
key-selection/4.asc \
trust-pgp/scenario1.asc \
trust-pgp/scenario2.asc \
trust-pgp/scenario3.asc \
trust-pgp/scenario4.asc \
trust-pgp/alice.sec.asc \
trust-pgp/bobby.sec.asc \
trust-pgp/carol.sec.asc \
trust-pgp/david.sec.asc \
trust-pgp/frank.sec.asc \
trust-pgp/grace.sec.asc \
trust-pgp/heidi.sec.asc
data_files = data-500 data-9000 data-32000 data-80000 plain-large
priv_keys = privkeys/50B2D4FA4122C212611048BC5FC31BD44393626E.asc \
privkeys/7E201E28B6FEB2927B321F443205F4724EBE637E.asc \
privkeys/13FDB8809B17C5547779F9D205C45F47CE0217CE.asc \
privkeys/343D8AF79796EE107D645A2787A9D9252F924E6F.asc \
privkeys/8B5ABF3EF9EB8D96B91A0B8C2C4401C91C834C34.asc \
privkeys/0D6F6AD4C4C803B25470F9104E9F4E6A4CA64255.asc \
privkeys/FD692BD59D6640A84C8422573D469F84F3B98E53.asc \
privkeys/76F7E2B35832976B50A27A282D9B87E44577EB66.asc \
privkeys/A0747D5F9425E6664F4FFBEED20FBCA79FDED2BD.asc \
privkeys/0DD40284FF992CD24DC4AAC367037E066FCEE26A.asc \
privkeys/2BC997C0B8691D41D29A4EC81CCBCF08454E4961.asc \
privkeys/3C9D5ECA70130C2DBB1FC6AC0076BEEEC197716F.asc \
privkeys/449E644892C951A37525654730DD32C202079926.asc \
privkeys/58FFE844087634E62440224908BDE44BEA7EB730.asc \
privkeys/4DF9172D6FF428C97A0E9AA96F03E8BCE3B2F188.asc \
privkeys/9D7CD8F53F2F14C3E2177D1E9D1D11F39513A4A4.asc \
privkeys/6E6B7ED0BD4425018FFC54F3921D5467A3AE00EB.asc \
privkeys/C905D0AB6AE9655C5A35975939997BBF3325D6DD.asc \
privkeys/B2BAA7144303DF19BB6FDE23781DD3FDD97918D4.asc \
privkeys/CF60965BF51F67CF80DECE853E0D2D343468571D.asc \
privkeys/DF00E361D34F80868D06879AC21D7A7D4E4FAD76.asc \
privkeys/00FE67F28A52A8AA08FFAED20AF832DA916D1985.asc \
privkeys/1DF48228FEFF3EC2481B106E0ACA8C465C662CC5.asc \
privkeys/A2832820DC9F40751BDCD375BB0945BA33EC6B4C.asc \
privkeys/ADE710D74409777B7729A7653373D820F67892E0.asc \
privkeys/CEFC51AF91F68A2904FBFF62C4F075A4785B803F.asc \
privkeys/1E28F20E41B54C2D1234D896096495FF57E08D18.asc \
privkeys/EB33B687EB8581AB64D04852A54453E85F3DF62D.asc \
privkeys/C6A6390E9388CDBAD71EAEA698233FE5E04F001E.asc \
privkeys/D69102E0F5AC6B6DB8E4D16DA8E18CF46D88CAE3.asc
sample_keys = samplekeys/README \
samplekeys/ecc-sample-1-pub.asc \
samplekeys/ecc-sample-2-pub.asc \
samplekeys/ecc-sample-3-pub.asc \
samplekeys/ecc-sample-1-sec.asc \
samplekeys/ecc-sample-2-sec.asc \
samplekeys/ecc-sample-3-sec.asc \
samplekeys/eddsa-sample-1-pub.asc \
samplekeys/eddsa-sample-1-sec.asc \
samplekeys/dda252ebb8ebe1af-1.asc \
samplekeys/dda252ebb8ebe1af-2.asc \
samplekeys/whats-new-in-2.1.asc \
samplekeys/e2e-p256-1-clr.asc \
samplekeys/e2e-p256-1-prt.asc \
samplekeys/E657FB607BB4F21C90BB6651BC067AF28BC90111.asc \
samplekeys/rsa-rsa-sample-1.asc \
samplekeys/ed25519-cv25519-sample-1.asc \
samplekeys/silent-running.asc \
samplekeys/ssh-dsa.key \
samplekeys/ssh-ecdsa.key \
samplekeys/ssh-ed25519.key \
samplekeys/ssh-rsa.key \
samplekeys/issue2346.gpg \
samplekeys/authenticate-only.pub.asc \
samplekeys/authenticate-only.sec.asc
sample_msgs = samplemsgs/clearsig-1-key-1.asc \
samplemsgs/clearsig-2-keys-1.asc \
samplemsgs/clearsig-2-keys-2.asc \
samplemsgs/enc-1-key-1.asc \
samplemsgs/enc-1-key-2.asc \
samplemsgs/enc-2-keys-1.asc \
samplemsgs/enc-2-keys-2.asc \
samplemsgs/enc-2-keys-hh-1.asc \
samplemsgs/enc-2-keys-hr-1.asc \
samplemsgs/enc-2-keys-rh-1.asc \
samplemsgs/encsig-2-2-keys-3.asc \
samplemsgs/encsig-2-2-keys-4.asc \
samplemsgs/encsig-2-keys-1.asc \
samplemsgs/encsig-2-keys-2.asc \
samplemsgs/encsig-2-keys-3.asc \
samplemsgs/encsig-2-keys-4.asc \
samplemsgs/encz0-1-key-1.asc \
samplemsgs/encz0-1-key-2.asc \
samplemsgs/issue2419.asc \
samplemsgs/revoke-2D727CC768697734.asc \
samplemsgs/sig-1-key-1.asc \
samplemsgs/sig-1-key-2.asc \
samplemsgs/sig-2-keys-1.asc \
samplemsgs/sig-2-keys-2.asc \
samplemsgs/signed-1-key-1.asc \
samplemsgs/signed-1-key-2.asc \
samplemsgs/signed-2-keys-1.asc \
samplemsgs/signed-2-keys-2.asc
EXTRA_DIST = defs.scm trust-pgp/common.scm $(XTESTS) $(TEST_FILES) \
mkdemodirs signdemokey $(priv_keys) $(sample_keys) \
$(sample_msgs) ChangeLog-2011 run-tests.scm trust-pgp-4.scm \
setup.scm shell.scm all-tests.scm signed-messages.scm
CLEANFILES = prepared.stamp x y yy z out err $(data_files) \
plain-1 plain-2 plain-3 trustdb.gpg *.lock .\#lk* \
*.log gpg_dearmor gpg.conf gpg-agent.conf S.gpg-agent \
pubring.gpg pubring.gpg~ pubring.kbx pubring.kbx~ \
secring.gpg pubring.pkr secring.skr \
gnupg-test.stop random_seed gpg-agent.log tofu.db \
passphrases sshcontrol S.gpg-agent.ssh report.xml
XTESTS += trust-pgp-4.scm
clean-local:
-rm -rf private-keys-v1.d openpgp-revocs.d tofu.d gpgtar.d
# 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)