diff options
Diffstat (limited to 'glib/tests/spawn-multithreaded.c')
-rw-r--r-- | glib/tests/spawn-multithreaded.c | 21 |
1 files changed, 15 insertions, 6 deletions
diff --git a/glib/tests/spawn-multithreaded.c b/glib/tests/spawn-multithreaded.c index 8dbc7bfbb..a138e61e3 100644 --- a/glib/tests/spawn-multithreaded.c +++ b/glib/tests/spawn-multithreaded.c @@ -1,6 +1,8 @@ /* * Copyright (C) 2011 Red Hat, Inc. * + * SPDX-License-Identifier: LicenseRef-old-glib-tests + * * This work is provided "as is"; redistribution and modification * in whole or in part, in any medium, physical or electronic is * permitted without restriction. @@ -31,7 +33,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> @@ -157,9 +162,9 @@ test_spawn_childs (void) main_loop = g_main_loop_new (NULL, FALSE); #ifdef G_OS_WIN32 - system ("cd ."); + g_assert_no_errno (system ("cd .")); #else - system ("true"); + g_assert_no_errno (system ("true")); #endif n_alive = 2; @@ -200,9 +205,9 @@ test_spawn_childs_threads (void) main_loop = g_main_loop_new (NULL, FALSE); #ifdef G_OS_WIN32 - system ("cd ."); + g_assert_no_errno (system ("cd .")); #else - system ("true"); + g_assert_no_errno (system ("true")); #endif n_alive = 2; @@ -423,14 +428,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 +445,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; } |