[json-glib] build: Fix up the tests data path



commit 8a91b052fba48ae6f4a61115e2fa6839e7a21509
Author: Emmanuele Bassi <ebassi linux intel com>
Date:   Mon Aug 2 17:45:35 2010 +0100

    build: Fix up the tests data path
    
    Since we load up a test file from a directory, we should be using a
    path - otherwise this will break out-of-tree builds, e.g. when doing
    a distcheck.

 json-glib/tests/Makefile.am   |    2 +-
 json-glib/tests/parser-test.c |    4 ++--
 2 files changed, 3 insertions(+), 3 deletions(-)
---
diff --git a/json-glib/tests/Makefile.am b/json-glib/tests/Makefile.am
index ca3223e..0fef8e9 100644
--- a/json-glib/tests/Makefile.am
+++ b/json-glib/tests/Makefile.am
@@ -8,7 +8,7 @@ INCLUDES = \
 	-I$(top_srcdir)/json-glib	\
 	$(NULL)
 
-AM_CPPFLAGS = $(JSON_DEBUG_CFLAGS)
+AM_CPPFLAGS = $(JSON_DEBUG_CFLAGS) -DTESTS_DATA_DIR=\""$(top_srcdir)/json-glib/tests"\"
 AM_CFLAGS = -g $(JSON_CFLAGS) $(MAINTAINER_CFLAGS)
 
 EXTRA_DIST += stream-load.json
diff --git a/json-glib/tests/parser-test.c b/json-glib/tests/parser-test.c
index 5baba0d..d3f2404 100644
--- a/json-glib/tests/parser-test.c
+++ b/json-glib/tests/parser-test.c
@@ -695,7 +695,7 @@ test_stream_sync (void)
 
   parser = json_parser_new ();
 
-  file = g_file_new_for_path ("stream-load.json");
+  file = g_file_new_for_path (TESTS_DATA_DIR "/stream-load.json");
   stream = g_file_read (file, NULL, &error);
   g_assert (error == NULL);
   g_assert (stream != NULL);
@@ -740,7 +740,7 @@ test_stream_async (void)
   GMainLoop *main_loop;
   GError *error = NULL;
   JsonParser *parser = json_parser_new ();
-  GFile *file = g_file_new_for_path ("stream-load.json");
+  GFile *file = g_file_new_for_path (TESTS_DATA_DIR "/stream-load.json");
   GFileInputStream *stream = g_file_read (file, NULL, &error);
 
   g_assert (error == NULL);



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]