mirror of
git://git.gnupg.org/gnupg.git
synced 2025-07-02 22:46:30 +02:00
tests: Locate resources and scripts relative to top source dir.
-- Locate every resource and every script used in the tests using a path relative to the top of the source tree. This is a purely mechanical change, mostly done using regular expressions, with a few manual fixups here and there. Signed-off-by: Justus Winter <justus@g10code.com>
This commit is contained in:
parent
f03d6897be
commit
ed4d23d75e
87 changed files with 208 additions and 182 deletions
|
@ -54,6 +54,8 @@ noinst_PROGRAMS += gpgcompose
|
|||
endif
|
||||
noinst_PROGRAMS += $(module_tests)
|
||||
TESTS = $(module_tests)
|
||||
TESTS_ENVIRONMENT = \
|
||||
abs_top_srcdir=$(abs_top_srcdir)
|
||||
|
||||
if ENABLE_BZIP2_SUPPORT
|
||||
bzip2_source = compress-bz2.c
|
||||
|
|
|
@ -58,6 +58,8 @@
|
|||
#include "dek.h"
|
||||
#include "../common/logging.h"
|
||||
|
||||
#include "test.c"
|
||||
|
||||
static void
|
||||
log_hexdump (byte *buffer, int length)
|
||||
{
|
||||
|
@ -368,8 +370,8 @@ oracle_test (unsigned int d, int b, int debug)
|
|||
return oracle (debug, probe, blocksize + 2, NULL, NULL) == 0;
|
||||
}
|
||||
|
||||
int
|
||||
main (int argc, char *argv[])
|
||||
static void
|
||||
do_test (int argc, char *argv[])
|
||||
{
|
||||
int i;
|
||||
int debug = 0;
|
||||
|
@ -379,8 +381,6 @@ main (int argc, char *argv[])
|
|||
byte *raw_data;
|
||||
int raw_data_len;
|
||||
|
||||
int failed = 0;
|
||||
|
||||
for (i = 1; i < argc; i ++)
|
||||
{
|
||||
if (strcmp (argv[i], "--debug") == 0)
|
||||
|
@ -396,11 +396,10 @@ main (int argc, char *argv[])
|
|||
}
|
||||
}
|
||||
|
||||
if (! blocksize && ! filename && (filename = getenv ("srcdir")))
|
||||
if (! blocksize && ! filename && (filename = prepend_srcdir ("t-stutter-data.asc")))
|
||||
/* Try defaults. */
|
||||
{
|
||||
parse_session_key ("9:9274A8EC128E850C6DDDF9EAC68BFA84FC7BC05F340DA41D78C93D0640C7C503");
|
||||
filename = xasprintf ("%s/t-stutter-data.asc", filename);
|
||||
}
|
||||
|
||||
if (help || ! blocksize || ! filename)
|
||||
|
@ -601,7 +600,7 @@ main (int argc, char *argv[])
|
|||
isprint (pt[0]) ? pt[0] : '?',
|
||||
isprint (pt[1]) ? pt[1] : '?',
|
||||
hexstr (m));
|
||||
failed = 1;
|
||||
tests_failed++;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -610,5 +609,4 @@ main (int argc, char *argv[])
|
|||
}
|
||||
|
||||
xfree (filename);
|
||||
return failed;
|
||||
}
|
||||
|
|
|
@ -154,12 +154,12 @@ prepend_srcdir (const char *fname)
|
|||
static const char *srcdir;
|
||||
char *result;
|
||||
|
||||
if (!srcdir && !(srcdir = getenv ("srcdir")))
|
||||
if (!srcdir && !(srcdir = getenv ("abs_top_srcdir")))
|
||||
srcdir = ".";
|
||||
|
||||
result = malloc (strlen (srcdir) + 1 + strlen (fname) + 1);
|
||||
result = malloc (strlen (srcdir) + strlen ("/g10/") + strlen (fname) + 1);
|
||||
strcpy (result, srcdir);
|
||||
strcat (result, "/");
|
||||
strcat (result, "/g10/");
|
||||
strcat (result, fname);
|
||||
return result;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue