diff options
author | Simon McVittie <smcv@debian.org> | 2021-12-27 18:10:25 +0000 |
---|---|---|
committer | Simon McVittie <smcv@debian.org> | 2021-12-27 19:58:08 +0000 |
commit | 67fb9db2d81c8b81aab5da6be081d8cc6712ef62 (patch) | |
tree | 6ff8d5d564ee49df0501e9527aecf8636eafe25b | |
parent | cdc310504e676cec6bda0af435c476edfb31ef5c (diff) | |
download | libsoup-wip/smcv/error-log.tar.gz |
Record Apache error log for unit tests and show it during teardownwip/smcv/error-log
This helps to diagnose problems with the Apache-based tests.
-rw-r--r-- | tests/test-utils.c | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/tests/test-utils.c b/tests/test-utils.c index c2a59dab..04423d1a 100644 --- a/tests/test-utils.c +++ b/tests/test-utils.c @@ -165,7 +165,7 @@ static gboolean apache_cmd (const char *cmd) { GPtrArray *argv; - char *cwd, *pid_file; + char *cwd, *pid_file, *error_log; #ifdef HAVE_APACHE_2_4 char *default_runtime_dir; #endif @@ -184,6 +184,7 @@ apache_cmd (const char *cmd) default_runtime_dir = g_strdup_printf ("DefaultRuntimeDir %s", cwd); #endif pid_file = g_strdup_printf ("PidFile %s/httpd.pid", cwd); + error_log = g_strdup_printf ("ErrorLog %s/error.log", cwd); argv = g_ptr_array_new (); g_ptr_array_add (argv, APACHE_HTTPD); @@ -197,6 +198,8 @@ apache_cmd (const char *cmd) g_ptr_array_add (argv, default_runtime_dir); #endif g_ptr_array_add (argv, "-c"); + g_ptr_array_add (argv, error_log); + g_ptr_array_add (argv, "-c"); g_ptr_array_add (argv, pid_file); g_ptr_array_add (argv, "-k"); @@ -222,6 +225,7 @@ apache_cmd (const char *cmd) g_free (cwd); g_free (pid_file); + g_free (error_log); #ifdef HAVE_APACHE_2_4 g_free (default_runtime_dir); #endif @@ -269,6 +273,11 @@ apache_cleanup (void) g_usleep (100); } + if (g_file_get_contents ("error.log", &contents, NULL, NULL)) { + g_test_message ("error.log contents:\n%s", contents); + g_free (contents); + } + g_clear_pointer (&server_root, g_free); } |