From 17ce3ed9130ce1e643f38321bb4a6698fd5b0ecc Mon Sep 17 00:00:00 2001 From: Michael James Gratton Date: Mon, 9 Jan 2017 09:14:31 +1100 Subject: [PATCH] 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(+) diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index a90dc6a5..d1d96e4f 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 ff99b023..0d26e21b 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. */