tests: Avoid chdir() call at the start of appinfo tests

By encoding the path to the appinfo-test binary in the .desktop files,
we can avoid a chdir() call in the tests, which was a bit ugly.

Signed-off-by: Philip Withnall <withnall@endlessm.com>

https://gitlab.gnome.org/GNOME/glib/issues/538
This commit is contained in:
Philip Withnall
2018-11-30 17:20:48 +00:00
parent aee897bd89
commit 46f47641c5
9 changed files with 83 additions and 47 deletions

View File

@@ -395,15 +395,35 @@ if host_machine.system() != 'windows'
}
endif
appinfo_test_desktop_files = [
'appinfo-test-gnome.desktop',
'appinfo-test-notgnome.desktop',
'appinfo-test.desktop',
'appinfo-test2.desktop',
]
cdata = configuration_data()
if installed_tests_enabled
cdata.set('installed_tests_dir', installed_tests_execdir)
else
cdata.set('installed_tests_dir', meson.current_build_dir())
endif
foreach appinfo_test_desktop_file : appinfo_test_desktop_files
configure_file(
input: appinfo_test_desktop_file + '.in',
output: appinfo_test_desktop_file,
install_dir: installed_tests_execdir,
install: installed_tests_enabled,
configuration: cdata,
)
endforeach
if installed_tests_enabled
install_data(
'contexts.c',
'g-icon.c',
'appinfo-test-actions.desktop',
'appinfo-test-gnome.desktop',
'appinfo-test-notgnome.desktop',
'appinfo-test.desktop',
'appinfo-test2.desktop',
'file.c',
'org.gtk.test.dbusappinfo.desktop',
install_dir : installed_tests_execdir,