From 16cb4822dffc4615b0fa9b60b6866202eeb5d6ad Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vladim=C3=ADr=20Chlup?= Date: Mon, 6 Jan 2025 11:10:44 +0100 Subject: [PATCH 01/20] test: Add custom flags support for HTTPD container --- test/httpd/Containerfile | 18 ++++++++++-------- test/httpd/run.sh | 3 --- 2 files changed, 10 insertions(+), 11 deletions(-) diff --git a/test/httpd/Containerfile b/test/httpd/Containerfile index 17ff736ba..559f88121 100644 --- a/test/httpd/Containerfile +++ b/test/httpd/Containerfile @@ -1,11 +1,18 @@ FROM fedora:41 ARG HTTPD_SOURCES="https://dlcdn.apache.org/httpd/httpd-2.4.63.tar.gz" +ARG CFLAGS="" +ARG LFLAGS="" +ARG HTTPD_DEFAULT_FLAGS="--enable-proxy --enable-proxy-http --enable-proxy-ajp --enable-proxy-wstunnel --enable-proxy-hcheck --with-port=8000" +ARG HTTPD_EXTRA_FLAGS="" -RUN yum install gcc wget apr-devel apr-util-devel openssl-devel pcre-devel redhat-rpm-config wcstools git autoconf -y +RUN yum install gcc wget apr-devel apr-util-devel openssl-devel pcre-devel redhat-rpm-config wcstools git autoconf gcovr -y ENV CONF=httpd/mod_proxy_cluster.conf ENV HTTPD=${HTTPD_SOURCES} +ENV CFLAGS="${CFLAGS}" +ENV LDFLAGS="${LDFLAGS}" +ENV HTTPD_FLAGS="${HTTPD_DEFAULT_FLAGS} ${HTTPD_EXTRA_FLAGS}" # make sure you have copy of the local repository at place # (our function "httpd_create" takes care of that) @@ -17,12 +24,7 @@ RUN mkdir httpd RUN tar xvf $(filename $HTTPD) --strip 1 -C httpd RUN ls WORKDIR /httpd -RUN ./configure --enable-proxy \ - --enable-proxy-http \ - --enable-proxy-ajp \ - --enable-proxy-wstunnel \ - --enable-proxy-hcheck \ - --with-port=8000 +RUN ./configure ${HTTPD_FLAGS} RUN make RUN make install @@ -37,7 +39,7 @@ RUN for m in advertise mod_proxy_cluster balancers mod_manager; \ ./configure --with-apxs=/usr/local/apache2/bin/apxs; \ make clean; \ make || exit 1; \ - cp *.so /usr/local/apache2/modules; \ + for f in *.so; do ln -s "$PWD/$f" /usr/local/apache2/modules/$f; done; \ cd $OLDPWD; \ done; diff --git a/test/httpd/run.sh b/test/httpd/run.sh index 0579e7642..88789cf7e 100755 --- a/test/httpd/run.sh +++ b/test/httpd/run.sh @@ -1,8 +1,5 @@ #!/bin/sh -pwd -ls -lt - # wget and copy the prepared conf file and include it cd /test/ if [ -f $CONF ]; then From 25f61cc15fb762e20e76b0610f8c18105d6c9e58 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vladim=C3=ADr=20Chlup?= Date: Mon, 6 Jan 2025 11:14:29 +0100 Subject: [PATCH 02/20] test: Add support for custom httpd flags to the testsuite --- test/includes/common.sh | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/test/includes/common.sh b/test/includes/common.sh index 919405530..12d7db36a 100644 --- a/test/includes/common.sh +++ b/test/includes/common.sh @@ -29,6 +29,7 @@ run_test() { 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 fi + # Clean all after run httpd_remove > /dev/null 2>&1 tomcat_all_remove > /dev/null 2>&1 @@ -54,7 +55,11 @@ httpd_create() { done cp -r ../native ../test /tmp/mod_proxy_cluster/ mv /tmp/mod_proxy_cluster httpd/ - docker build -t $HTTPD_IMG -f httpd/Containerfile httpd/ + + docker build -t $HTTPD_IMG --build-arg CFLAGS="$MPC_CFLAGS" \ + --build-arg LDFLAGS="$MPC_LDFLAGS" \ + --build-arg HTTPD_EXTRA_FLAGS="$HTTPD_EXTRA_FLAGS" \ + -f httpd/Containerfile httpd/ } # Build and run httpd container From ea591b5feaf983e43a2ea8747305860813e8fb36 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vladim=C3=ADr=20Chlup?= Date: Mon, 6 Jan 2025 12:34:54 +0100 Subject: [PATCH 03/20] test: Add coverage support into the testsuite Through CODE_COVERAGE variable --- test/httpd/run.sh | 2 ++ test/includes/common.sh | 23 +++++++++++++++++++++-- test/testsuite.sh | 22 ++++++++++++++++++++++ 3 files changed, 45 insertions(+), 2 deletions(-) diff --git a/test/httpd/run.sh b/test/httpd/run.sh index 88789cf7e..117dc7efc 100755 --- a/test/httpd/run.sh +++ b/test/httpd/run.sh @@ -11,6 +11,8 @@ else exit 1 fi +mkdir /coverage + # start apache httpd server in foreground echo "Starting httpd..." /usr/local/apache2/bin/apachectl start diff --git a/test/includes/common.sh b/test/includes/common.sh index 12d7db36a..5f833301c 100644 --- a/test/includes/common.sh +++ b/test/includes/common.sh @@ -4,6 +4,12 @@ IMG=${IMG:-mod_proxy_cluster-testsuite-tomcat} HTTPD_IMG=${HTTPD_IMG:-mod_proxy_cluster-testsuite-httpd} MPC_NAME=${MPC_NAME:-httpd-mod_proxy_cluster} +if [ $CODE_COVERAGE ]; then + MPC_CFLAGS="$MPC_CFLAGS --coverage -fprofile-arcs -ftest-coverage -g -O0" + MPC_LDFLAGS="$MPC_LDFLAGS -lgcov" + HTTPD_EXTRA_FLAGS="$HTTPD_EXTRA_FLAGS --enable-debugger-mode" +fi + # Runs a test file ($1) under given name ($2, if given) run_test() { local ret=0 @@ -23,13 +29,26 @@ run_test() { echo " NOK" ret=1 fi + + local httpd_cont=$(docker ps -a | grep $HTTPD_IMG | cut -f 1 -d' ') # preserve httpd's logs too if DEBUG if [ $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 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 fi + if [ $CODE_COVERAGE ]; then + docker exec ${httpd_cont} /usr/local/apache2/bin/apachectl stop + # preserve the coverage files + # docker has problems with names containing spaces + f=$(echo ${2:-1} | sed 's/ /-/g') + docker exec ${httpd_cont} sh -c "cd /native; gcovr --gcov-ignore-errors=no_working_dir_found --json /coverage/coverage-$f.json" + + for f in $(docker exec ${httpd_cont} ls /coverage/); do + docker cp -q ${httpd_cont}:/coverage/$f $PWD/coverage/$f + done + fi + # Clean all after run httpd_remove > /dev/null 2>&1 tomcat_all_remove > /dev/null 2>&1 diff --git a/test/testsuite.sh b/test/testsuite.sh index de307743b..abfc89f62 100644 --- a/test/testsuite.sh +++ b/test/testsuite.sh @@ -36,6 +36,14 @@ if [ ! -d logs ]; then mkdir logs fi +if [ $CODE_COVERAGE ]; then + if [ ! -d coverage ]; then + mkdir coverage + fi + + rm coverage/* +fi + . includes/common.sh if [ ! -d tomcat/target ]; then @@ -114,4 +122,18 @@ else res=1 fi +# if we're interessed in code coverage, run an httpd container with the already obtained +# coverage files and generate the report from within the container with all the sources +if [ $CODE_COVERAGE ]; then + echo "Generating test coverage..." + httpd_start > /dev/null 2>&1 + docker exec $MPC_NAME /usr/local/apache2/bin/apachectl stop + for f in $(ls coverage/*.json); do + docker cp -q $f $MPC_NAME:/coverage/ + done + docker exec $MPC_NAME sh -c 'cd /native; gcovr --add-tracefile "/coverage/coverage-*.json" --html-details /coverage/test-coverage.html' + docker cp $MPC_NAME:/coverage/ . + httpd_remove +fi + exit $res From c1d8d8742f33d16a9005a182931499cf3df7a378 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vladim=C3=ADr=20Chlup?= Date: Mon, 6 Jan 2025 12:35:35 +0100 Subject: [PATCH 04/20] Add coverage directory to gitignore --- .gitignore | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/.gitignore b/.gitignore index 3092828bf..c7665aa2c 100644 --- a/.gitignore +++ b/.gitignore @@ -36,6 +36,12 @@ test/httpd/mod_proxy_cluster # Log files **/*.log +# Coverage files +test/coverage/ +*.gcno +*.gcda +*.gcov + # build files *.slo *.so From 65341c825a35dfa2dd320ad6ef372518c8a556c3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vladim=C3=ADr=20Chlup?= Date: Tue, 14 Jan 2025 10:34:48 +0100 Subject: [PATCH 05/20] ci: Generate coverage report for the testsuite Install gcc package that provides gcovr --- .github/workflows/ci.yml | 12 ++++++++++-- test/testsuite.sh | 3 +++ 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 7a5471963..0d038ab0e 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -233,6 +233,7 @@ jobs: FOREVER_PAUSE: 100 ITERATION_COUNT: 2 TOMCAT_CYCLE_COUNT: 2 + CODE_COVERAGE: 1 steps: - name: Checkout uses: actions/checkout@v4 @@ -259,9 +260,16 @@ jobs: if: always() with: name: Test logs - path: | - test/logs/* + path: test/logs/* retention-days: 7 + # Preserve coverage data if defined + - name: Preserve coverage files + if: env.CODE_COVERAGE + uses: actions/upload-artifact@v4 + with: + name: Coverage + path: test/coverage/* + retention-days: 7 perl-tests: runs-on: ubuntu-latest diff --git a/test/testsuite.sh b/test/testsuite.sh index abfc89f62..51f562b8d 100644 --- a/test/testsuite.sh +++ b/test/testsuite.sh @@ -128,11 +128,14 @@ if [ $CODE_COVERAGE ]; then echo "Generating test coverage..." httpd_start > /dev/null 2>&1 docker exec $MPC_NAME /usr/local/apache2/bin/apachectl stop + for f in $(ls coverage/*.json); do docker cp -q $f $MPC_NAME:/coverage/ done + docker exec $MPC_NAME sh -c 'cd /native; gcovr --add-tracefile "/coverage/coverage-*.json" --html-details /coverage/test-coverage.html' docker cp $MPC_NAME:/coverage/ . + httpd_remove fi From a7e507751f4c280ea9918013683f052496222393 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vladim=C3=ADr=20Chlup?= Date: Tue, 14 Jan 2025 09:51:13 +0100 Subject: [PATCH 06/20] test: Fix testsuite.sh indentation, clean test/logs/ before each run --- test/testsuite.sh | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/test/testsuite.sh b/test/testsuite.sh index 51f562b8d..30ca46d44 100644 --- a/test/testsuite.sh +++ b/test/testsuite.sh @@ -34,6 +34,7 @@ fi if [ ! -d logs ]; then mkdir logs + rm logs/* fi if [ $CODE_COVERAGE ]; then @@ -53,11 +54,11 @@ fi echo -n "Creating docker containers..." if [ ! -z ${DEBUG+x} ]; then - httpd_create || exit 2 - tomcat_create || exit 3 + httpd_create || exit 2 + tomcat_create || exit 3 else - httpd_create > /dev/null 2>&1 || exit 2 - tomcat_create > /dev/null 2>&1 || exit 3 + httpd_create > /dev/null 2>&1 || exit 2 + tomcat_create > /dev/null 2>&1 || exit 3 fi echo " Done" From 7f8961e9748c4c5455b4c9be23aee6b48b4226f0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vladim=C3=ADr=20Chlup?= Date: Tue, 14 Jan 2025 11:26:20 +0100 Subject: [PATCH 07/20] test: Use log files for gcovr output, redirect docker cp output to /dev/null This is necessary because `podman cp` doesn't know `-q` flag --- test/includes/common.sh | 4 ++-- test/testsuite.sh | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/test/includes/common.sh b/test/includes/common.sh index 5f833301c..77a6e682a 100644 --- a/test/includes/common.sh +++ b/test/includes/common.sh @@ -42,10 +42,10 @@ run_test() { # preserve the coverage files # docker has problems with names containing spaces f=$(echo ${2:-1} | sed 's/ /-/g') - docker exec ${httpd_cont} sh -c "cd /native; gcovr --gcov-ignore-errors=no_working_dir_found --json /coverage/coverage-$f.json" + docker exec ${httpd_cont} sh -c "cd /native; gcovr --gcov-ignore-errors=no_working_dir_found --json /coverage/coverage-$f.json > /coverage/coverage-$f.log 2>&1" for f in $(docker exec ${httpd_cont} ls /coverage/); do - docker cp -q ${httpd_cont}:/coverage/$f $PWD/coverage/$f + docker cp ${httpd_cont}:/coverage/$f $PWD/coverage/$f > /dev/null done fi diff --git a/test/testsuite.sh b/test/testsuite.sh index 30ca46d44..c28e9ed20 100644 --- a/test/testsuite.sh +++ b/test/testsuite.sh @@ -131,11 +131,11 @@ if [ $CODE_COVERAGE ]; then docker exec $MPC_NAME /usr/local/apache2/bin/apachectl stop for f in $(ls coverage/*.json); do - docker cp -q $f $MPC_NAME:/coverage/ + docker cp $f $MPC_NAME:/coverage/ > /dev/null done - docker exec $MPC_NAME sh -c 'cd /native; gcovr --add-tracefile "/coverage/coverage-*.json" --html-details /coverage/test-coverage.html' - docker cp $MPC_NAME:/coverage/ . + docker exec $MPC_NAME sh -c 'cd /native; gcovr --add-tracefile "/coverage/coverage-*.json" --html-details /coverage/test-coverage.html > /coverage/test-coverage.log 2>&1' + docker cp $MPC_NAME:/coverage/ . > /dev/null httpd_remove fi From 2a262a400b2b1a748165d9cd0ebfbbd2f96f02ac Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vladim=C3=ADr=20Chlup?= Date: Tue, 14 Jan 2025 16:01:40 +0100 Subject: [PATCH 08/20] test: Add lcov coverage report as well --- test/httpd/Containerfile | 2 +- test/includes/common.sh | 1 + test/testsuite.sh | 3 ++- 3 files changed, 4 insertions(+), 2 deletions(-) diff --git a/test/httpd/Containerfile b/test/httpd/Containerfile index 559f88121..5993aa867 100644 --- a/test/httpd/Containerfile +++ b/test/httpd/Containerfile @@ -6,7 +6,7 @@ ARG LFLAGS="" ARG HTTPD_DEFAULT_FLAGS="--enable-proxy --enable-proxy-http --enable-proxy-ajp --enable-proxy-wstunnel --enable-proxy-hcheck --with-port=8000" ARG HTTPD_EXTRA_FLAGS="" -RUN yum install gcc wget apr-devel apr-util-devel openssl-devel pcre-devel redhat-rpm-config wcstools git autoconf gcovr -y +RUN yum install gcc wget apr-devel apr-util-devel openssl-devel pcre-devel redhat-rpm-config wcstools git autoconf gcovr lcov -y ENV CONF=httpd/mod_proxy_cluster.conf ENV HTTPD=${HTTPD_SOURCES} diff --git a/test/includes/common.sh b/test/includes/common.sh index 77a6e682a..ce6a44b35 100644 --- a/test/includes/common.sh +++ b/test/includes/common.sh @@ -43,6 +43,7 @@ run_test() { # docker has problems with names containing spaces f=$(echo ${2:-1} | sed 's/ /-/g') docker exec ${httpd_cont} sh -c "cd /native; gcovr --gcov-ignore-errors=no_working_dir_found --json /coverage/coverage-$f.json > /coverage/coverage-$f.log 2>&1" + docker exec ${httpd_cont} sh -c "cd /native; lcov --capture --directory . --output-file /coverage/coverage-$f.info" for f in $(docker exec ${httpd_cont} ls /coverage/); do docker cp ${httpd_cont}:/coverage/$f $PWD/coverage/$f > /dev/null diff --git a/test/testsuite.sh b/test/testsuite.sh index c28e9ed20..ffb5c09e4 100644 --- a/test/testsuite.sh +++ b/test/testsuite.sh @@ -130,11 +130,12 @@ if [ $CODE_COVERAGE ]; then httpd_start > /dev/null 2>&1 docker exec $MPC_NAME /usr/local/apache2/bin/apachectl stop - for f in $(ls coverage/*.json); do + for f in $(ls coverage/*.json coverage/*.info); do docker cp $f $MPC_NAME:/coverage/ > /dev/null done docker exec $MPC_NAME sh -c 'cd /native; gcovr --add-tracefile "/coverage/coverage-*.json" --html-details /coverage/test-coverage.html > /coverage/test-coverage.log 2>&1' + docker exec $MPC_NAME sh -c 'cd /coverage; mkdir lcov; genhtml *.info --output-directory lcov' docker cp $MPC_NAME:/coverage/ . > /dev/null httpd_remove From 0c683f1553a6ac2640fa6fe052e2466a2ade8238 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vladim=C3=ADr=20Chlup?= Date: Wed, 22 Jan 2025 14:38:13 +0100 Subject: [PATCH 09/20] WIP --- test/httpd/Containerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/httpd/Containerfile b/test/httpd/Containerfile index 5993aa867..dfa89a449 100644 --- a/test/httpd/Containerfile +++ b/test/httpd/Containerfile @@ -2,7 +2,7 @@ FROM fedora:41 ARG HTTPD_SOURCES="https://dlcdn.apache.org/httpd/httpd-2.4.63.tar.gz" ARG CFLAGS="" -ARG LFLAGS="" +ARG LDFLAGS="" ARG HTTPD_DEFAULT_FLAGS="--enable-proxy --enable-proxy-http --enable-proxy-ajp --enable-proxy-wstunnel --enable-proxy-hcheck --with-port=8000" ARG HTTPD_EXTRA_FLAGS="" From 26d958d5c602de68d175339a96389866b2e0dd56 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vladim=C3=ADr=20Chlup?= Date: Wed, 22 Jan 2025 15:10:27 +0100 Subject: [PATCH 10/20] WIP silence output --- test/includes/common.sh | 2 +- test/testsuite.sh | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/test/includes/common.sh b/test/includes/common.sh index ce6a44b35..c95dfde7a 100644 --- a/test/includes/common.sh +++ b/test/includes/common.sh @@ -43,7 +43,7 @@ run_test() { # docker has problems with names containing spaces f=$(echo ${2:-1} | sed 's/ /-/g') docker exec ${httpd_cont} sh -c "cd /native; gcovr --gcov-ignore-errors=no_working_dir_found --json /coverage/coverage-$f.json > /coverage/coverage-$f.log 2>&1" - docker exec ${httpd_cont} sh -c "cd /native; lcov --capture --directory . --output-file /coverage/coverage-$f.info" + docker exec ${httpd_cont} sh -c "cd /native; lcov --capture --directory . --output-file /coverage/coverage-$f.info > /coverage/coverage-lcov-$f.log 2>&1" for f in $(docker exec ${httpd_cont} ls /coverage/); do docker cp ${httpd_cont}:/coverage/$f $PWD/coverage/$f > /dev/null diff --git a/test/testsuite.sh b/test/testsuite.sh index ffb5c09e4..195667fba 100644 --- a/test/testsuite.sh +++ b/test/testsuite.sh @@ -135,7 +135,7 @@ if [ $CODE_COVERAGE ]; then done docker exec $MPC_NAME sh -c 'cd /native; gcovr --add-tracefile "/coverage/coverage-*.json" --html-details /coverage/test-coverage.html > /coverage/test-coverage.log 2>&1' - docker exec $MPC_NAME sh -c 'cd /coverage; mkdir lcov; genhtml *.info --output-directory lcov' + docker exec $MPC_NAME sh -c 'cd /coverage; mkdir lcov; genhtml *.info --output-directory lcov > /coverage/lcov/test-coverage-lcov.log 2>&1' docker cp $MPC_NAME:/coverage/ . > /dev/null httpd_remove From c0db5331c8752c33caed290b30e85ba510ee1056 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vladim=C3=ADr=20Chlup?= Date: Thu, 20 Mar 2025 10:00:50 +0100 Subject: [PATCH 11/20] Add -fPIC --- test/includes/common.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/includes/common.sh b/test/includes/common.sh index c95dfde7a..7c63243bc 100644 --- a/test/includes/common.sh +++ b/test/includes/common.sh @@ -5,7 +5,7 @@ HTTPD_IMG=${HTTPD_IMG:-mod_proxy_cluster-testsuite-httpd} MPC_NAME=${MPC_NAME:-httpd-mod_proxy_cluster} if [ $CODE_COVERAGE ]; then - MPC_CFLAGS="$MPC_CFLAGS --coverage -fprofile-arcs -ftest-coverage -g -O0" + MPC_CFLAGS="$MPC_CFLAGS --coverage -fprofile-arcs -ftest-coverage -fPIC -g -O0" MPC_LDFLAGS="$MPC_LDFLAGS -lgcov" HTTPD_EXTRA_FLAGS="$HTTPD_EXTRA_FLAGS --enable-debugger-mode" fi From 74b68a5f4432cdadff87a5d852dbdeb15e0b87e2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vladim=C3=ADr=20Chlup?= Date: Wed, 14 May 2025 11:55:53 +0200 Subject: [PATCH 12/20] WIP: Add more flags --- test/includes/common.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/test/includes/common.sh b/test/includes/common.sh index 7c63243bc..77fea7dbf 100644 --- a/test/includes/common.sh +++ b/test/includes/common.sh @@ -6,8 +6,8 @@ MPC_NAME=${MPC_NAME:-httpd-mod_proxy_cluster} if [ $CODE_COVERAGE ]; then MPC_CFLAGS="$MPC_CFLAGS --coverage -fprofile-arcs -ftest-coverage -fPIC -g -O0" - MPC_LDFLAGS="$MPC_LDFLAGS -lgcov" - HTTPD_EXTRA_FLAGS="$HTTPD_EXTRA_FLAGS --enable-debugger-mode" + MPC_LDFLAGS="$MPC_LDFLAGS -lgcov -fprofile-arcs -ftest-coverage" + HTTPD_EXTRA_FLAGS="$HTTPD_EXTRA_FLAGS --enable-debugger-mode --enable-maintainer-mode --enable-so" fi # Runs a test file ($1) under given name ($2, if given) From f83d75678323fca33c6c32f217036ab98b97a663 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vladim=C3=ADr=20Chlup?= Date: Wed, 14 May 2025 11:57:26 +0200 Subject: [PATCH 13/20] WIP: Try standalone mode for httpd --- test/httpd/run.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/httpd/run.sh b/test/httpd/run.sh index 117dc7efc..013a30d6c 100755 --- a/test/httpd/run.sh +++ b/test/httpd/run.sh @@ -15,6 +15,6 @@ mkdir /coverage # start apache httpd server in foreground echo "Starting httpd..." -/usr/local/apache2/bin/apachectl start +/usr/local/apache2/bin/httpd -X & tail -f /usr/local/apache2/logs/error_log From 366c2b7b1d0f9d04a741384c1aff51644fbf035d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vladim=C3=ADr=20Chlup?= Date: Wed, 14 May 2025 13:43:44 +0200 Subject: [PATCH 14/20] WIP: Add sleep before logs are created --- test/httpd/run.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/test/httpd/run.sh b/test/httpd/run.sh index 013a30d6c..6fddad1fc 100755 --- a/test/httpd/run.sh +++ b/test/httpd/run.sh @@ -16,5 +16,6 @@ mkdir /coverage # start apache httpd server in foreground echo "Starting httpd..." /usr/local/apache2/bin/httpd -X & +sleep 1 tail -f /usr/local/apache2/logs/error_log From 9eaeaee9fa4368489b6439bcd7ae1ebc9b9b98f0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vladim=C3=ADr=20Chlup?= Date: Thu, 15 May 2025 09:38:03 +0200 Subject: [PATCH 15/20] WIP --- test/includes/common.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/includes/common.sh b/test/includes/common.sh index 77fea7dbf..3488e5a41 100644 --- a/test/includes/common.sh +++ b/test/includes/common.sh @@ -7,7 +7,7 @@ MPC_NAME=${MPC_NAME:-httpd-mod_proxy_cluster} if [ $CODE_COVERAGE ]; then MPC_CFLAGS="$MPC_CFLAGS --coverage -fprofile-arcs -ftest-coverage -fPIC -g -O0" MPC_LDFLAGS="$MPC_LDFLAGS -lgcov -fprofile-arcs -ftest-coverage" - HTTPD_EXTRA_FLAGS="$HTTPD_EXTRA_FLAGS --enable-debugger-mode --enable-maintainer-mode --enable-so" + HTTPD_EXTRA_FLAGS="$HTTPD_EXTRA_FLAGS --enable-debugger-mode --enable-so" fi # Runs a test file ($1) under given name ($2, if given) From 5faa1f0dac2406380fb9589893a5d81081e54f77 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vladim=C3=ADr=20Chlup?= Date: Thu, 15 May 2025 11:53:05 +0200 Subject: [PATCH 16/20] WIP: Run only a subset of tests --- test/testsuite.sh | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/test/testsuite.sh b/test/testsuite.sh index 195667fba..b12e68403 100644 --- a/test/testsuite.sh +++ b/test/testsuite.sh @@ -83,25 +83,25 @@ run_test hangingtests.sh "Hanging tests" res=$(expr $res + $?) run_test maintests.sh "Main tests" res=$(expr $res + $?) -run_test websocket/basic.sh "Websocket tests" -res=$(expr $res + $?) -run_test MODCLUSTER-640/testit.sh "MODCLUSTER-640" -res=$(expr $res + $?) -run_test MODCLUSTER-734/testit.sh "MODCLUSTER-734" -res=$(expr $res + $?) -run_test MODCLUSTER-736/testit.sh "MODCLUSTER-736" -res=$(expr $res + $?) -run_test MODCLUSTER-755/testit.sh "MODCLUSTER-755" -res=$(expr $res + $?) -run_test MODCLUSTER-785/testit.sh "MODCLUSTER-785" -res=$(expr $res + $?) -run_test MODCLUSTER-794/testit.sh "MODCLUSTER-794" -res=$(expr $res + $?) +# run_test websocket/basic.sh "Websocket tests" +# res=$(expr $res + $?) +# run_test MODCLUSTER-640/testit.sh "MODCLUSTER-640" +# res=$(expr $res + $?) +# run_test MODCLUSTER-734/testit.sh "MODCLUSTER-734" +# res=$(expr $res + $?) +# run_test MODCLUSTER-736/testit.sh "MODCLUSTER-736" +# res=$(expr $res + $?) +# run_test MODCLUSTER-755/testit.sh "MODCLUSTER-755" +# res=$(expr $res + $?) +# run_test MODCLUSTER-785/testit.sh "MODCLUSTER-785" +# res=$(expr $res + $?) +# run_test MODCLUSTER-794/testit.sh "MODCLUSTER-794" +# res=$(expr $res + $?) MPC_CONF=httpd/mod_lbmethod_cluster.conf run_test basetests.sh "Basic tests with mod_proxy_balancer" res=$(expr $res + $?) -MPC_CONF=MODCLUSTER-640/mod_lbmethod_cluster.conf run_test MODCLUSTER-640/testit.sh "MODCLUSTER-640 with mod_proxy_balancer" -res=$(expr $res + $?) +# MPC_CONF=MODCLUSTER-640/mod_lbmethod_cluster.conf run_test MODCLUSTER-640/testit.sh "MODCLUSTER-640 with mod_proxy_balancer" +# res=$(expr $res + $?) MPC_CONF=MODCLUSTER-734/mod_lbmethod_cluster.conf run_test MODCLUSTER-734/testit.sh "MODCLUSTER-734 with mod_proxy_balancer" res=$(expr $res + $?) MPC_CONF=httpd/mod_lbmethod_cluster.conf run_test MODCLUSTER-755/testit.sh "MODCLUSTER-755 with mod_proxy_balancer" From bc815e989e27177211dd9f02993986c121bb8454 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vladim=C3=ADr=20Chlup?= Date: Thu, 15 May 2025 12:47:16 +0200 Subject: [PATCH 17/20] WIP Add more flags --- test/includes/common.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/includes/common.sh b/test/includes/common.sh index 3488e5a41..2d031f520 100644 --- a/test/includes/common.sh +++ b/test/includes/common.sh @@ -7,7 +7,7 @@ MPC_NAME=${MPC_NAME:-httpd-mod_proxy_cluster} if [ $CODE_COVERAGE ]; then MPC_CFLAGS="$MPC_CFLAGS --coverage -fprofile-arcs -ftest-coverage -fPIC -g -O0" MPC_LDFLAGS="$MPC_LDFLAGS -lgcov -fprofile-arcs -ftest-coverage" - HTTPD_EXTRA_FLAGS="$HTTPD_EXTRA_FLAGS --enable-debugger-mode --enable-so" + HTTPD_EXTRA_FLAGS="$HTTPD_EXTRA_FLAGS --enable-debugger-mode --enable-maintainer-mode --enable-modules=all --enable-so" fi # Runs a test file ($1) under given name ($2, if given) From aea36c9e27f3ad6d467467bfc13476eea7926da9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vladim=C3=ADr=20Chlup?= Date: Thu, 15 May 2025 12:47:55 +0200 Subject: [PATCH 18/20] WIP Run tests only with balancer --- test/testsuite.sh | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/test/testsuite.sh b/test/testsuite.sh index b12e68403..f0a1dcf8f 100644 --- a/test/testsuite.sh +++ b/test/testsuite.sh @@ -73,16 +73,16 @@ res=0 # IMG name might include specific version, we have to handle that IMG_NOVER=$(echo $IMG | cut -d: -f1) -for tomcat_version in "9.0" "10.1" "11.0" -do - IMG="$IMG_NOVER:$tomcat_version" tomcat_create $tomcat_version > /dev/null 2>&1 || exit 3 - IMG="$IMG_NOVER:$tomcat_version" run_test basetests.sh "Basic tests with tomcat $tomcat_version" - res=$(expr $res + $?) -done -run_test hangingtests.sh "Hanging tests" -res=$(expr $res + $?) -run_test maintests.sh "Main tests" -res=$(expr $res + $?) +# for tomcat_version in "9.0" "10.1" "11.0" +# do +# IMG="$IMG_NOVER:$tomcat_version" tomcat_create $tomcat_version > /dev/null 2>&1 || exit 3 +# IMG="$IMG_NOVER:$tomcat_version" run_test basetests.sh "Basic tests with tomcat $tomcat_version" +# res=$(expr $res + $?) +# done +# run_test hangingtests.sh "Hanging tests" +# res=$(expr $res + $?) +# run_test maintests.sh "Main tests" +# res=$(expr $res + $?) # run_test websocket/basic.sh "Websocket tests" # res=$(expr $res + $?) # run_test MODCLUSTER-640/testit.sh "MODCLUSTER-640" From 61425f5813bb1185ccd0c1a42f1148b3761dd1f9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vladim=C3=ADr=20Chlup?= Date: Thu, 15 May 2025 14:23:54 +0200 Subject: [PATCH 19/20] wip --- test/testsuite.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/test/testsuite.sh b/test/testsuite.sh index f0a1dcf8f..4433d0610 100644 --- a/test/testsuite.sh +++ b/test/testsuite.sh @@ -1,3 +1,4 @@ +set +x #!/usr/bin/sh # exits with 0 if everything went well # exits with 1 if some test failed @@ -127,7 +128,7 @@ fi # coverage files and generate the report from within the container with all the sources if [ $CODE_COVERAGE ]; then echo "Generating test coverage..." - httpd_start > /dev/null 2>&1 + MPC_CONF=httpd/mod_lbmethod_cluster.conf httpd_start > /dev/null 2>&1 docker exec $MPC_NAME /usr/local/apache2/bin/apachectl stop for f in $(ls coverage/*.json coverage/*.info); do From 4564d26ecef2b31669bf736b6d715f2c21586bbc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vladim=C3=ADr=20Chlup?= Date: Wed, 28 May 2025 15:20:38 +0200 Subject: [PATCH 20/20] Add CXXFLAGS --- test/httpd/Containerfile | 1 + 1 file changed, 1 insertion(+) diff --git a/test/httpd/Containerfile b/test/httpd/Containerfile index dfa89a449..5a8ea49e7 100644 --- a/test/httpd/Containerfile +++ b/test/httpd/Containerfile @@ -13,6 +13,7 @@ ENV HTTPD=${HTTPD_SOURCES} ENV CFLAGS="${CFLAGS}" ENV LDFLAGS="${LDFLAGS}" ENV HTTPD_FLAGS="${HTTPD_DEFAULT_FLAGS} ${HTTPD_EXTRA_FLAGS}" +ENV CXXFLAGS="-fprofile-arcs -ftest-coverage" # make sure you have copy of the local repository at place # (our function "httpd_create" takes care of that)