Skip to content
Closed
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
4 changes: 4 additions & 0 deletions .github/workflows/windows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ on:
- 'os/unix/**'
- server/mpm_unix.c
- 'test/modules/arch/linux/**'
- 'test/travis_*.sh'
- 'test/gha-*.sh'
tags:
- 2.*
pull_request:
Expand All @@ -29,6 +31,8 @@ on:
- 'os/unix/**'
- server/mpm_unix.c
- 'test/modules/arch/linux/**'
- 'test/travis_*.sh'
- 'test/gha-*.sh'

permissions:
contents: read
Expand Down
21 changes: 6 additions & 15 deletions test/README.ci
Original file line number Diff line number Diff line change
Expand Up @@ -81,10 +81,6 @@ The CI scripts use the following environment variables:
HTTP/2 workflow to test against nghttp2 versions other than the one
packaged for the runner image.

* TEST_MOD_TLS - if set (together with RUSTLS_VERSION), builds
rustls-ffi from source and configures httpd with --with-tls
--with-rustls for mod_tls testing.

* TEST_MD - set together with TEST_PYTEST; installs pebble first so
PYHTTPD_TARGETS auto-detection includes modules/md. See the
"Python pytest test suites" job in .github/workflows/linux.yml.
Expand Down Expand Up @@ -139,12 +135,9 @@ $PERLID is a hash of the "perl -V" output, computed by
gha-resolve-deps.sh, which also logs that output so a change to it can
be seen. The image name is deliberately not used: the runner image is
rebuilt regularly and its name does not change when perl does, so the
key outlived a perl upgrade which the modules did not. Each job then
restored the modules, travis_before_linux.sh discarded them as
mismatched against the cached .perlver and rebuilt them, and nothing
was saved - actions/cache does not save on a hit against the primary
key - so every job rebuilt every module on every run. The .perlver
check remains as a backstop, and now reports what differs.
key outlived a perl upgrade which the modules did not. The key has no
restore-keys fallback, so the modules restored always match the perl
running the job.

The cached CPAN modules still become gradually stale as versions in
CPAN move on from whatever was installed for the first build. Bump
Expand All @@ -153,11 +146,9 @@ them and rebuild against current CPAN.

APR and APR-util must stay in a single cache entry. APR-util's
buildconf needs APR's *source* tree, which lives in $HOME/build and is
not cached, so a cached but stale APR-util alongside a cached and
fresh APR cannot be rebuilt from the cache alone. This used to be
handled by always ignoring the cache on such jobs; install_apx() now
fetches the APR source on demand in that case instead, so no job needs
to opt out of caching.
not cached, so APR-util can only be built in a job which also builds
APR. $ROOTID covers both, and the entry is saved only once both have
built, so a restored entry never holds one without the other.

Artifacts
---------
Expand Down
12 changes: 3 additions & 9 deletions test/gha-resolve-deps.sh
Original file line number Diff line number Diff line change
Expand Up @@ -65,10 +65,6 @@ if test -n "${TEST_NGHTTP2-}"; then
root="${root} nghttp2-${TEST_NGHTTP2}"
fi

if test -n "${RUSTLS_VERSION-}"; then
root="${root} rustls-${RUSTLS_VERSION}"
fi

if test -n "$root"; then
# The compiler and every flag which reaches the build are baked into
# the libraries, NOTEST_* included: APR adds those to the build too,
Expand All @@ -87,11 +83,9 @@ fi
# The CPAN modules in ~/perl5 are XS builds tied to the system perl, so
# key that cache on the "perl -V" output rather than on the image name.
# The image is rebuilt regularly and its name does not change when perl
# does, so the key stayed valid across a perl upgrade: the modules were
# restored, travis_before_linux.sh then threw them away as mismatched,
# and the rebuild was never saved because the primary key had hit - so
# every job rebuilt them, every run. The output is logged because it is
# otherwise impossible to see what changed.
# does, so the key stayed valid across a perl upgrade and restored
# modules built for a different perl. The output is logged because it
# is otherwise impossible to see what changed.
perlv=`perl -V`
echo "::group::perl -V"
echo "$perlv"
Expand Down
166 changes: 33 additions & 133 deletions test/travis_before_linux.sh
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
#!/bin/bash -xe

: Travis tag = ${TRAVIS_TAG}
: Travis branch = ${TRAVIS_BRANCH}

: /etc/hosts --
cat /etc/hosts
: -- ends
Expand All @@ -17,107 +14,49 @@ if grep ip6-localhost /etc/hosts; then
cat /etc/hosts
fi

# Echo the object ID (hash) of the commit to build for $1 at version
# $2, or "tarball" if a release tarball is used instead of a checkout.
function resolve_apx() {
local name=$1
local version=$2
local ref commit

if test -v TEST_APR_TARBALL; then
echo tarball
return 0
fi

# For a branch, prefer the commit already resolved by
# gha-resolve-deps.sh for the cache key; resolving it again here
# would race with the branch moving in the meantime. Tags are
# immutable so they are always resolved below.
case $name in
apr) commit=${APR_COMMIT-} ;;
apr-util) commit=${APU_COMMIT-} ;;
esac
if test -n "$commit"; then
echo ${commit}
return 0
fi

case $version in
trunk|*.x) ref=refs/heads/${version} ;;
*) ref=refs/tags/${version} ;;
esac

commit=`git ls-remote https://github.com/apache/${name}.git ${ref} | cut -f1`
if test -z "$commit"; then
: Could not determine latest commit hash for ${ref} in ${name} - check branch is valid?
exit 1
fi

echo ${commit}
}

# Unpack the source for $1 at version $2, commit $3, into
# $HOME/build/$1-$2, running ./buildconf with the arguments in $4. Does
# nothing if the source tree is already present. Note $HOME/build is
# not cached, unlike the install root in $HOME/root.
function fetch_apx() {
local name=$1
local version=$2
local commit=$3
local buildconf=$4
local build=${HOME}/build/${name}-${version}

if test -d ${build}; then
return 0
fi

mkdir -p ${HOME}/build

if test -v TEST_APR_TARBALL; then
curl https://archive.apache.org/dist/apr/${name}-${version}.tar.gz > apx.tar.gz
tar -C ${HOME}/build -xzf apx.tar.gz
rm apx.tar.gz
else
git init -q ${build}
pushd $build
# Clone and checkout the commit identified above.
git remote add origin https://github.com/apache/${name}.git
git fetch -q --depth=1 origin ${commit}
git checkout ${commit}
./buildconf ${buildconf}
popd
fi
}

# Build and install $1 at version $2 into the cached
# $HOME/root/$1-$2, configured with the arguments in $3 and bootstrapped
# with ./buildconf $4, unless it was restored from the cache. The
# source goes in $HOME/build, which is not cached; it is a git checkout
# or, with TEST_APR_TARBALL, the release tarball.
#
# The cache key covers APR and APR-util together, along with the
# configuration, $CC and, for a branch, the commit which
# gha-resolve-deps.sh resolved it to, so an install restored here is
# usable as-is. The build uses that same commit, since resolving the
# branch again would race with it moving.
function install_apx() {
local name=$1
local version=$2
local prefix=${HOME}/root/${name}-${version}
local build=${HOME}/build/${name}-${version}
local config=$3
local buildconf=$4
local commit
local prefix=${HOME}/root/${name}-${version}
local build=${HOME}/build/${name}-${version}
local ref

# The cache key covers the version, the resolved commit for a branch
# build, the configuration and $CC, and is only written once the
# build has succeeded, so anything restored here is usable as-is.
if test -d ${prefix}; then
return 0
fi

commit=`resolve_apx ${name} ${version}`

# apr-util's buildconf needs APR's source tree, which is not cached.
# If APR itself was restored from the cache it was never built here,
# so fetch the source now - otherwise a stale APR-util alongside a
# fresh APR cannot be rebuilt.
if test ${name} = apr-util -a ! -d ${HOME}/build/apr-${APR_VERSION}; then
fetch_apx apr ${APR_VERSION} `resolve_apx apr ${APR_VERSION}`
if test -v TEST_APR_TARBALL; then
mkdir -p ${HOME}/build
curl https://archive.apache.org/dist/apr/${name}-${version}.tar.gz |
tar -C ${HOME}/build -xzf -
pushd ${build}
else
case ${name}:${version} in
apr:trunk|apr:*.x) ref=${APR_COMMIT:-refs/heads/${version}} ;;
apr-util:trunk|apr-util:*.x) ref=${APU_COMMIT:-refs/heads/${version}} ;;
*) ref=refs/tags/${version} ;;
esac

mkdir -p ${build}
pushd ${build}
git init -q
git fetch -q --depth=1 https://github.com/apache/${name}.git ${ref}
git checkout -q FETCH_HEAD
./buildconf ${buildconf}
fi

fetch_apx ${name} ${version} ${commit} "${buildconf}"

pushd ${build}
./configure --prefix=${prefix} ${config}
make -j2
make install
Expand All @@ -130,26 +69,6 @@ echo "add-auto-load-safe-path $HOME/work/httpd/httpd/.gdbinit" >> $HOME/.gdbinit
# Unless either SKIP_TESTING or NO_TEST_FRAMEWORK are set, install
# CPAN modules required to run the Perl test framework.
if ! test -v SKIP_TESTING -o -v NO_TEST_FRAMEWORK; then
if ! perl -V > perlver; then
: Perl binary broken
perl -V
exit 1
fi

# Compare the current "perl -V" output with the output at the time
# the cache was built; flush the cache if it's changed to avoid
# failure later when /usr/bin/perl refuses to load a mismatched XS
# module.
if ! cmp -s perlver ~/perl5/.perlver; then
: Purging cache since "perl -V" output has changed
# $PERLID covers this in the cache key, so it should now only
# fire for a cold cache; show what changed if it fires anyway.
if test -f ~/perl5/.perlver; then
diff -u ~/perl5/.perlver perlver || true
fi
rm -rf ~/perl5
fi

cpanm --local-lib=~/perl5 local::lib && eval $(perl -I ~/perl5/lib/perl5/ -Mlocal::lib)

pkgs="Net::SSL LWP::Protocol::https \
Expand All @@ -162,9 +81,6 @@ if ! test -v SKIP_TESTING -o -v NO_TEST_FRAMEWORK; then
# otherwise.
CC=gcc cpanm --notest $pkgs
unset pkgs

# Cache the perl -V output for future verification.
mv perlver ~/perl5/.perlver
fi

# For LDAP testing, run slapd listening on port 8389 and populate the
Expand Down Expand Up @@ -228,10 +144,7 @@ fi
# Build the requested version of nghttp2 if it's not already installed
# in the cached ~/root; the nghttp/h2load tools come from the package.
if test -v TEST_NGHTTP2; then
if ! test -f $HOME/root/nghttp2-is-${TEST_NGHTTP2}; then
# Remove any previous install.
rm -rf $HOME/root/nghttp2

if ! test -d $HOME/root/nghttp2; then
mkdir -p build/nghttp2
pushd build/nghttp2
curl -L "https://github.com/nghttp2/nghttp2/releases/download/v${TEST_NGHTTP2}/nghttp2-${TEST_NGHTTP2}.tar.xz" |
Expand All @@ -240,7 +153,6 @@ if test -v TEST_NGHTTP2; then
./configure --prefix=$HOME/root/nghttp2 --enable-lib-only
make $MFLAGS
make install
touch $HOME/root/nghttp2-is-${TEST_NGHTTP2}
popd
fi

Expand All @@ -259,18 +171,6 @@ if test -v APU_VERSION; then
ldd $HOME/root/apr-util-${APU_VERSION}/lib/libaprutil-?.so || true
fi

# Since librustls is not a package (yet) on any platform, we
# build the version we want from source
if test -v TEST_MOD_TLS -a -v RUSTLS_VERSION; then
if ! test -d $HOME/root/rustls; then
RUSTLS_HOME="$HOME/build/rustls-ffi"
git clone -q --depth=1 -b "$RUSTLS_VERSION" https://github.com/rustls/rustls-ffi.git "$RUSTLS_HOME"
pushd "$RUSTLS_HOME"
make install DESTDIR="$HOME/root/rustls"
popd
fi
fi

if test -v PHP_FPM -a ! -v SKIP_TESTING; then
# Sanity test the php-fpm executable exists.
$PHP_FPM --version || exit 1
Expand Down
17 changes: 2 additions & 15 deletions test/travis_run_linux.sh
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@ fi

PREFIX=${PREFIX:-$HOME/build/httpd-root}

# If perl-framework testing is required it is checked out here by
# _before_linux.sh:
# If perl-framework testing is required, the workflow checks it out
# here:
if test -d test/perl-framework; then
CONFIG="$CONFIG --enable-load-all-modules"
if grep -q ^check: Makefile.in; then
Expand All @@ -54,11 +54,6 @@ else
CONFIG="$CONFIG --with-apr-util=/usr"
fi

# Pick up the rustls install built previously.
if test -v TEST_MOD_TLS -a RUSTLS_VERSION; then
CONFIG="$CONFIG --with-tls --with-rustls=$HOME/root/rustls"
fi

if test -v TEST_OPENSSL3; then
CONFIG="$CONFIG --with-ssl=$HOME/root/openssl3"
export PATH=$HOME/root/openssl3/bin:$PATH
Expand Down Expand Up @@ -94,14 +89,6 @@ if test -v TEST_NGHTTP2; then
fi
fi

if test -v TEST_OPENSSL3; then
# Clear the library/run paths so that anything else run during
# testing is not forced to use the custom OpenSSL build; e.g. perl,
# php-fpm, ...
unset LD_LIBRARY_PATH
unset LD_RUN_PATH
fi

if test -v TEST_INSTALL; then
make install
pushd $PREFIX
Expand Down