diff options
author | Simon McVittie <smcv@debian.org> | 2021-12-27 16:24:55 +0000 |
---|---|---|
committer | Simon McVittie <smcv@debian.org> | 2021-12-27 18:16:41 +0000 |
commit | 6013057ade56e308f6d68d0f64bb152f1edddaca (patch) | |
tree | 0589da5e25c2407c6ab6e0f01e34992867f5575b | |
parent | e9c34927c7e444bc1e272d7c98583758068997e4 (diff) | |
download | libsoup-6013057ade56e308f6d68d0f64bb152f1edddaca.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>
-rw-r--r-- | tests/test-utils.c | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/tests/test-utils.c b/tests/test-utils.c index 923394d0..64f09ad6 100644 --- a/tests/test-utils.c +++ b/tests/test-utils.c @@ -156,6 +156,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); @@ -183,6 +185,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) @@ -196,6 +210,7 @@ apache_cmd (const char *cmd) #endif g_ptr_array_free (argv, TRUE); + g_test_message (ok ? "-> success" : "-> failed"); return ok; } |