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:
committed by
Georges Basile Stavracas Neto
parent
edbb4e5b86
commit
11fb4717a2
+37
-11
@@ -1,17 +1,32 @@
|
|||||||
subdir('icons')
|
subdir('icons')
|
||||||
subdir('appdata')
|
subdir('appdata')
|
||||||
|
|
||||||
|
enum_headers = files(join_paths(src_dir, 'gcal-enums.h'))
|
||||||
|
|
||||||
|
enums_xml = gnome.mkenums(
|
||||||
|
'org.gnome.calendar.enums.xml',
|
||||||
|
sources: enum_headers,
|
||||||
|
comments: '<!-- @comment@ -->',
|
||||||
|
fhead: '<schemalist>',
|
||||||
|
vhead: ' <@type@ id="org.gnome.calendar.@EnumName@">',
|
||||||
|
vprod: ' <value nick="@valuenick@" value="@valuenum@"/>',
|
||||||
|
vtail: ' </@type@>',
|
||||||
|
ftail: '</schemalist>',
|
||||||
|
install_header: true,
|
||||||
|
install_dir: calendar_schemadir
|
||||||
|
)
|
||||||
|
|
||||||
# Desktop files
|
# Desktop files
|
||||||
# Note: This name is registered in gcal-weather-service.c.
|
# Note: This name is registered in gcal-weather-service.c.
|
||||||
desktop = 'org.gnome.Calendar.desktop'
|
desktop = 'org.gnome.Calendar.desktop'
|
||||||
|
|
||||||
i18n.merge_file(
|
i18n.merge_file(
|
||||||
desktop,
|
desktop,
|
||||||
type: 'desktop',
|
type: 'desktop',
|
||||||
input: desktop + '.in',
|
input: desktop + '.in',
|
||||||
output: desktop,
|
output: desktop,
|
||||||
po_dir: po_dir,
|
po_dir: po_dir,
|
||||||
install: true,
|
install: true,
|
||||||
install_dir: join_paths(calendar_datadir, 'applications')
|
install_dir: join_paths(calendar_datadir, 'applications')
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -27,7 +42,7 @@ schema_conf.set('GETTEXT_PACKAGE', meson.project_name())
|
|||||||
|
|
||||||
schema = 'org.gnome.calendar.gschema.xml'
|
schema = 'org.gnome.calendar.gschema.xml'
|
||||||
|
|
||||||
configure_file(
|
schema_xml = configure_file(
|
||||||
input: schema + '.in',
|
input: schema + '.in',
|
||||||
output: schema,
|
output: schema,
|
||||||
install: true,
|
install: true,
|
||||||
@@ -35,6 +50,17 @@ configure_file(
|
|||||||
configuration: schema_conf
|
configuration: schema_conf
|
||||||
)
|
)
|
||||||
|
|
||||||
|
output = 'gschemas.compiled'
|
||||||
|
|
||||||
|
# for unit tests - gnome.compile_schemas() only looks in srcdir
|
||||||
|
compiled_schemas = custom_target(
|
||||||
|
output,
|
||||||
|
input: schema_xml,
|
||||||
|
output: output,
|
||||||
|
command: [find_program('glib-compile-schemas'), meson.current_build_dir()],
|
||||||
|
depends: enums_xml
|
||||||
|
)
|
||||||
|
|
||||||
# DBus service files
|
# DBus service files
|
||||||
service_conf = configuration_data()
|
service_conf = configuration_data()
|
||||||
service_conf.set('bindir', calendar_bindir)
|
service_conf.set('bindir', calendar_bindir)
|
||||||
@@ -42,10 +68,10 @@ service_conf.set('bindir', calendar_bindir)
|
|||||||
service = 'org.gnome.Calendar.service'
|
service = 'org.gnome.Calendar.service'
|
||||||
|
|
||||||
configure_file(
|
configure_file(
|
||||||
input: service + '.in',
|
input: service + '.in',
|
||||||
output: service,
|
output: service,
|
||||||
install: true,
|
install: true,
|
||||||
install_dir: join_paths(calendar_datadir, 'dbus-1', 'services'),
|
install_dir: join_paths(calendar_datadir, 'dbus-1', 'services'),
|
||||||
configuration: service_conf
|
configuration: service_conf
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
@@ -136,6 +136,7 @@ top_inc = include_directories('.')
|
|||||||
|
|
||||||
data_dir = join_paths(meson.source_root(), 'data')
|
data_dir = join_paths(meson.source_root(), 'data')
|
||||||
po_dir = join_paths(meson.source_root(), 'po')
|
po_dir = join_paths(meson.source_root(), 'po')
|
||||||
|
src_dir = join_paths(meson.source_root(), 'src')
|
||||||
|
|
||||||
|
|
||||||
###########
|
###########
|
||||||
|
|||||||
@@ -1,7 +1,5 @@
|
|||||||
src_inc = include_directories('.')
|
src_inc = include_directories('.')
|
||||||
|
|
||||||
enum_headers = files('gcal-enums.h')
|
|
||||||
|
|
||||||
gcal_deps = [
|
gcal_deps = [
|
||||||
gsettings_desktop_schemas_dep,
|
gsettings_desktop_schemas_dep,
|
||||||
libedataserverui_dep,
|
libedataserverui_dep,
|
||||||
@@ -56,19 +54,6 @@ sources = files(
|
|||||||
'gcal-timer.c'
|
'gcal-timer.c'
|
||||||
)
|
)
|
||||||
|
|
||||||
gnome.mkenums(
|
|
||||||
'org.gnome.calendar.enums.xml',
|
|
||||||
sources: enum_headers,
|
|
||||||
comments: '<!-- @comment@ -->',
|
|
||||||
fhead: '<schemalist>',
|
|
||||||
vhead: ' <@type@ id="org.gnome.calendar.@EnumName@">',
|
|
||||||
vprod: ' <value nick="@valuenick@" value="@valuenum@"/>',
|
|
||||||
vtail: ' </@type@>',
|
|
||||||
ftail: '</schemalist>',
|
|
||||||
install_header: true,
|
|
||||||
install_dir: calendar_schemadir
|
|
||||||
)
|
|
||||||
|
|
||||||
enum_types = 'gcal-enum-types'
|
enum_types = 'gcal-enum-types'
|
||||||
|
|
||||||
sources += gnome.mkenums(
|
sources += gnome.mkenums(
|
||||||
|
|||||||
+18
-11
@@ -1,19 +1,26 @@
|
|||||||
test_incs = [
|
test_deps = gcal_deps + [ libgcal_dep ]
|
||||||
include_directories('.'),
|
|
||||||
src_inc
|
|
||||||
]
|
|
||||||
|
|
||||||
tests_deps = gcal_deps + [ libgcal_dep ]
|
|
||||||
|
|
||||||
###########
|
###########
|
||||||
# Manager #
|
# 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 = executable(
|
||||||
'test-manager',
|
test_unit,
|
||||||
'test-manager.c',
|
[test_unit + '.c', compiled_schemas],
|
||||||
dependencies: tests_deps,
|
c_args: test_cflags,
|
||||||
include_directories: test_incs
|
dependencies: test_deps
|
||||||
)
|
)
|
||||||
|
|
||||||
test('test-manager', test_manager)
|
test(test_unit, test_manager, env: test_env)
|
||||||
|
|||||||
Reference in New Issue
Block a user