Merge branch '436-test-coredumps' into 'master'

Fix tests creating coredumps

Closes #436

See merge request GNOME/glib!959
This commit is contained in:
Emmanuele Bassi 2019-07-25 13:49:09 +00:00
commit 17be9e5c4c
4 changed files with 41 additions and 20 deletions

View File

@ -2518,34 +2518,43 @@ prepend_terminal_to_vector (int *argc,
term_argv = g_new0 (char *, 3); term_argv = g_new0 (char *, 3);
check = g_find_program_in_path ("gnome-terminal"); check = g_find_program_in_path ("gnome-terminal");
if (check == NULL)
check = g_find_program_in_path ("mate-terminal");
if (check == NULL)
check = g_find_program_in_path ("xfce4-terminal");
if (check != NULL) if (check != NULL)
{ {
term_argv[0] = check; term_argv[0] = check;
/* Note that gnome-terminal takes -x and /* Since 2017, gnome-terminal has preferred `--` over `-x` or `-e`. */
* as -e in gnome-terminal is broken we use that. */ term_argv[1] = g_strdup ("--");
term_argv[1] = g_strdup ("-x");
} }
else else
{ {
if (check == NULL) if (check == NULL)
check = g_find_program_in_path ("nxterm"); check = g_find_program_in_path ("mate-terminal");
if (check == NULL)
check = g_find_program_in_path ("color-xterm");
if (check == NULL)
check = g_find_program_in_path ("rxvt");
if (check == NULL)
check = g_find_program_in_path ("dtterm");
if (check == NULL) if (check == NULL)
check = g_find_program_in_path ("xfce4-terminal");
if (check != NULL)
{ {
check = g_strdup ("xterm"); term_argv[0] = check;
g_debug ("Couldnt find a terminal: falling back to xterm"); /* Note that gnome-terminal takes -x and
* as -e in gnome-terminal is broken we use that. */
term_argv[1] = g_strdup ("-x");
}
else
{
if (check == NULL)
check = g_find_program_in_path ("nxterm");
if (check == NULL)
check = g_find_program_in_path ("color-xterm");
if (check == NULL)
check = g_find_program_in_path ("rxvt");
if (check == NULL)
check = g_find_program_in_path ("dtterm");
if (check == NULL)
{
check = g_strdup ("xterm");
g_debug ("Couldnt find a terminal: falling back to xterm");
}
term_argv[0] = check;
term_argv[1] = g_strdup ("-e");
} }
term_argv[0] = check;
term_argv[1] = g_strdup ("-e");
} }
real_argc = term_argc + *argc; real_argc = term_argc + *argc;

View File

@ -9,7 +9,7 @@ Comment=GAppInfo example
Comment[de]=GAppInfo Beispiel Comment[de]=GAppInfo Beispiel
Exec=@installed_tests_dir@/appinfo-test --option %U %i --name %c --filename %k %m %% Exec=@installed_tests_dir@/appinfo-test --option %U %i --name %c --filename %k %m %%
Icon=testicon.svg Icon=testicon.svg
Terminal=true Terminal=false
StartupNotify=true StartupNotify=true
StartupWMClass=appinfo-class StartupWMClass=appinfo-class
MimeType=image/png;image/jpeg; MimeType=image/png;image/jpeg;

View File

@ -87,7 +87,7 @@ test_launch_no_app_id (void)
"Comment=GAppInfo example\n" "Comment=GAppInfo example\n"
"Comment[de]=GAppInfo Beispiel\n" "Comment[de]=GAppInfo Beispiel\n"
"Icon=testicon.svg\n" "Icon=testicon.svg\n"
"Terminal=true\n" "Terminal=false\n"
"StartupNotify=true\n" "StartupNotify=true\n"
"StartupWMClass=appinfo-class\n" "StartupWMClass=appinfo-class\n"
"MimeType=image/png;image/jpeg;\n" "MimeType=image/png;image/jpeg;\n"

View File

@ -3323,6 +3323,18 @@ g_test_trap_fork (guint64 usec_timeout,
close (stdout_pipe[1]); close (stdout_pipe[1]);
if (stderr_pipe[1] >= 3) if (stderr_pipe[1] >= 3)
close (stderr_pipe[1]); close (stderr_pipe[1]);
/* We typically expect these child processes to crash, and some
* tests spawn a *lot* of them. Avoid spamming system crash
* collection programs such as systemd-coredump and abrt.
*/
#ifdef HAVE_SYS_RESOURCE_H
{
struct rlimit limit = { 0, 0 };
(void) setrlimit (RLIMIT_CORE, &limit);
}
#endif
return TRUE; return TRUE;
} }
else /* parent */ else /* parent */