summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorSimon McVittie <smcv@debian.org>2021-12-27 16:24:55 +0000
committerPatrick Griffis <pgriffis@igalia.com>2022-01-01 19:03:13 +0000
commit2bf112c9a21ac2db30ec8cb15601d6da1fd2eacf (patch)
treecb5f2861ee0e2001cadbee099de71c1d0f9c322d /tests
parent6edbb6b8cc0c4878f210743cd920c5a6a6258ce2 (diff)
downloadlibsoup-2bf112c9a21ac2db30ec8cb15601d6da1fd2eacf.tar.gz
test-utils: Log Apache arguments
This helped to diagnose a use-after-free bug in the unit tests. Signed-off-by: Simon McVittie <smcv@debian.org>
Diffstat (limited to 'tests')
-rw-r--r--tests/test-utils.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/tests/test-utils.c b/tests/test-utils.c
index 89782ef5..38ff8bc3 100644
--- a/tests/test-utils.c
+++ b/tests/test-utils.c
@@ -170,6 +170,8 @@ apache_cmd (const char *cmd)
#endif
int status;
gboolean ok;
+ GString *str;
+ guint i;
server_root = soup_test_build_filename_abs (G_TEST_BUILT, "", NULL);
@@ -197,6 +199,18 @@ apache_cmd (const char *cmd)
g_ptr_array_add (argv, (char *)cmd);
g_ptr_array_add (argv, NULL);
+ str = g_string_new ("Apache command:");
+
+ for (i = 0; i < argv->len - 1; i++) {
+ char *escaped = g_shell_quote (argv->pdata[i]);
+ g_string_append_c (str, ' ');
+ g_string_append (str, escaped);
+ g_free (escaped);
+ }
+
+ g_test_message ("%s", str->str);
+ g_string_free (str, TRUE);
+
ok = g_spawn_sync (cwd, (char **)argv->pdata, NULL, 0, NULL, NULL,
NULL, NULL, &status, NULL);
if (ok)
@@ -210,6 +224,7 @@ apache_cmd (const char *cmd)
#endif
g_ptr_array_free (argv, TRUE);
+ g_test_message (ok ? "-> success" : "-> failed");
return ok;
}