Commit 7ff5c082 authored by Matthias Clasen's avatar Matthias Clasen

Convert more tests to installed tests

This makes the tests in tests installed, except for
the performance tests.
parent 1808888a
include $(top_srcdir)/Makefile.decl
insttestdir = $(pkglibexecdir)/installed-tests
SUBDIRS=gobject refcount
AM_CPPFLAGS = \
......@@ -129,6 +131,29 @@ TESTS_ENVIRONMENT = srcdir=$(srcdir) \
MALLOC_CHECK_=2 \
MALLOC_PERTURB_=$$(($${RANDOM:-256} % 256))
test_data = \
iochannel-test-infile \
casemap.txt \
casefold.txt \
utf8.txt \
$(NULL)
if BUILDOPT_INSTALL_TESTS
insttest_PROGRAMS = $(test_programs)
testmetadir = $(datadir)/installed-tests/$(PACKAGE)
testmeta_DATA = $(test_programs:=.test)
insttest_DATA = $(test_data)
%.test: % Makefile
$(AM_V_GEN) (echo '[Test]' > $@.tmp; \
echo 'Type=session' >> $@.tmp; \
echo 'Exec=env G_TEST_DATA=$(pkglibexecdir)/installed-tests $(pkglibexecdir)/installed-tests/$<' >> $@.tmp; \
mv $@.tmp $@)
endif
progs_ldadd = $(EFENCE) $(libglib) $(EFENCE)
thread_ldadd = $(libgthread) $(G_THREAD_LIBS) $(progs_ldadd)
module_ldadd = $(libgmodule) $(G_MODULE_LIBS) $(progs_ldadd)
......@@ -166,14 +191,18 @@ type_test_LDADD = $(progs_ldadd)
unicode_encoding_LDADD = $(progs_ldadd)
unicode_caseconv_LDADD = $(progs_ldadd)
if BUILDOPT_INSTALL_TESTS
insttest_LTLIBRARIES = libmoduletestplugin_a.la libmoduletestplugin_b.la
else
noinst_LTLIBRARIES = libmoduletestplugin_a.la libmoduletestplugin_b.la
endif
libmoduletestplugin_a_la_SOURCES = libmoduletestplugin_a.c
libmoduletestplugin_a_la_LDFLAGS = $(G_MODULE_LDFLAGS) -avoid-version -module $(no_undefined) -rpath $(libdir)
libmoduletestplugin_a_la_LDFLAGS = $(G_MODULE_LDFLAGS) -avoid-version -module $(no_undefined) -rpath $(insttestdir)
libmoduletestplugin_a_la_LIBADD = $(G_MODULE_LIBS) $(libadd_libgmodule) $(libadd_libglib)
libmoduletestplugin_b_la_SOURCES = libmoduletestplugin_b.c
libmoduletestplugin_b_la_LDFLAGS = $(G_MODULE_LDFLAGS) -avoid-version -module $(no_undefined) -rpath $(libdir)
libmoduletestplugin_b_la_LDFLAGS = $(G_MODULE_LDFLAGS) -avoid-version -module $(no_undefined) -rpath $(insttestdir)
libmoduletestplugin_b_la_LIBADD = $(G_MODULE_LIBS) $(libadd_libgmodule) $(libadd_libglib)
dist-hook: $(BUILT_EXTRA_DIST)
......
......@@ -60,16 +60,18 @@ test_programs = \
defaultiface \
dynamictype \
override \
performance \
performance-threaded \
singleton \
references
performance_programs = \
performance \
performance-threaded
performance_LDADD = $(libgobject) $(libgthread)
performance_threaded_LDADD = $(libgobject) $(libgthread)
check_PROGRAMS = $(test_programs)
TESTS = $(test_programs)
TESTS = $(test_programs) $(performance_programs)
TESTS_ENVIRONMENT = srcdir=$(srcdir) \
LIBCHARSET_ALIAS_DIR=$(top_builddir)/glib/libcharset \
MALLOC_CHECK_=2 \
......
......@@ -11,6 +11,8 @@
#define BUFFER_SIZE 1024
static const gchar *datapath;
static void
test_small_writes (void)
{
......@@ -58,16 +60,18 @@ gint main (gint argc, gchar * argv[])
GError *gerr = NULL;
GString *buffer;
char *filename;
char *srcdir = getenv ("srcdir");
gint rlength = 0;
glong wlength = 0;
gsize length_out;
const gchar encoding[] = "EUC-JP";
GIOStatus status;
if (!srcdir)
srcdir = ".";
filename = g_strconcat (srcdir, G_DIR_SEPARATOR_S, "iochannel-test-infile", NULL);
if (g_getenv ("G_TEST_DATA"))
datapath = g_getenv ("G_TEST_DATA");
else
datapath = ".";
filename = g_build_filename (datapath, "iochannel-test-infile", NULL);
setbuf (stdout, NULL); /* For debugging */
......
......@@ -30,6 +30,8 @@
#include <gmodule.h>
#include <string.h>
static const gchar *datapath;
gchar* global_state;
G_MODULE_EXPORT void g_clash_func (void);
......@@ -85,12 +87,13 @@ main (int arg,
if (!g_module_supported ())
g_error ("dynamic modules not supported");
dir = g_get_current_dir ();
if (g_getenv ("G_TEST_DATA"))
datapath = g_getenv ("G_TEST_DATA");
else
datapath = ".";
plugin_a = g_strconcat (dir, G_DIR_SEPARATOR_S "libmoduletestplugin_a",
NULL);
plugin_b = g_strconcat (dir, G_DIR_SEPARATOR_S "libmoduletestplugin_b",
NULL);
plugin_a = g_build_filename (datapath, "libmoduletestplugin_a", NULL);
plugin_b = g_build_filename (datapath, "libmoduletestplugin_b", NULL);
g_free (dir);
......
......@@ -12,7 +12,7 @@ int main (int argc, char **argv)
FILE *infile;
char buffer[1024];
char **strings;
char *srcdir = getenv ("srcdir");
const char *srcdir;
char *filename;
const char *locale;
const char *test;
......@@ -21,10 +21,13 @@ int main (int argc, char **argv)
char *current_locale = setlocale (LC_CTYPE, NULL);
gint result = 0;
if (!srcdir)
if (g_getenv ("G_TEST_DATA"))
srcdir = g_getenv ("G_TEST_DATA");
else
srcdir = ".";
filename = g_strconcat (srcdir, G_DIR_SEPARATOR_S, "casemap.txt", NULL);
infile = fopen (filename, "r");
if (!infile)
{
......
......@@ -308,7 +308,7 @@ process (gint line,
int
main (int argc, char **argv)
{
gchar *srcdir = getenv ("srcdir");
const gchar *srcdir;
gchar *testfile;
gchar *contents;
GError *error = NULL;
......@@ -321,7 +321,9 @@ main (int argc, char **argv)
GArray *ucs4;
Status status = VALID; /* Quiet GCC */
if (!srcdir)
if (g_getenv ("G_TEST_DATA"))
srcdir = g_getenv ("G_TEST_DATA");
else
srcdir = ".";
testfile = g_strconcat (srcdir, G_DIR_SEPARATOR_S "utf8.txt", NULL);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment