1From cd8bf8a4bf881f84c23a5fc1f48bb716efa51512 Mon Sep 17 00:00:00 2001
2From: Patrick Wicki <patrick.wicki@siemens.com>
3Date: Wed, 22 Nov 2023 15:35:44 +0100
4Subject: [PATCH] squid: make squid-conf-tests run on target device
5
6* Fix paths to allow tests to run outside the original builddir
7* Allow the tests to run on read-only root
8  * Don't overwrite tests with true on success
9  * Change logfile path to /var/log
10
11Upstream-Status: Inappropriate [cross compile specific]
12
13Signed-off-by: Patrick Wicki <patrick.wicki@siemens.com>
14
15---
16 test-suite/Makefile.am        | 16 ++++++++--------
17 test-suite/test-squid-conf.sh |  2 +-
18 2 files changed, 9 insertions(+), 9 deletions(-)
19
20--- a/test-suite/Makefile.am
21+++ b/test-suite/Makefile.am
22@@ -21,7 +21,7 @@ LDADD = \
23 EXTRA_PROGRAMS = mem_node_test splay
24
25 EXTRA_DIST = \
26-	$(srcdir)/squidconf/* \
27+	squidconf/* \
28 	test-functionality.sh \
29 	test-sources.sh \
30 	test-squid-conf.sh \
31@@ -134,21 +134,21 @@ VirtualDeleteOperator_SOURCES = \
32
33 installcheck-local: squid-conf-tests
34
35-squid-conf-tests: $(srcdir)/test-squid-conf.sh $(top_builddir)/src/squid.conf.default $(srcdir)/squidconf/*
36-	@failed=0; cfglist="$(top_builddir)/src/squid.conf.default $(srcdir)/squidconf/*.conf"; rm -f $@ || $(TRUE); \
37+squid-conf-tests: test-squid-conf.sh $(top_builddir)/src/squid.conf.default squidconf/*
38+	@failed=0; cfglist="$(top_builddir)/src/squid.conf.default squidconf/*.conf"; rm -f $@ || $(TRUE); \
39 	for cfg in $$cfglist ; do \
40-		$(srcdir)/test-squid-conf.sh $(top_builddir) $(sbindir) $$cfg || \
41+		./test-squid-conf.sh $(top_builddir) $(sbindir) $$cfg || \
42 			{ echo "FAIL: squid.conf test: $$cfg" | \
43 				sed s%$(top_builddir)/src/%% | \
44-				sed s%$(srcdir)/squidconf/%% ; \
45+				sed s%squidconf/%% ; \
46 				failed=1; break; \
47 			}; \
48 		if test "$$failed" -eq 0; then \
49 			echo "PASS: squid.conf test: $$cfg" | \
50 				sed s%$(top_builddir)/src/%% | \
51-				sed s%$(srcdir)/squidconf/%% ; \
52+				sed s%squidconf/%% ; \
53 		else break; fi; \
54 	done; \
55-	if test "$$failed" -eq 0; then cp $(TRUE) $@ ; else exit 1; fi
56+	exit "$$failed"
57
58-CLEANFILES += squid-conf-tests squid-stderr.log
59+CLEANFILES += squid-conf-tests /var/log/squid-stderr.log
60--- a/test-suite/test-squid-conf.sh
61+++ b/test-suite/test-squid-conf.sh
62@@ -111,7 +111,7 @@ then
63     done < $instructionsFile
64 fi
65
66-errorLog="squid-stderr.log"
67+errorLog="/var/log/squid-stderr.log"
68
69 $sbindir/squid -k parse -f $configFile 2> $errorLog
70 result=$?
71