libtimezonemap/0007-Make-the-test-program-more-automake-y.patch
David Shea 51a02b6c80 Update the map data and improve behavior:
- Render the map directly from SVG (#1335158)
- Fix memory leaks in tz.c
- Fix an invalid memory access
- Do not modify TZ in the process environment
- Move all data files to /usr/share/libtimezonemap from .../libtimezonemap/ui
- Add extra city data so all timezone offsets are clickable
- Move Venezuela from -04:30 to -04:00
- Fix the conversion of points just west of 180 longitude
- Remove the out-of-date Olson map data
- Update the "backward" file
- Improve the location selected when setting the timezone by name (#1322648)
- Remove an extra line in the +10:00 layer
- Move Chile back an hour
2016-06-29 14:56:01 -04:00

83 lines
2.6 KiB
Diff

From ab31d932b5d1b433dc091d688dadf0211f341a9e Mon Sep 17 00:00:00 2001
From: David Shea <dshea@redhat.com>
Date: Fri, 24 Jun 2016 13:45:46 -0400
Subject: [PATCH 07/24] Make the test program more automake-y
Add a $DATADIR environment variable to allow test-timezone to be more
easily run from automake without arguments. Use the various check_* and
TEST variables to define and run the test program.
---
src/Makefile.am | 21 ++++++++++++++-------
src/test-timezone.c | 16 ++++++++++++++--
3 files changed, 31 insertions(+), 9 deletions(-)
diff --git a/src/Makefile.am b/src/Makefile.am
index 9386d1d..9711706 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -24,15 +24,22 @@ AM_CPPFLAGS = \
noinst_PROGRAMS = test-timezone
-test_timezone_SOURCES = test-timezone.c cc-timezone-location.c tz.c tz.h
-test_timezone_LDADD = $(LIBTIMEZONEMAP_LIBS) -lm
+
+all-local: check
+
+AM_TESTS_ENVIRONMENT = TZ_DATA_FILE=$(srcdir)/data/cities15000.txt ; \
+ ADMIN1_FILE=$(srcdir)/data/admin1Codes.txt ; \
+ COUNTRY_FILE=$(srcdir)/data/countryInfo.txt ; \
+ DATADIR=$(srcdir)/data ; \
+ export TZ_DATA_FILE ADMIN1_FILE COUNTRY_FILE DATADIR ;
+
+check_PROGRAMS = test-timezone
+
+test_timezone_SOURCES = test-timezone.c
+test_timezone_LDADD = $(LIBTIMEZONEMAP_LIBS) -lm libtimezonemap.la
test_timezone_CFLAGS = $(LIBTIMEZONEMAP_CFLAGS)
-all-local: check-local
-
-check-local: test-timezone
- TZ_DATA_FILE=$(srcdir)/data/cities15000.txt ADMIN1_FILE=$(srcdir)/data/admin1Codes.txt COUNTRY_FILE=$(srcdir)/data/countryInfo.txt \
- $(builddir)/test-timezone $(srcdir)/data
+TESTS = test-timezone
lib_LTLIBRARIES = libtimezonemap.la
diff --git a/src/test-timezone.c b/src/test-timezone.c
index 504deb9..692c240 100644
--- a/src/test-timezone.c
+++ b/src/test-timezone.c
@@ -15,13 +15,25 @@ int main (int argc, char **argv)
RsvgHandle *svg;
gchar *path;
- setlocale (LC_ALL, "");
+ setlocale (LC_ALL, "");
if (argc == 2)
{
pixmap_dir = g_strdup (argv[1]);
} else if (argc == 1) {
- pixmap_dir = g_strdup ("data/");
+ const char *datadir = g_getenv("DATADIR");
+ if (datadir != NULL)
+ {
+ pixmap_dir = g_strdup (datadir);
+ } else {
+ pixmap_dir = g_strdup ("./data");
+ }
+
+ if (! g_file_test (pixmap_dir, G_FILE_TEST_IS_DIR))
+ {
+ g_message("Pixmap directory %s does not exist", pixmap_dir);
+ return 1;
+ }
} else {
g_message ("Usage: %s [PIXMAP DIRECTORY]", argv[0]);
return 1;
--
2.5.5