glib/tests/meson: Add test programs dependencies to single tests

Various glib tests (such as the spawn ones) depend on local binaries
being built, this may not happen (especially when not using installed
tests), thus ensure such dependencies via the newly added extra_programs
key
This commit is contained in:
Marco Trevisan (Treviño) 2022-10-25 15:46:59 +02:00
parent 495017e2db
commit 82fc49fa10
2 changed files with 24 additions and 4 deletions

View File

@ -118,18 +118,30 @@ glib_tests = {
'spawn-multithreaded' : {
'can_fail': glib_build_static and host_system == 'windows',
'suite': host_system == 'windows' ? ['flaky'] : [],
'extra_programs' : ['test-spawn-echo'] + (
host_machine.system() == 'windows' ? ['test-spawn-sleep'] : []),
},
'spawn-path-search' : {
'extra_programs' : [
'spawn-path-search-helper',
'spawn-test-helper',
'spawn-test-helper-subdir',
],
},
'spawn-path-search' : {},
'spawn-singlethread' : {
'dependencies' : [winsock2],
'extra_programs' : ['test-spawn-echo'],
},
'spawn-test' : {
'can_fail': host_system == 'windows' and cc.get_id() == 'gcc',
'extra_programs' : host_machine.system() == 'windows' ? ['spawn-test-win32-gui'] : [],
},
'strfuncs' : {},
'string' : {},
'strvbuilder' : {},
'testing' : {},
'testing' : {
'extra_programs' : ['testing-helper'],
},
'test-printf' : {},
'thread' : {},
'thread-deprecated' : {},
@ -374,6 +386,7 @@ endif
python_tests = {
'assert-msg-test.py' : {
'can_fail' : host_system == 'windows',
'extra_programs': ['assert-msg-test'],
},
}

View File

@ -31,7 +31,10 @@
#include <sys/types.h>
static char *echo_prog_path;
#ifdef G_OS_WIN32
static char *sleep_prog_path;
#endif
#ifdef G_OS_UNIX
#include <unistd.h>
@ -423,14 +426,15 @@ main (int argc,
dirname = g_path_get_dirname (argv[0]);
echo_prog_path = g_build_filename (dirname, "test-spawn-echo" EXEEXT, NULL);
sleep_prog_path = g_build_filename (dirname, "test-spawn-sleep" EXEEXT, NULL);
g_free (dirname);
g_assert (g_file_test (echo_prog_path, G_FILE_TEST_EXISTS));
#ifdef G_OS_WIN32
sleep_prog_path = g_build_filename (dirname, "test-spawn-sleep" EXEEXT, NULL);
g_assert (g_file_test (sleep_prog_path, G_FILE_TEST_EXISTS));
#endif
g_clear_pointer (&dirname, g_free);
g_test_add_func ("/gthread/spawn-childs", test_spawn_childs);
g_test_add_func ("/gthread/spawn-childs-threads", test_spawn_childs_threads);
g_test_add_func ("/gthread/spawn-sync", test_spawn_sync_multithreaded);
@ -439,7 +443,10 @@ main (int argc,
ret = g_test_run();
g_free (echo_prog_path);
#ifdef G_OS_WIN32
g_free (sleep_prog_path);
#endif
return ret;
}