[geary] Fix GSetttings schema error running tests. Bug 776837.
- From: Michael Gratton <mjog src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [geary] Fix GSetttings schema error running tests. Bug 776837.
- Date: Sun, 8 Jan 2017 22:15:08 +0000 (UTC)
commit 17ce3ed9130ce1e643f38321bb4a6698fd5b0ecc
Author: Michael James Gratton <mike vee net>
Date: Mon Jan 9 09:14:31 2017 +1100
Fix GSetttings schema error running tests. Bug 776837.
* test/main.vala (main): Set the location of the compiled dev schema
before running any tests.
* test/CMakeLists.txt: Pass location of compiled GSettings schema through
to the test source. Depend on the geary binary so things like the
shcema are already compiled before compiling the tests.
test/CMakeLists.txt | 4 ++++
test/main.vala | 6 ++++++
2 files changed, 10 insertions(+), 0 deletions(-)
---
diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt
index a90dc6a..d1d96e4 100644
--- a/test/CMakeLists.txt
+++ b/test/CMakeLists.txt
@@ -47,6 +47,7 @@ set(CFLAGS
${DEPS_CFLAGS}
${DEPS_CFLAGS_OTHER}
-D_BUILD_ROOT_DIR=\"${CMAKE_BINARY_DIR}\"
+ -D_GSETTINGS_DIR=\"${CMAKE_BINARY_DIR}/gsettings\"
-D_SOURCE_ROOT_DIR=\"${CMAKE_SOURCE_DIR}\"
)
@@ -78,4 +79,7 @@ OPTIONS
)
add_executable(geary-test ${TEST_VALA_C})
+# Depend on geary so things like GResources, GSetting, etc are
+# compiled before the tests are built and run.
+add_dependencies(geary-test geary)
target_link_libraries(geary-test ${DEPS_LIBRARIES} geary-client geary-engine)
diff --git a/test/main.vala b/test/main.vala
index ff99b02..0d26e21 100644
--- a/test/main.vala
+++ b/test/main.vala
@@ -5,6 +5,9 @@
* (version 2.1 or later). See the COPYING file in this distribution.
*/
+// Defined by CMake build script.
+extern const string _GSETTINGS_DIR;
+
int main(string[] args) {
/*
* Set env vars right up front to avoid weird bugs
@@ -14,6 +17,9 @@ int main(string[] args) {
// values, and b) don't persist any changes made during a test
Environment.set_variable("GSETTINGS_BACKEND", "memory", true);
+ // Let GSettings know where to find the dev schema
+ Environment.set_variable("GSETTINGS_SCHEMA_DIR", _GSETTINGS_DIR, true);
+
/*
* Initialise all the things.
*/
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]