1
0
Fork 0
mirror of https://github.com/git/git.git synced 2024-05-26 00:06:16 +02:00
git/ci/lib-travisci.sh
SZEDER Gábor a1157b76eb travis-ci: set GIT_TEST_HTTPD in 'ci/lib-travisci.sh'
Commit 657343a60 (travis-ci: move Travis CI code into dedicated
scripts, 2017-09-10) converted '.travis.yml's default 'before_install'
scriptlet to the 'ci/install-dependencies.sh' script, and while doing
so moved setting GIT_TEST_HTTPD=YesPlease for the 64-bit GCC and Clang
Linux build jobs to that script.  This is wrong for two reasons:

 - The purpose of that script is, as its name suggests, to install
   dependencies, not to set any environment variables influencing
   which tests should be run (though, arguably, this was already an
   issue with the original 'before_install' scriptlet).

 - Setting the variable has no effect anymore, because that script is
   run in a separate shell process, and the variable won't be visible
   in any of the other scripts, notably in 'ci/run-tests.sh'
   responsible for, well, running the tests.

Luckily, this didn't have a negative effect on our Travis CI build
jobs, because GIT_TEST_HTTPD is a tri-state variable defaulting to
"auto" and a functioning web server was installed in those Linux build
jobs, so the httpd tests were run anyway.

Apparently the httpd tests run just fine without GIT_TEST_HTTPD being
set, therefore we could simply remove this environment variable.
However, if a bug were to creep in to change the Travis CI build
environment to run the tests as root or to not install Apache, then
the httpd tests would be skipped and the build job would still
succeed.  We would only notice if someone actually were to look
through the build job's trace log; but who would look at the trace log
of a successful build job?!

Since httpd tests are important, we do want to run them and we want to
be loudly reminded if they can't be run.  Therefore, move setting
GIT_TEST_HTTPD=YesPlease for the 64-bit GCC and Clang Linux build jobs
to 'ci/lib-travisci.sh' to ensure that the build job fails when the
httpd tests can't be run.  (We could set it in 'ci/run-tests.sh' just
as well, but it's better to keep all environment variables in one
place in 'ci/lib-travisci.sh'.)

Signed-off-by: SZEDER Gábor <szeder.dev@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2017-12-12 12:58:28 -08:00

65 lines
1.8 KiB
Bash
Executable File

# Library of functions shared by all CI scripts
skip_branch_tip_with_tag () {
# Sometimes, a branch is pushed at the same time the tag that points
# at the same commit as the tip of the branch is pushed, and building
# both at the same time is a waste.
#
# Travis gives a tagname e.g. v2.14.0 in $TRAVIS_BRANCH when
# the build is triggered by a push to a tag. Let's see if
# $TRAVIS_BRANCH is exactly at a tag, and if so, if it is
# different from $TRAVIS_BRANCH. That way, we can tell if
# we are building the tip of a branch that is tagged and
# we can skip the build because we won't be skipping a build
# of a tag.
if TAG=$(git describe --exact-match "$TRAVIS_BRANCH" 2>/dev/null) &&
test "$TAG" != "$TRAVIS_BRANCH"
then
echo "Tip of $TRAVIS_BRANCH is exactly at $TAG"
exit 0
fi
}
# Set 'exit on error' for all CI scripts to let the caller know that
# something went wrong
set -e
skip_branch_tip_with_tag
if test -z "$jobname"
then
jobname="$TRAVIS_OS_NAME-$CC"
fi
export DEVELOPER=1
export DEFAULT_TEST_TARGET=prove
export GIT_PROVE_OPTS="--timer --jobs 3 --state=failed,slow,save"
export GIT_TEST_OPTS="--verbose-log"
export GIT_TEST_CLONE_2GB=YesPlease
case "$jobname" in
linux-clang|linux-gcc)
export GIT_TEST_HTTPD=YesPlease
# The Linux build installs the defined dependency versions below.
# The OS X build installs the latest available versions. Keep that
# in mind when you encounter a broken OS X build!
export LINUX_P4_VERSION="16.2"
export LINUX_GIT_LFS_VERSION="1.5.2"
P4_PATH="$(pwd)/custom/p4"
GIT_LFS_PATH="$(pwd)/custom/git-lfs"
export PATH="$GIT_LFS_PATH:$P4_PATH:$PATH"
;;
osx-clang|osx-gcc)
# t9810 occasionally fails on Travis CI OS X
# t9816 occasionally fails with "TAP out of sequence errors" on
# Travis CI OS X
export GIT_SKIP_TESTS="t9810 t9816"
;;
GETTEXT_POISON)
export GETTEXT_POISON=YesPlease
;;
esac