include $(top_srcdir)/Makefile.decl
+insttestdir = $(pkglibexecdir)/installed-tests
+
SUBDIRS=gobject refcount
AM_CPPFLAGS = \
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)
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)
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 \
#define BUFFER_SIZE 1024
+static const gchar *datapath;
+
static void
test_small_writes (void)
{
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 */
#include <gmodule.h>
#include <string.h>
+static const gchar *datapath;
+
gchar* global_state;
G_MODULE_EXPORT void g_clash_func (void);
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);
FILE *infile;
char buffer[1024];
char **strings;
- char *srcdir = getenv ("srcdir");
+ const char *srcdir;
char *filename;
const char *locale;
const char *test;
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)
{
int
main (int argc, char **argv)
{
- gchar *srcdir = getenv ("srcdir");
+ const gchar *srcdir;
gchar *testfile;
gchar *contents;
GError *error = NULL;
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);