summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSimon McVittie <smcv@debian.org>2016-05-17 09:26:31 +0100
committerAlexander Larsson <alexl@redhat.com>2016-05-17 17:57:24 +0200
commit513f795c6593ba2009b12e8e6031360d4154aa4f (patch)
tree5a1c410e58cf37a6e02606b18de913d5e8922259
parenta7a49065a77d5c7a4ebda63966c04343f942b2c4 (diff)
downloadxdg-app-513f795c6593ba2009b12e8e6031360d4154aa4f.tar.gz
testdb: rely on G_TEST_SRCDIR to find databases
Signed-off-by: Simon McVittie <smcv@debian.org>
-rw-r--r--tests/Makefile.am.inc8
-rw-r--r--tests/testdb.c6
2 files changed, 8 insertions, 6 deletions
diff --git a/tests/Makefile.am.inc b/tests/Makefile.am.inc
index aa801e4..9fe5682 100644
--- a/tests/Makefile.am.inc
+++ b/tests/Makefile.am.inc
@@ -7,7 +7,7 @@ TESTS_ENVIRONMENT += OT_TESTS_DEBUG=1 \
PATH=$$(cd $(top_builddir) && pwd):$${PATH} \
$(NULL)
-testdb_CFLAGS = $(BASE_CFLAGS) -DDB_DIR=\"$(abs_srcdir)/tests/dbs\"
+testdb_CFLAGS = $(BASE_CFLAGS)
testdb_LDADD = \
$(BASE_LIBS) \
$(OSTREE_LIBS) \
@@ -75,13 +75,15 @@ installed_test_data = \
tests/session.conf.in \
$(NULL)
-if ENABLE_INSTALLED_TESTS
installed_test_keyringdir = $(installed_testdir)/test-keyring
+installed_test_dbsdir = $(installed_testdir)/dbs
+
+if ENABLE_INSTALLED_TESTS
installed_test_keyring_DATA = \
tests/test-keyring/pubring.gpg \
tests/test-keyring/secring.gpg \
$(NULL)
-
+installed_test_dbs_DATA = tests/dbs/no_tables
endif
EXTRA_DIST += $(installed_test_SCRIPTS) $(installed_test_data)
diff --git a/tests/testdb.c b/tests/testdb.c
index d1f2f5f..92d2bd8 100644
--- a/tests/testdb.c
+++ b/tests/testdb.c
@@ -156,18 +156,18 @@ test_db_open (void)
GError *error = NULL;
FlatpakDb *db;
- db = flatpak_db_new (DB_DIR "/does_not_exist", TRUE, &error);
+ db = flatpak_db_new (g_test_get_filename (G_TEST_DIST, "dbs", "does_not_exist", NULL), TRUE, &error);
g_assert_error (error, G_FILE_ERROR, G_FILE_ERROR_NOENT);
g_assert (db == NULL);
g_clear_error (&error);
- db = flatpak_db_new (DB_DIR "/does_not_exist", FALSE, &error);
+ db = flatpak_db_new (g_test_get_filename (G_TEST_DIST, "dbs", "does_not_exist", NULL), FALSE, &error);
g_assert_no_error (error);
g_assert (db != NULL);
g_clear_error (&error);
g_object_unref (db);
- db = flatpak_db_new (DB_DIR "/no_tables", TRUE, &error);
+ db = flatpak_db_new (g_test_get_filename (G_TEST_DIST, "dbs", "no_tables", NULL), TRUE, &error);
g_assert_error (error, G_FILE_ERROR, G_FILE_ERROR_INVAL);
g_assert (db == NULL);
g_clear_error (&error);