tests: Fix GCalManager test

The unit test that checks GCalManager test fails due to missing
schemas.

This patch allows schemas to be compiled in the build tree and also
sets the environment variables so tests can found them and run
properly.

Additional code and testing from Mohammed Sadiq <sadiq@sadiqpk.org>
This commit is contained in:
Iñigo Martínez
2018-02-11 23:17:12 +00:00
committed by Georges Basile Stavracas Neto
parent edbb4e5b86
commit 11fb4717a2
4 changed files with 56 additions and 37 deletions
+18 -11
View File
@@ -1,19 +1,26 @@
test_incs = [
include_directories('.'),
src_inc
]
tests_deps = gcal_deps + [ libgcal_dep ]
test_deps = gcal_deps + [ libgcal_dep ]
###########
# Manager #
###########
test_env = [
'G_TEST_SRCDIR=' + meson.current_source_dir(),
'G_TEST_BUILDDIR=' + meson.current_build_dir(),
'GSETTINGS_SCHEMA_DIR=' + join_paths(meson.build_root(), 'data'),
'GSETTINGS_BACKEND=memory',
'MALLOC_CHECK_=2'
]
test_cflags = '-DTEST_DATA_DIR="@0@"'.format(join_paths(meson.source_root(), 'data'))
test_unit = 'test-manager'
test_manager = executable(
'test-manager',
'test-manager.c',
dependencies: tests_deps,
include_directories: test_incs
test_unit,
[test_unit + '.c', compiled_schemas],
c_args: test_cflags,
dependencies: test_deps
)
test('test-manager', test_manager)
test(test_unit, test_manager, env: test_env)