@@ -79,181 +79,193 @@ make $MFLAGS
7979if test -v TEST_INSTALL; then
8080 make install
8181 pushd $PREFIX
82+ # Basic sanity tests of the installed server.
83+ ./bin/apachectl -V
8284 test ` ./bin/apxs -q PREFIX` = $PREFIX
8385 test ` $PWD /bin/apxs -q PREFIX` = $PREFIX
8486 ./bin/apxs -g -n foobar
8587 cd foobar; make
8688 popd
8789fi
8890
89- if ! test -v SKIP_TESTING; then
90- set +e
91- RV=0
91+ if test -v SKIP_TESTING; then
92+ # Check that httpd was built successfully, nothing more.
93+ ./httpd -V
94+ exit 0
95+ fi
9296
93- if test -v TEST_MALLOC; then
94- # Enable enhanced glibc malloc debugging, see mallopt(3)
95- export MALLOC_PERTURB_=65 MALLOC_CHECK_=3
96- export LIBC_FATAL_STDERR_=1
97- fi
97+ # ##############################################################
98+ # ## Everything below is only run if SKIP_TESTING was not set ##
99+ # ##############################################################
98100
99- if test -v TEST_UBSAN; then
100- export UBSAN_OPTIONS=" log_path=$PWD /ubsan.log"
101- fi
101+ : Running tests...
102102
103- if test -v TEST_ASAN; then
104- export ASAN_OPTIONS=" log_path=$PWD /asan.log:detect_leaks=0"
105- fi
103+ set +e
104+ RV=0
106105
107- # Try to keep all potential coredumps from all processes
108- sudo sysctl -w kernel.core_uses_pid=1 2> /dev/null || true
109- # Systemd based systems might process core dumps via systemd-coredump.
110- # But we want to have local unprocessed files.
111- sudo sysctl -w kernel.core_pattern=core || true
112- ulimit -c unlimited 2> /dev/null || true
106+ if test -v TEST_MALLOC; then
107+ # Enable enhanced glibc malloc debugging, see mallopt(3)
108+ export MALLOC_PERTURB_=65 MALLOC_CHECK_=3
109+ export LIBC_FATAL_STDERR_=1
110+ fi
113111
114- if test -v WITH_TEST_SUITE; then
115- make check TESTS=" ${TESTS} " TEST_CONFIG=" ${TEST_ARGS} "
116- RV=$?
117- else
118- test -v TEST_INSTALL || make install
119- pushd test/perl-framework
120- perl Makefile.PL -apxs $PREFIX /bin/apxs
121- make test APACHE_TEST_EXTRA_ARGS=" ${TEST_ARGS} ${TESTS} " | tee test.log
122- RV=${PIPESTATUS[0]}
123- # re-run failing tests with -v, avoiding set -e
124- if [ $RV -ne 0 ]; then
125- # mv t/logs/error_log t/logs/error_log_save
126- FAILERS=" "
127- while read FAILER; do
128- FAILERS=" $FAILERS $FAILER "
129- done < <( awk ' /Failed:/{print $1}' test.log)
130- if [ -n " $FAILERS " ]; then
131- t/TEST -v $FAILERS || true
132- fi
133- # set -e would have killed us after the original t/TEST
134- rm -f test.log
135- # mv t/logs/error_log_save t/logs/error_log
136- false
112+ if test -v TEST_UBSAN; then
113+ export UBSAN_OPTIONS=" log_path=$PWD /ubsan.log"
114+ fi
115+
116+ if test -v TEST_ASAN; then
117+ export ASAN_OPTIONS=" log_path=$PWD /asan.log:detect_leaks=0"
118+ fi
119+
120+ # Try to keep all potential coredumps from all processes
121+ sudo sysctl -w kernel.core_uses_pid=1 2> /dev/null || true
122+ # Systemd based systems might process core dumps via systemd-coredump.
123+ # But we want to have local unprocessed files.
124+ sudo sysctl -w kernel.core_pattern=core || true
125+ ulimit -c unlimited 2> /dev/null || true
126+
127+ if test -v WITH_TEST_SUITE; then
128+ make check TESTS=" ${TESTS} " TEST_CONFIG=" ${TEST_ARGS} "
129+ RV=$?
130+ else
131+ test -v TEST_INSTALL || make install
132+ pushd test/perl-framework
133+ perl Makefile.PL -apxs $PREFIX /bin/apxs
134+ make test APACHE_TEST_EXTRA_ARGS=" ${TEST_ARGS} ${TESTS} " | tee test.log
135+ RV=${PIPESTATUS[0]}
136+ # re-run failing tests with -v, avoiding set -e
137+ if [ $RV -ne 0 ]; then
138+ # mv t/logs/error_log t/logs/error_log_save
139+ FAILERS=" "
140+ while read FAILER; do
141+ FAILERS=" $FAILERS $FAILER "
142+ done < <( awk ' /Failed:/{print $1}' test.log)
143+ if [ -n " $FAILERS " ]; then
144+ t/TEST -v $FAILERS || true
137145 fi
138- popd
139- fi
146+ # set -e would have killed us after the original t/TEST
147+ rm -f test.log
148+ # mv t/logs/error_log_save t/logs/error_log
149+ false
150+ fi
151+ popd
152+ fi
140153
141- # Skip further testing if a core dump was created during the test
142- # suite run above.
143- if test $RV -eq 0 && test -n " ` ls test/perl-framework/t/core{,.* } 2> /dev/null` " ; then
144- RV=4
145- fi
154+ # Skip further testing if a core dump was created during the test
155+ # suite run above.
156+ if test $RV -eq 0 && test -n " ` ls test/perl-framework/t/core{,.* } 2> /dev/null` " ; then
157+ RV=4
158+ fi
146159
147- if test -v TEST_SSL -a $RV -eq 0; then
148- pushd test/perl-framework
149- # Test loading encrypted private keys
150- ./t/TEST -defines " TEST_SSL_DES3_KEY TEST_SSL_PASSPHRASE_EXEC" t/ssl
151- RV=$?
160+ if test -v TEST_SSL -a $RV -eq 0; then
161+ pushd test/perl-framework
162+ # Test loading encrypted private keys
163+ ./t/TEST -defines " TEST_SSL_DES3_KEY TEST_SSL_PASSPHRASE_EXEC" t/ssl
164+ RV=$?
152165
153- # Log the OpenSSL version.
154- grep ' mod_ssl.*compiled against' t/logs/error_log | tail -n 1
155-
156- # Test various session cache backends
157- for cache in shmcb redis:localhost:6379 memcache:localhost:11211; do
158- test $RV -eq 0 || break
159-
160- SSL_SESSCACHE=$cache ./t/TEST -sslproto TLSv1.2 -defines TEST_SSL_SESSCACHE -start
161- ./t/TEST t/ssl
162- RV=$?
163- ./t/TEST -stop
164- SRV=$?
165- if test $RV -eq 0 -a $SRV -ne 0; then
166- RV=$SRV
167- fi
168- done
169- popd
170- fi
166+ # Log the OpenSSL version.
167+ grep ' mod_ssl.*compiled against' t/logs/error_log | tail -n 1
168+
169+ # Test various session cache backends
170+ for cache in shmcb redis:localhost:6379 memcache:localhost:11211; do
171+ test $RV -eq 0 || break
171172
172- if test -v LITMUS -a $RV -eq 0 ; then
173- pushd test/perl-framework
174- mkdir -p t/htdocs/modules/dav
175- ./t/TEST -start
176- # litmus uses $TESTS, so unset it.
177- unset TESTS
178- litmus http://localhost:8529/modules/dav/
179- RV= $?
180- ./t/TEST -stop
181- popd
182- fi
173+ SSL_SESSCACHE= $cache ./t/TEST -sslproto TLSv1.2 -defines TEST_SSL_SESSCACHE -start
174+ ./t/TEST t/ssl
175+ RV= $?
176+ ./t/TEST -stop
177+ SRV= $?
178+ if test $RV -eq 0 -a $SRV -ne 0 ; then
179+ RV= $SRV
180+ fi
181+ done
182+ popd
183+ fi
183184
184- if test $RV -ne 0 && test -f test/perl-framework/t/logs/error_log; then
185- grep -v ' :\(debug\|trace[12345678]\)\]' test/perl-framework/t/logs/error_log
186- fi
185+ if test -v LITMUS -a $RV -eq 0; then
186+ pushd test/perl-framework
187+ mkdir -p t/htdocs/modules/dav
188+ ./t/TEST -start
189+ # litmus uses $TESTS, so unset it.
190+ unset TESTS
191+ litmus http://localhost:8529/modules/dav/
192+ RV=$?
193+ ./t/TEST -stop
194+ popd
195+ fi
187196
188- if test -v TEST_CORE -a $RV -eq 0; then
189- # Run HTTP/2 tests.
190- MPM=event py.test-3 test/modules/core
191- RV=$?
192- fi
197+ if test $RV -ne 0 && test -f test/perl-framework/t/logs/error_log; then
198+ grep -v ' :\(debug\|trace[12345678]\)\]' test/perl-framework/t/logs/error_log
199+ fi
193200
194- if test -v TEST_H2 -a $RV -eq 0; then
195- # Build the test clients
196- (cd test/clients && make)
197- # Run HTTP/2 tests.
198- MPM=event py.test-3 test/modules/http2
199- RV=$?
200- if test $RV -eq 0; then
201- MPM=worker py.test-3 test/modules/http2
202- RV=$?
203- fi
204- fi
201+ if test -v TEST_CORE -a $RV -eq 0; then
202+ # Run HTTP/2 tests.
203+ MPM=event py.test-3 test/modules/core
204+ RV=$?
205+ fi
205206
206- if test -v TEST_MD -a $RV -eq 0; then
207- # Run ACME tests.
208- # need the go based pebble as ACME test server
209- # which is a package on debian sid, but not on focal
210- export GOPATH=${PREFIX} /gocode
211- mkdir -p " ${GOPATH} "
212- export PATH=" ${GOROOT} /bin:${GOPATH} /bin:${PATH} "
213- go get -u github.com/letsencrypt/pebble/...
214- (cd $GOPATH /src/github.com/letsencrypt/pebble && go install ./...)
215-
216- py.test-3 test/modules/md
217- RV=$?
207+ if test -v TEST_H2 -a $RV -eq 0; then
208+ # Build the test clients
209+ (cd test/clients && make)
210+ # Run HTTP/2 tests.
211+ MPM=event py.test-3 test/modules/http2
212+ RV=$?
213+ if test $RV -eq 0; then
214+ MPM=worker py.test-3 test/modules/http2
215+ RV=$?
218216 fi
217+ fi
219218
220- # Catch cases where abort()s get logged to stderr by libraries but
221- # only cause child processes to terminate e.g. during shutdown,
222- # which may not otherwise trigger test failures.
219+ if test -v TEST_MD -a $RV -eq 0; then
220+ # Run ACME tests.
221+ # need the go based pebble as ACME test server
222+ # which is a package on debian sid, but not on focal
223+ export GOPATH=${PREFIX} /gocode
224+ mkdir -p " ${GOPATH} "
225+ export PATH=" ${GOROOT} /bin:${GOPATH} /bin:${PATH} "
226+ go get -u github.com/letsencrypt/pebble/...
227+ (cd $GOPATH /src/github.com/letsencrypt/pebble && go install ./...)
228+
229+ py.test-3 test/modules/md
230+ RV=$?
231+ fi
223232
224- # "glibc detected": printed with LIBC_FATAL_STDERR_/MALLOC_CHECK_
225- # glibc will abort when malloc errors are detected. This will get
226- # caught by the segfault grep as well .
233+ # Catch cases where abort()s get logged to stderr by libraries but
234+ # only cause child processes to terminate e.g. during shutdown,
235+ # which may not otherwise trigger test failures .
227236
228- # "pool concurrency check": printed by APR built with
229- # --enable-thread-debug when an APR pool concurrency check aborts
237+ # "glibc detected": printed with LIBC_FATAL_STDERR_/MALLOC_CHECK_
238+ # glibc will abort when malloc errors are detected. This will get
239+ # caught by the segfault grep as well.
230240
231- for phrase in ' Segmentation fault' ' glibc detected' ' pool concurrency check:' ' Assertion.*failed' ; do
232- # Ignore IO/debug logs
233- if grep -v ' :\(debug\|trace[12345678]\)\]' test/perl-framework/t/logs/error_log | grep -q " $phrase " ; then
234- grep --color=always -C5 " $phrase " test/perl-framework/t/logs/error_log
235- RV=2
236- fi
237- done
241+ # "pool concurrency check": printed by APR built with
242+ # --enable-thread-debug when an APR pool concurrency check aborts
238243
239- if test -v TEST_UBSAN && test -n " ` ls ubsan.log.* 2> /dev/null` " ; then
240- cat ubsan.log.*
241- RV=3
244+ for phrase in ' Segmentation fault' ' glibc detected' ' pool concurrency check:' ' Assertion.*failed' ; do
245+ # Ignore IO/debug logs
246+ if grep -v ' :\(debug\|trace[12345678]\)\]' test/perl-framework/t/logs/error_log | grep -q " $phrase " ; then
247+ grep --color=always -C5 " $phrase " test/perl-framework/t/logs/error_log
248+ RV=2
242249 fi
250+ done
243251
244- if test -v TEST_ASAN && test -n " ` ls asan.log.* 2> /dev/null` " ; then
245- cat asan.log.*
252+ if test -v TEST_UBSAN && test -n " ` ls ubsan.log.* 2> /dev/null` " ; then
253+ cat ubsan.log.*
254+ RV=3
255+ fi
246256
247- # ASan can report memory leaks, fail on errors only
248- if grep -q " ERROR: AddressSanitizer:" ` ls asan.log.* ` ; then
249- RV=4
250- fi
257+ if test -v TEST_ASAN && test -n " ` ls asan.log.* 2> /dev/null` " ; then
258+ cat asan.log.*
259+
260+ # ASan can report memory leaks, fail on errors only
261+ if grep -q " ERROR: AddressSanitizer:" ` ls asan.log.* ` ; then
262+ RV=4
251263 fi
264+ fi
252265
253- for core in ` ls test/perl-framework/t/core{,.* } test/gen/apache/core{,.* } 2> /dev/null` ; do
254- gdb -ex ' thread apply all backtrace full' -batch ./httpd " $core "
255- RV=5
256- done
266+ for core in ` ls test/perl-framework/t/core{,.* } test/gen/apache/core{,.* } 2> /dev/null` ; do
267+ gdb -ex ' thread apply all backtrace full' -batch ./httpd " $core "
268+ RV=5
269+ done
257270
258- exit $RV
259- fi
271+ exit $RV
0 commit comments