From 7d891d9dd4acbaedc5b2a2f95445a1e93fd1529f Mon Sep 17 00:00:00 2001 From: Emmanuele Bassi Date: Wed, 4 Nov 2009 11:47:09 +0000 Subject: [PATCH] tests: Allow getting data files from the tests/data directory The units under the conformance test suite should be able to use external files. Linking the files in tests/conform like the interactive tests do seems like a hack piled on top of a hack, so instead we should provide a programmatic way for a conformance test unit to get the full path of a file, regardless of where the tests/data directory is. We can use a define to get the full path of tests/data and then a function using g_build_filename() to construct the path to the file we want. --- tests/conform/Makefile.am | 16 ++++++++++------ tests/conform/test-conform-common.h | 1 + tests/conform/test-conform-main.c | 6 ++++++ 3 files changed, 17 insertions(+), 6 deletions(-) diff --git a/tests/conform/Makefile.am b/tests/conform/Makefile.am index a2cb54d27..9983db31c 100644 --- a/tests/conform/Makefile.am +++ b/tests/conform/Makefile.am @@ -71,17 +71,21 @@ clean-wrappers: # a phony rule that will generate symlink scripts for running individual tests BUILT_SOURCES = wrappers -test_conformance_CFLAGS = \ +INCLUDES = \ -I$(top_srcdir)/ \ -I$(top_srcdir)/clutter \ -I$(top_srcdir)/clutter/cogl \ -I$(top_builddir)/clutter \ - -I$(top_builddir)/clutter/cogl \ - -DG_DISABLE_SINGLE_INCLUDES \ - $(CLUTTER_CFLAGS) \ - $(MAINTAINER_CFLAGS) + -I$(top_builddir)/clutter/cogl -test_conformance_LDADD = $(top_builddir)/clutter/libclutter-@CLUTTER_WINSYS@-@CLUTTER_API_VERSION@.la +test_conformance_CPPFLAGS = \ + -DG_DISABLE_SINGLE_INCLUDES \ + -DCLUTTER_DISABLE_DEPRECATED \ + -DTESTS_DATADIR=\""$(top_srcdir)/tests/data"\" + +test_conformance_CFLAGS = $(CLUTTER_CFLAGS) $(MAINTAINER_CFLAGS) + +test_conformance_LDADD = $(top_builddir)/clutter/libclutter-@CLUTTER_WINSYS@-@CLUTTER_API_VERSION@.la $(CLUTTER_LIBS) .PHONY: test .PHONY: test-report test-report-normal test-report-disable-npots diff --git a/tests/conform/test-conform-common.h b/tests/conform/test-conform-common.h index d3de09977..a220e8f7a 100644 --- a/tests/conform/test-conform-common.h +++ b/tests/conform/test-conform-common.h @@ -24,3 +24,4 @@ void test_conform_simple_fixture_setup (TestConformSimpleFixture *fixture, void test_conform_simple_fixture_teardown (TestConformSimpleFixture *fixture, gconstpointer data); +gchar *clutter_test_get_data_file (const gchar *filename); diff --git a/tests/conform/test-conform-main.c b/tests/conform/test-conform-main.c index 88b7abfc5..315af74cf 100644 --- a/tests/conform/test-conform-main.c +++ b/tests/conform/test-conform-main.c @@ -59,6 +59,12 @@ static TestConformSharedState *shared_state = NULL; test_conform_skip_test, \ test_conform_simple_fixture_teardown); } G_STMT_END +gchar * +clutter_test_get_data_file (const gchar *filename) +{ + return g_build_filename (TESTS_DATADIR, filename, NULL); +} + static void clutter_test_init (gint *argc, gchar ***argv)