Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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: |
Expand Down
18 changes: 15 additions & 3 deletions test/includes/common.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand All @@ -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 ###
#####################################################
Expand All @@ -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}"
Expand Down
3 changes: 2 additions & 1 deletion test/testsuite.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down
Loading