Commit c33c080c authored by Andrea Azzarone's avatar Andrea Azzarone 🚴

tests: compile gschemas in the build dir

Allow running tests without the need to install the gsettings schemas.
This commit moves all the gschemas in the data directory and compiles
them in the build directory. Tests that require gschemas need to be
launched with the proper GSETTINGS_SCHEMA_DIR env variable.

Fixes: #60
parent 7e109d20
schemas = [
'org.freedesktop.Tracker.DB.gschema.xml',
'org.freedesktop.Tracker.FTS.gschema.xml',
'org.freedesktop.Tracker.gschema.xml',
'org.freedesktop.Tracker.Store.gschema.xml'
]
foreach schema : schemas
schemas = configure_file(
input: schema,
output: schema,
copy: true,
install: true,
install_dir: gsettings_schema_dir)
endforeach
tracker_store_settings_enums = custom_target('tracker-store-settings-enums',
input: '../src/libtracker-common/tracker-enums.h',
output: 'org.freedesktop.Tracker.enums.xml',
command: [glib_mkenums,
'--comments', '<!-- @comment@ -->',
'--fhead', '<schemalist>',
'--vhead', '<@type@ id="org.freedesktop.Tracker.@EnumName@">',
'--vprod', ' <value nick="@valuenick@" value="@valuenum@"/>',
'--vtail', ' </@type@>',
'--ftail', '</schemalist>', '@INPUT@'],
capture: true,
install: true,
install_dir: gsettings_schema_dir)
# for unit tests
custom_target('compile-schemas',
output: 'gschemas.compiled',
command: [find_program('glib-compile-schemas'), meson.current_build_dir()],
build_by_default: true,
depends: tracker_store_settings_enums)
......@@ -327,6 +327,7 @@ typelib_dir = gobject_introspection.get_pkgconfig_variable('typelibdir',
define_variable: [ 'libdir', libdir ])
subdir('src')
subdir('data')
if get_option('docs')
subdir('docs')
......
......@@ -85,6 +85,3 @@ tracker_data_dep = declare_dependency(
include_directories: include_directories('.'),
sources: enums[1],
)
install_data('org.freedesktop.Tracker.DB.gschema.xml',
install_dir: gsettings_schema_dir)
......@@ -21,6 +21,3 @@ tracker_fts_dep = declare_dependency(
link_whole: libtracker_fts,
dependencies: libtracker_fts_dependencies
)
install_data('org.freedesktop.Tracker.FTS.gschema.xml',
install_dir: gsettings_schema_dir)
......@@ -63,25 +63,5 @@ if install_systemd_user_services
install_dir: systemd_user_services_dir)
endif
install_data('org.freedesktop.Tracker.Store.gschema.xml',
install_dir: gsettings_schema_dir)
install_data('org.freedesktop.Tracker.gschema.xml',
install_dir: gsettings_schema_dir)
custom_target('tracker-store-settings-enums',
input: '../libtracker-common/tracker-enums.h',
output: 'org.freedesktop.Tracker.enums.xml',
command: [glib_mkenums,
'--comments', '<!-- @comment@ -->',
'--fhead', '<schemalist>',
'--vhead', '<@type@ id="org.freedesktop.Tracker.@EnumName@">',
'--vprod', ' <value nick="@valuenick@" value="@valuenum@"/>',
'--vtail', ' </@type@>',
'--ftail', '</schemalist>', '@INPUT@'],
capture: true,
install: true,
install_dir: gsettings_schema_dir)
install_data('default.rule',
install_dir: join_paths(get_option('datadir'), 'tracker', 'domain-ontologies'))
......@@ -37,6 +37,7 @@ dconf_profile_full_path = join_paths(meson.current_source_dir(), 'trackertest')
test_env = environment()
test_env.set('DCONF_PROFILE', dconf_profile_full_path)
test_env.set('GSETTINGS_SCHEMA_DIR', join_paths(meson.build_root(), 'data'))
test_env.set('TRACKER_DB_ONTOLOGIES_DIR', tracker_uninstalled_nepomuk_ontologies_dir)
test_env.set('TRACKER_FUNCTIONAL_TEST_BUILD_DIR', build_root)
......
......@@ -13,6 +13,7 @@ libtracker_data_slow_tests = [
libtracker_data_test_environment = environment()
libtracker_data_test_environment.set('TRACKER_LANGUAGE_STOP_WORDS_DIR', '@0@/src/libtracker-common/stop-words'.format(source_root))
libtracker_data_test_environment.set('GSETTINGS_SCHEMA_DIR', join_paths(meson.build_root(), 'data'))
libtracker_data_test_deps = [tracker_common_dep, tracker_data_dep, tracker_sparql_dep]
......
libtracker_fts_test_environment = environment()
libtracker_fts_test_environment.set('GSETTINGS_SCHEMA_DIR', join_paths(meson.build_root(), 'data'))
fts_test = executable('tracker-fts-test',
'tracker-fts-test.c',
dependencies: [tracker_common_dep, tracker_sparql_dep, tracker_data_dep, tracker_testcommon_dep],
c_args: test_c_args
)
test('fts', fts_test)
test('fts', fts_test,
env: libtracker_fts_test_environment)
......@@ -24,6 +24,7 @@ libtracker_miner_test_c_args = [
libtracker_miner_test_environment = environment()
libtracker_miner_test_environment.set('TRACKER_LANGUAGE_STOP_WORDS_DIR', '@0@/src/libtracker-common/stop-words'.format(source_root))
libtracker_miner_test_environment.set('GSETTINGS_SCHEMA_DIR', join_paths(meson.build_root(), 'data'))
libtracker_miner_test_deps = [tracker_common_dep, tracker_miner_dep, tracker_sparql_dep]
......
......@@ -13,6 +13,10 @@ libtracker_sparql_test_deps = [
tracker_common_dep, tracker_sparql_dep
]
libtracker_sparql_test_environment = environment()
libtracker_sparql_test_environment.set('TRACKER_LANGUAGE_STOP_WORDS_DIR', '@0@/src/libtracker-common/stop-words'.format(source_root))
libtracker_sparql_test_environment.set('GSETTINGS_SCHEMA_DIR', join_paths(meson.build_root(), 'data'))
foreach base_name: libtracker_sparql_tests
source = 'tracker-@0@-test.c'.format(base_name)
binary_name = 'tracker-@0@-test'.format(base_name)
......@@ -22,5 +26,6 @@ foreach base_name: libtracker_sparql_tests
dependencies: libtracker_sparql_test_deps,
c_args: libtracker_sparql_test_c_args)
test(test_name, binary)
test(test_name, binary,
env: libtracker_sparql_test_environment)
endforeach
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment