summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorRyan Lortie <desrt@desrt.ca>2012-07-08 21:47:23 -0400
committerRyan Lortie <desrt@desrt.ca>2012-07-08 21:47:23 -0400
commitd56a9ce678101d6dc66e0d322d5f33e04bbc98fc (patch)
tree8a3e37f9faa37b27c5f762775367fe03d92b1364 /tests
parent792a13279603b2533961a48b778514c805ef39cd (diff)
downloaddconf-d56a9ce678101d6dc66e0d322d5f33e04bbc98fc.tar.gz
massive Makefile reorganisation
Clean up the Makefiles and make them as similar as possible. Move CFLAGS to a common point of definition and stop using -I so much. Replace the 'dbus stub' with libdconf-mock.a in tests/. Fill in some stubs for future mock code for shm and gvdb (just to get things compiling for now).
Diffstat (limited to 'tests')
-rw-r--r--tests/.gitignore2
-rw-r--r--tests/Makefile.am130
-rw-r--r--tests/changeset.c2
-rw-r--r--tests/client.c4
-rw-r--r--tests/dbus.c2
-rw-r--r--tests/dbus1.c2
-rw-r--r--tests/dconf-mock-dbus.c (renamed from tests/dconf-dbus-stub.c)2
-rw-r--r--tests/dconf-mock-gvdb.c49
-rw-r--r--tests/dconf-mock-shm.c13
-rw-r--r--tests/engine.c4
-rw-r--r--tests/gvdb.c2
-rw-r--r--tests/paths.c2
-rw-r--r--tests/shm.c4
-rw-r--r--tests/tmpdir.c2
14 files changed, 146 insertions, 74 deletions
diff --git a/tests/.gitignore b/tests/.gitignore
index cb7d423..bada923 100644
--- a/tests/.gitignore
+++ b/tests/.gitignore
@@ -1,4 +1,4 @@
-libdconf-dbus-stub.a
+libdconf-mock.a
changeset
client
diff --git a/tests/Makefile.am b/tests/Makefile.am
index 53142f7..a4be908 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -1,88 +1,98 @@
include $(top_srcdir)/Makefile.gtester
-AM_CFLAGS = -Wall -Wmissing-prototypes -Wwrite-strings -DSRCDIR=\"$(abs_srcdir)\"
-INCLUDES = -I$(top_srcdir)/common -I$(top_srcdir)/engine -I$(top_srcdir)/client $(gio_CFLAGS) -I$(top_srcdir)/dbus-1 $(dbus_CFLAGS) -I$(top_srcdir)/gvdb -I$(top_srcdir)/shm
-
-noinst_LIBRARIES = libdconf-dbus-stub.a
+noinst_LIBRARIES = libdconf-mock.a
noinst_PROGRAMS = $(TEST_PROGS) gsettings dbus1
+libdconf_mock_a_CFLAGS = $(glib_CFLAGS)
+libdconf_mock_a_SOURCES = \
+ dconf-mock-dbus.c \
+ dconf-mock-gvdb.c \
+ dconf-mock-shm.c
+
+gsettings_CFLAGS = $(gio_CFLAGS)
gsettings_LDADD = $(gio_LIBS)
+dbus1_CFLAGS = $(glib_CFLAGS) $(dbus_CFLAGS)
dbus1_LDADD = -L../dbus-1 -ldconf-dbus-1 $(glib_LIBS)
TEST_PROGS += paths
-paths_LDADD = ../common/libdconf-common.a $(gio_LIBS)
+paths_CFLAGS = $(glib_CFLAGS)
+paths_LDADD = \
+ ../common/libdconf-common.a \
+ $(gio_LIBS)
paths_SOURCES = paths.c
TEST_PROGS += changeset
-changeset_LDADD = ../common/libdconf-common.a $(glib_LIBS)
+changeset_CFLAGS = $(glib_CFLAGS)
+changeset_LDADD = \
+ ../common/libdconf-common.a \
+ $(glib_LIBS)
changeset_SOURCES = changeset.c
TEST_PROGS += shm
-shm_LDADD = ../shm/libdconf-shm.a $(glib_LIBS) -ldl
-shm_SOURCES = shm.c tmpdir.h tmpdir.c
-
-engine_LIBS = \
- ../engine/libdconf-engine.a \
- ../shm/libdconf-shm.a \
- ../common/libdconf-common.a
-
-engine_with_stub_LIBS = \
- $(engine_LIBS) \
- libdconf-dbus-stub.a
-
-client_LIBS = \
- ../client/libdconf-client.a \
- $(engine_LIBS) \
- ../gdbus/libdconf-gdbus.a
-
-stub_client_LIBS = \
- ../client/libdconf-client.a \
- $(engine_with_stub_LIBS)
-
-libdconf_dbus_stub_a_SOURCES = \
- dconf-dbus-stub.c
+shm_CFLAGS = $(glib_CFLAGS)
+shm_LDADD = \
+ ../shm/libdconf-shm.a \
+ $(glib_LIBS) \
+ -ldl
+shm_SOURCES = \
+ shm.c \
+ tmpdir.h \
+ tmpdir.c
TEST_PROGS += gvdb
-gvdb_LDADD = $(glib_LIBS)
-gvdb_SOURCES = \
- ../gvdb/gvdb-reader.c \
- gvdb.c
+gvdb_CFLAGS = $(glib_CFLAGS) -DSRCDIR=\"$(abs_srcdir)\"
+gvdb_LDADD = \
+ ../gvdb/libgvdb.a \
+ $(glib_LIBS)
+gvdb_SOURCES = gvdb.c
EXTRA_DIST = \
- gvdbs/empty_gvdb \
- gvdbs/example_gvdb \
- gvdbs/example_gvdb.big-endian \
- gvdbs/file_empty \
- gvdbs/file_too_small \
- gvdbs/invalid_header \
+ gvdbs/empty_gvdb \
+ gvdbs/example_gvdb \
+ gvdbs/example_gvdb.big-endian \
+ gvdbs/file_empty \
+ gvdbs/file_too_small \
+ gvdbs/invalid_header \
gvdbs/nested_gvdb
TEST_PROGS += gdbus-thread
-gdbus_thread_CFLAGS = $(AM_CFLAGS) -DDBUS_BACKEND=\"/gdbus/thread\"
-gdbus_thread_LDADD = $(gio_LIBS)
-gdbus_thread_SOURCES = \
- ../gdbus/dconf-gdbus-thread.c \
- dbus.c
+gdbus_thread_CFLAGS = $(gio_CFLAGS) -DDBUS_BACKEND=\"/gdbus/thread\"
+gdbus_thread_LDADD = \
+ ../gdbus/libdconf-gdbus-thread.a \
+ $(gio_LIBS)
+gdbus_thread_SOURCES = dbus.c
TEST_PROGS += gdbus-filter
-gdbus_filter_CFLAGS = $(AM_CFLAGS) -DDBUS_BACKEND=\"/gdbus/filter\"
-gdbus_filter_LDADD = $(gio_LIBS)
-gdbus_filter_SOURCES = \
- ../gdbus/dconf-gdbus-filter.c \
- dbus.c
+gdbus_filter_CFLAGS = $(gio_CFLAGS) -DDBUS_BACKEND=\"/gdbus/filter\"
+gdbus_filter_LDADD = \
+ ../gdbus/libdconf-gdbus-filter.a \
+ $(gio_LIBS)
+gdbus_filter_SOURCES = dbus.c
TEST_PROGS += engine
-engine_LDADD = $(engine_with_stub_LIBS) $(glib_LIBS) -ldl
+engine_CFLAGS = $(glib_CFLAGS) -DSRCDIR=\"$(abs_srcdir)\"
+engine_LDADD = \
+ ../engine/libdconf-engine.a \
+ ../common/libdconf-common.a \
+ libdconf-mock.a \
+ $(glib_LIBS) \
+ -ldl
engine_SOURCES = engine.c
+EXTRA_DIST += \
+ profile/broken-profile \
+ profile/colourful \
+ profile/dos \
+ profile/empty-profile \
+ profile/many-sources \
+ profile/no-newline-longline \
+ profile/test-profile \
+ profile/will-never-exist
TEST_PROGS += client
-client_LDADD = $(stub_client_LIBS) $(gio_LIBS)
+client_CFLAGS = $(gio_CFLAGS) -DSRCDIR=\"$(abs_srcdir)\"
+client_LDADD = \
+ ../client/libdconf-client.a \
+ ../engine/libdconf-engine.a \
+ ../common/libdconf-common.a \
+ libdconf-mock.a \
+ $(gio_LIBS)
client_SOURCES = client.c
-EXTRA_DIST += \
- profile/broken-profile \
- profile/colourful \
- profile/dos \
- profile/empty-profile \
- profile/many-sources \
- profile/no-newline-longline \
- profile/test-profile \
- profile/will-never-exist
diff --git a/tests/changeset.c b/tests/changeset.c
index 744a8e2..17d77fa 100644
--- a/tests/changeset.c
+++ b/tests/changeset.c
@@ -1,4 +1,4 @@
-#include <dconf-changeset.h>
+#include "../common/dconf-changeset.h"
static gboolean
should_not_run (const gchar *key,
diff --git a/tests/client.c b/tests/client.c
index 1891db4..ad0115d 100644
--- a/tests/client.c
+++ b/tests/client.c
@@ -1,6 +1,6 @@
#define _BSD_SOURCE
-#include <dconf-client.h>
-#include <dconf-engine.h>
+#include "../client/dconf-client.h"
+#include "../engine/dconf-engine.h"
#include <string.h>
#include <stdlib.h>
diff --git a/tests/dbus.c b/tests/dbus.c
index e227266..8f813a8 100644
--- a/tests/dbus.c
+++ b/tests/dbus.c
@@ -5,7 +5,7 @@
/* Test the DBus communicaton code.
*/
-#include "dconf-engine.h"
+#include "../engine/dconf-engine.h"
static gboolean okay_in_main;
static GThread *main_thread;
diff --git a/tests/dbus1.c b/tests/dbus1.c
index 1220160..9bb2d7a 100644
--- a/tests/dbus1.c
+++ b/tests/dbus1.c
@@ -17,7 +17,7 @@
* Author: Ryan Lortie <desrt@desrt.ca>
**/
-#include <dconf-dbus-1.h>
+#include "../dbus-1/dconf-dbus-1.h"
#include <stdbool.h>
#include <unistd.h>
diff --git a/tests/dconf-dbus-stub.c b/tests/dconf-mock-dbus.c
index 7e34f98..772e9ed 100644
--- a/tests/dconf-dbus-stub.c
+++ b/tests/dconf-mock-dbus.c
@@ -19,7 +19,7 @@
* Author: Ryan Lortie <desrt@desrt.ca>
*/
-#include "dconf-engine.h"
+#include "../engine/dconf-engine.h"
GQueue outstanding_call_handles;
diff --git a/tests/dconf-mock-gvdb.c b/tests/dconf-mock-gvdb.c
new file mode 100644
index 0000000..96695ad
--- /dev/null
+++ b/tests/dconf-mock-gvdb.c
@@ -0,0 +1,49 @@
+#include "../gvdb/gvdb-reader.h"
+
+void
+gvdb_table_unref (GvdbTable *table)
+{
+}
+
+GvdbTable *
+gvdb_table_get_table (GvdbTable *table,
+ const gchar *key)
+{
+ return NULL;
+}
+
+gboolean
+gvdb_table_has_value (GvdbTable *table,
+ const gchar *key)
+{
+ return FALSE;
+}
+
+GVariant *
+gvdb_table_get_value (GvdbTable *table,
+ const gchar *key)
+{
+ return NULL;
+}
+
+gchar **
+gvdb_table_list (GvdbTable *table,
+ const gchar *key)
+{
+ return NULL;
+}
+
+GvdbTable *
+gvdb_table_new (const gchar *filename,
+ gboolean trusted,
+ GError **error)
+{
+ g_set_error_literal (error, G_FILE_ERROR, G_FILE_ERROR_FAILED, "not implemented");
+ return NULL;
+}
+
+gboolean
+gvdb_table_is_valid (GvdbTable *table)
+{
+ return TRUE;
+}
diff --git a/tests/dconf-mock-shm.c b/tests/dconf-mock-shm.c
new file mode 100644
index 0000000..e9edb1c
--- /dev/null
+++ b/tests/dconf-mock-shm.c
@@ -0,0 +1,13 @@
+#include "../shm/dconf-shm.h"
+
+guint8 *
+dconf_shm_open (const gchar *name)
+{
+ return g_malloc0 (1);
+}
+
+void
+dconf_shm_close (guint8 *shm)
+{
+ g_free (shm);
+}
diff --git a/tests/engine.c b/tests/engine.c
index cb01cda..50d8362 100644
--- a/tests/engine.c
+++ b/tests/engine.c
@@ -1,7 +1,7 @@
#define _GNU_SOURCE
-#include <dconf-engine.h>
-#include <dconf-engine-profile.h>
+#include "../engine/dconf-engine.h"
+#include "../engine/dconf-engine-profile.h"
#include <stdlib.h>
#include <stdio.h>
#include <dlfcn.h>
diff --git a/tests/gvdb.c b/tests/gvdb.c
index 35a16a2..47b2b51 100644
--- a/tests/gvdb.c
+++ b/tests/gvdb.c
@@ -1,5 +1,5 @@
#include <glib.h>
-#include "gvdb-reader.h"
+#include "../gvdb/gvdb-reader.h"
static void
test_reader_open_error (void)
diff --git a/tests/paths.c b/tests/paths.c
index 7395515..57eede2 100644
--- a/tests/paths.c
+++ b/tests/paths.c
@@ -1,4 +1,4 @@
-#include <dconf-paths.h>
+#include "../common/dconf-paths.h"
static void
test_paths (void)
diff --git a/tests/shm.c b/tests/shm.c
index cb60560..3d8b385 100644
--- a/tests/shm.c
+++ b/tests/shm.c
@@ -1,5 +1,5 @@
#define _GNU_SOURCE
-#include <dconf-paths.h>
+#include "../common/dconf-paths.h"
#include <glib/gstdio.h>
#include <sys/stat.h>
#include <stdlib.h>
@@ -8,7 +8,7 @@
#include <errno.h>
#include <dlfcn.h>
-#include "dconf-shm.h"
+#include "../shm/dconf-shm.h"
#include "tmpdir.h"
static void
diff --git a/tests/tmpdir.c b/tests/tmpdir.c
index 405d37b..b72d646 100644
--- a/tests/tmpdir.c
+++ b/tests/tmpdir.c
@@ -1,7 +1,7 @@
#include "tmpdir.h"
#include <glib/gstdio.h>
-#include <dconf-paths.h>
+#include "../common/dconf-paths.h"
#include <string.h>
gchar *