File: Record-Apache-error-log-for-unit-tests-and-show-it-during.patch

package info (click to toggle)
libsoup3 3.6.5-4
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 7,316 kB
  • sloc: ansic: 61,968; python: 202; xml: 97; sh: 84; makefile: 33; javascript: 5
file content (59 lines) | stat: -rw-r--r-- 1,685 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
From: Simon McVittie <smcv@debian.org>
Date: Mon, 27 Dec 2021 18:10:25 +0000
Subject: Record Apache error log for unit tests and show it during teardown

This helps to diagnose problems with the Apache-based tests.
---
 tests/test-utils.c | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)

diff --git a/tests/test-utils.c b/tests/test-utils.c
index d29d117..bf977ed 100644
--- a/tests/test-utils.c
+++ b/tests/test-utils.c
@@ -164,7 +164,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
@@ -183,6 +183,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);
@@ -195,6 +196,8 @@ apache_cmd (const char *cmd)
 	g_ptr_array_add (argv, "-c");
 	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);
 
@@ -221,6 +224,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
@@ -268,6 +272,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);
 }