From e5bb24c741bfa4a3be79f8dd5944b452616e5bdd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vladim=C3=ADr=20Chlup?= Date: Fri, 28 Aug 2026 14:26:03 +0200 Subject: [PATCH 1/2] test: Fix DEBUG handling when defined as disabled --- test/includes/common.sh | 18 +++++++++++++++--- test/testsuite.sh | 3 ++- 2 files changed, 17 insertions(+), 4 deletions(-) diff --git a/test/includes/common.sh b/test/includes/common.sh index 6ec14652..1fcbd9bb 100644 --- a/test/includes/common.sh +++ b/test/includes/common.sh @@ -12,7 +12,7 @@ run_test() { else printf "Running %-42s ..." "$1" fi - if [ $DEBUG ]; then + if is_enabled "$DEBUG"; then sh $1 > "logs/${2:-$1}.log" 2>&1 else sh $1 > /dev/null 2>&1 @@ -24,7 +24,7 @@ run_test() { ret=1 fi # preserve httpd's logs too if DEBUG - if [ $DEBUG ]; then + if is_enabled "$DEBUG"; then local httpd_cont=$(docker ps -a | grep $HTTPD_IMG | cut -f 1 -d' ') docker logs $httpd_cont > "logs/${2:-$1}-httpd.log" 2>&1 docker cp ${httpd_cont}:/usr/local/apache2/logs/access_log "logs/${2:-$1}-httpd_access.log" 2> /dev/null || true @@ -35,6 +35,18 @@ run_test() { return $ret } +# This is weird, but the return value must be seemingly +# "inversed" in shell because 0 is a "success" whereas +# non-zero is a failure. +# Empty value and off/no/0 (case insensitive) are treated as disabled. +is_enabled() { + case "$1" in + ""|"0"|[Oo][Ff][Ff]|[Nn][Oo]) + return 1;; + esac + return 0 +} + ##################################################### ### H T T P D H E L P E R F U N C T I O N S ### ##################################################### @@ -61,7 +73,7 @@ httpd_create() { httpd_start() { # if httpd is already running for some reason, end it httpd_remove || true - if [ $DEBUG ]; then + if is_enabled "$DEBUG"; then echo "httpd mod_proxy_cluster image config:" echo " CONF: ${MPC_CONF:-httpd/mod_proxy_cluster.conf}" echo " NAME: ${MPC_NAME:-httpd-mod_proxy_cluster}" diff --git a/test/testsuite.sh b/test/testsuite.sh index 275e3ac6..8ef515e9 100644 --- a/test/testsuite.sh +++ b/test/testsuite.sh @@ -31,6 +31,7 @@ echo " HTTPD_IMG=$HTTPD_IMG" if [ ! -z ${MPC_CONF+x} ]; then echo " MPC_CONF=$MPC_CONF" fi +echo " DEBUG=${DEBUG:-Off (undefined)}" if [ ! -d logs ]; then mkdir logs @@ -44,7 +45,7 @@ if [ ! -d tomcat/target ]; then fi echo -n "Creating docker containers..." -if [ ! -z ${DEBUG+x} ]; then +if is_enabled "$DEBUG"; then httpd_create || exit 2 tomcat_create || exit 3 else From 0bdafbbac2c50032a6155c6637a1f91484b291c7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vladim=C3=ADr=20Chlup?= Date: Mon, 31 Aug 2026 10:15:23 +0200 Subject: [PATCH 2/2] ci: Gather logs only with DEBUG on --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 79a2e057..14c02f22 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -336,7 +336,7 @@ jobs: sh testsuite.sh - name: Preserve test logs uses: actions/upload-artifact@v6 - if: always() + if: ${{ env.DEBUG == 'on' }} with: name: Test logs ${{ matrix.os }} path: |