Patrick Williams | da29531 | 2023-12-05 16:48:56 -0600 | [diff] [blame] | 1 | From cd8bf8a4bf881f84c23a5fc1f48bb716efa51512 Mon Sep 17 00:00:00 2001 |
| 2 | From: Patrick Wicki <patrick.wicki@siemens.com> |
| 3 | Date: Wed, 22 Nov 2023 15:35:44 +0100 |
| 4 | Subject: [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 | |
| 11 | Upstream-Status: Inappropriate [cross compile specific] |
| 12 | |
| 13 | Signed-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 | diff --git a/test-suite/Makefile.am b/test-suite/Makefile.am |
| 21 | index 8becdbc..eccd49c 100644 |
| 22 | --- a/test-suite/Makefile.am |
| 23 | +++ b/test-suite/Makefile.am |
| 24 | @@ -21,7 +21,7 @@ LDADD = \ |
| 25 | EXTRA_PROGRAMS = mem_node_test splay |
| 26 | |
| 27 | EXTRA_DIST = \ |
| 28 | - $(srcdir)/squidconf/* \ |
| 29 | + squidconf/* \ |
| 30 | test-functionality.sh \ |
| 31 | test-sources.sh \ |
| 32 | test-squid-conf.sh \ |
| 33 | @@ -134,21 +134,21 @@ VirtualDeleteOperator_SOURCES = \ |
| 34 | |
| 35 | installcheck-local: squid-conf-tests |
| 36 | |
| 37 | -squid-conf-tests: $(srcdir)/test-squid-conf.sh $(top_builddir)/src/squid.conf.default $(srcdir)/squidconf/* |
| 38 | - @failed=0; cfglist="$(top_builddir)/src/squid.conf.default $(srcdir)/squidconf/*.conf"; rm -f $@ || $(TRUE); \ |
| 39 | +squid-conf-tests: test-squid-conf.sh $(top_builddir)/src/squid.conf.default squidconf/* |
| 40 | + @failed=0; cfglist="$(top_builddir)/src/squid.conf.default squidconf/*.conf"; rm -f $@ || $(TRUE); \ |
| 41 | for cfg in $$cfglist ; do \ |
| 42 | - $(srcdir)/test-squid-conf.sh $(top_builddir) $(sbindir) $$cfg || \ |
| 43 | + ./test-squid-conf.sh $(top_builddir) $(sbindir) $$cfg || \ |
| 44 | { echo "FAIL: squid.conf test: $$cfg" | \ |
| 45 | sed s%$(top_builddir)/src/%% | \ |
| 46 | - sed s%$(srcdir)/squidconf/%% ; \ |
| 47 | + sed s%squidconf/%% ; \ |
| 48 | failed=1; break; \ |
| 49 | }; \ |
| 50 | if test "$$failed" -eq 0; then \ |
| 51 | echo "PASS: squid.conf test: $$cfg" | \ |
| 52 | sed s%$(top_builddir)/src/%% | \ |
| 53 | - sed s%$(srcdir)/squidconf/%% ; \ |
| 54 | + sed s%squidconf/%% ; \ |
| 55 | else break; fi; \ |
| 56 | done; \ |
| 57 | - if test "$$failed" -eq 0; then cp $(TRUE) $@ ; else exit 1; fi |
| 58 | + exit "$$failed" |
| 59 | |
| 60 | -CLEANFILES += squid-conf-tests squid-stderr.log |
| 61 | +CLEANFILES += squid-conf-tests /var/log/squid-stderr.log |
| 62 | diff --git a/test-suite/test-squid-conf.sh b/test-suite/test-squid-conf.sh |
| 63 | index 05fcaf3..a5a8a5a 100755 |
| 64 | --- a/test-suite/test-squid-conf.sh |
| 65 | +++ b/test-suite/test-squid-conf.sh |
| 66 | @@ -111,7 +111,7 @@ then |
| 67 | done < $instructionsFile |
| 68 | fi |
| 69 | |
| 70 | -errorLog="squid-stderr.log" |
| 71 | +errorLog="/var/log/squid-stderr.log" |
| 72 | |
| 73 | $sbindir/squid -k parse -f $configFile 2> $errorLog |
| 74 | result=$? |