From 82fc49fa1088ad1e0472bfcfde331d8dcfd1cf02 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marco=20Trevisan=20=28Trevi=C3=B1o=29?= Date: Tue, 25 Oct 2022 15:46:59 +0200 Subject: [PATCH] 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 --- glib/tests/meson.build | 17 +++++++++++++++-- glib/tests/spawn-multithreaded.c | 11 +++++++++-- 2 files changed, 24 insertions(+), 4 deletions(-) diff --git a/glib/tests/meson.build b/glib/tests/meson.build index 3397c9a89..31906b7a3 100644 --- a/glib/tests/meson.build +++ b/glib/tests/meson.build @@ -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'], }, } diff --git a/glib/tests/spawn-multithreaded.c b/glib/tests/spawn-multithreaded.c index 9e399b43d..03f6b892b 100644 --- a/glib/tests/spawn-multithreaded.c +++ b/glib/tests/spawn-multithreaded.c @@ -31,7 +31,10 @@ #include static char *echo_prog_path; + +#ifdef G_OS_WIN32 static char *sleep_prog_path; +#endif #ifdef G_OS_UNIX #include @@ -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; }