Commit 38e54cfa authored by Philip Withnall's avatar Philip Withnall Committed by Philip Withnall
Browse files

tests: Move test C sources into the tests subdirectory

This improves tab-completion in the source directory, and means all the
test code is in one directory. Split the build configuration for them
out into a separate makefile, in preparation for adding installed-tests
support there.

https://bugzilla.gnome.org/show_bug.cgi?id=772928
parent befbd2fa
......@@ -10,7 +10,7 @@ AC_INIT([geocode-glib],
[geocode-glib])
AX_IS_RELEASE([git-directory])
AC_CONFIG_SRCDIR([geocode-glib/test-gcglib.c])
AC_CONFIG_SRCDIR([geocode-glib/geocode-glib.c])
AC_CONFIG_HEADERS([config.h])
AC_CONFIG_MACRO_DIR([m4])
......@@ -82,6 +82,7 @@ AC_CONFIG_FILES([
docs/Makefile
docs/version.xml
geocode-glib/Makefile
geocode-glib/tests/Makefile
po/Makefile.in
icons/Makefile
])
......
include $(top_srcdir)/Makefile.decl
SUBDIRS = . tests
EXTRA_DIST = geocode-glib.symbols
BUILT_GIRSOURCES =
......@@ -111,38 +113,6 @@ CLEANFILES += $(gir_DATA) $(typelib_DATA)
endif # HAVE_INTROSPECTION
TESTS = test-geouri test-gcglib
noinst_PROGRAMS = $(TESTS)
TESTS_ENVIRONMENT = \
G_TEST_SRCDIR="$(abs_srcdir)" \
G_TEST_BUILDDIR="$(abs_builddir)" \
G_DEBUG=gc-friendly \
MALLOC_CHECK_=2 \
MALLOC_PERTURB_=$$(($${RANDOM:-256} % 256))
test_gcglib_SOURCES = \
tests/geocode-nominatim-test.h \
tests/geocode-nominatim-test.c \
test-gcglib.c
test_geouri_LDADD = libgeocode-glib.la $(GEOCODE_LIBS)
test_gcglib_LDADD = libgeocode-glib.la $(GEOCODE_LIBS)
EXTRA_DIST += \
tests/locale_format.json \
tests/locale_name.json \
tests/osm_type0.json \
tests/osm_type1.json \
tests/osm_type2.json \
tests/pub.json \
tests/rev.json \
tests/rev_fail.json \
tests/search.json \
tests/search_lat_long.json \
tests/xep.json \
$(NULL)
MAINTAINERCLEANFILES = Makefile.in
EXTRA_DIST += \
......
TESTS = geo-uri geocode-glib
noinst_PROGRAMS = $(TESTS)
TESTS_ENVIRONMENT = \
G_TEST_SRCDIR="$(abs_srcdir)" \
G_TEST_BUILDDIR="$(abs_builddir)" \
G_DEBUG=gc-friendly \
MALLOC_CHECK_=2 \
MALLOC_PERTURB_=$$(($${RANDOM:-256} % 256))
AM_CPPFLAGS = \
-I$(top_srcdir) \
-I$(top_builddir) \
-DTEST_SRCDIR=\""$(srcdir)/../data/"\" \
$(NULL)
AM_CFLAGS = \
$(GEOCODE_CFLAGS) \
$(WARN_CFLAGS) \
$(NULL)
AM_LDFLAGS = \
$(WARN_LDFLAGS) \
$(NULL)
geocode_glib_SOURCES = \
geocode-nominatim-test.h \
geocode-nominatim-test.c \
geocode-glib.c
geo_uri_LDADD = $(top_builddir)/geocode-glib/libgeocode-glib.la $(GEOCODE_LIBS)
geocode_glib_LDADD = $(top_builddir)/geocode-glib/libgeocode-glib.la $(GEOCODE_LIBS)
EXTRA_DIST = \
locale_format.json \
locale_name.json \
osm_type0.json \
osm_type1.json \
osm_type2.json \
pub.json \
rev.json \
rev_fail.json \
search.json \
search_lat_long.json \
xep.json \
$(NULL)
-include $(top_srcdir)/git.mk
......@@ -163,7 +163,7 @@ load_json (const gchar *expected_response_filename)
g_autofree gchar *expected_response_path = NULL;
g_autoptr (GError) error = NULL;
expected_response_path = g_test_build_filename (G_TEST_DIST, "tests",
expected_response_path = g_test_build_filename (G_TEST_DIST,
expected_response_filename,
NULL);
g_file_get_contents (expected_response_path, &expected_response, NULL,
......@@ -930,7 +930,7 @@ int main (int argc, char **argv)
loc = new_loc ();
if (loc == NULL) {
g_print ("Options parsing failed: Use for example\n"
"test-gcglib --reverse -- 51.237070 -0.589669\n");
"%s --reverse -- 51.237070 -0.589669\n", argv[0]);
return 1;
}
print_loc (loc);
......
......@@ -23,7 +23,7 @@
#include <glib.h>
#include <libsoup/soup.h>
#include "geocode-glib.h"
#include "geocode-glib/geocode-glib.h"
#include "geocode-nominatim-test.h"
struct _GeocodeNominatimTest {
......
......@@ -26,7 +26,7 @@
#include <glib.h>
#include <gio/gio.h>
#include "geocode-nominatim.h"
#include "geocode-glib/geocode-nominatim.h"
G_BEGIN_DECLS
......
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