[geocode-glib] tests: Move test C sources into the tests subdirectory
- From: Philip Withnall <pwithnall src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [geocode-glib] tests: Move test C sources into the tests subdirectory
- Date: Tue, 17 Jan 2017 10:42:07 +0000 (UTC)
commit 38e54cfaa0668b52a8351a08d31f66d758f97355
Author: Philip Withnall <philip withnall collabora co uk>
Date: Fri Oct 14 12:12:31 2016 +0100
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
configure.ac | 3 +-
geocode-glib/Makefile.am | 34 +-------------
geocode-glib/tests/Makefile.am | 48 ++++++++++++++++++++
geocode-glib/{test-geouri.c => tests/geo-uri.c} | 0
.../{test-gcglib.c => tests/geocode-glib.c} | 4 +-
geocode-glib/tests/geocode-nominatim-test.c | 2 +-
geocode-glib/tests/geocode-nominatim-test.h | 2 +-
7 files changed, 56 insertions(+), 37 deletions(-)
---
diff --git a/configure.ac b/configure.ac
index 4d8416b..cc0940a 100644
--- a/configure.ac
+++ b/configure.ac
@@ -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
])
diff --git a/geocode-glib/Makefile.am b/geocode-glib/Makefile.am
index 8259c41..00700ff 100644
--- a/geocode-glib/Makefile.am
+++ b/geocode-glib/Makefile.am
@@ -1,5 +1,7 @@
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 += \
diff --git a/geocode-glib/tests/Makefile.am b/geocode-glib/tests/Makefile.am
new file mode 100644
index 0000000..6c51e84
--- /dev/null
+++ b/geocode-glib/tests/Makefile.am
@@ -0,0 +1,48 @@
+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
diff --git a/geocode-glib/test-geouri.c b/geocode-glib/tests/geo-uri.c
similarity index 100%
rename from geocode-glib/test-geouri.c
rename to geocode-glib/tests/geo-uri.c
diff --git a/geocode-glib/test-gcglib.c b/geocode-glib/tests/geocode-glib.c
similarity index 99%
rename from geocode-glib/test-gcglib.c
rename to geocode-glib/tests/geocode-glib.c
index 82a1a98..cdef599 100644
--- a/geocode-glib/test-gcglib.c
+++ b/geocode-glib/tests/geocode-glib.c
@@ -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);
diff --git a/geocode-glib/tests/geocode-nominatim-test.c b/geocode-glib/tests/geocode-nominatim-test.c
index a054517..3a819a9 100644
--- a/geocode-glib/tests/geocode-nominatim-test.c
+++ b/geocode-glib/tests/geocode-nominatim-test.c
@@ -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 {
diff --git a/geocode-glib/tests/geocode-nominatim-test.h b/geocode-glib/tests/geocode-nominatim-test.h
index 9f6c606..566881c 100644
--- a/geocode-glib/tests/geocode-nominatim-test.h
+++ b/geocode-glib/tests/geocode-nominatim-test.h
@@ -26,7 +26,7 @@
#include <glib.h>
#include <gio/gio.h>
-#include "geocode-nominatim.h"
+#include "geocode-glib/geocode-nominatim.h"
G_BEGIN_DECLS
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]