Merge branch 'sg/travis-linux32-sanity'
Travis updates. * sg/travis-linux32-sanity: travis-ci: don't fail if user already exists on 32 bit Linux build job travis-ci: don't run the test suite as root in the 32 bit Linux build travis-ci: don't repeat the path of the cache directory travis-ci: use 'set -e' in the 32 bit Linux build job travis-ci: use 'set -x' for the commands under 'su' in the 32 bit Linux buildmaint
commit
798224a1c9
|
@ -21,8 +21,6 @@ skip_branch_tip_with_tag () {
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
good_trees_file="$HOME/travis-cache/good-trees"
|
|
||||||
|
|
||||||
# Save some info about the current commit's tree, so we can skip the build
|
# Save some info about the current commit's tree, so we can skip the build
|
||||||
# job if we encounter the same tree again and can provide a useful info
|
# job if we encounter the same tree again and can provide a useful info
|
||||||
# message.
|
# message.
|
||||||
|
@ -83,7 +81,10 @@ check_unignored_build_artifacts ()
|
||||||
# and installing dependencies.
|
# and installing dependencies.
|
||||||
set -ex
|
set -ex
|
||||||
|
|
||||||
mkdir -p "$HOME/travis-cache"
|
cache_dir="$HOME/travis-cache"
|
||||||
|
good_trees_file="$cache_dir/good-trees"
|
||||||
|
|
||||||
|
mkdir -p "$cache_dir"
|
||||||
|
|
||||||
skip_branch_tip_with_tag
|
skip_branch_tip_with_tag
|
||||||
skip_good_tree
|
skip_good_tree
|
||||||
|
|
|
@ -3,31 +3,58 @@
|
||||||
# Build and test Git in a 32-bit environment
|
# Build and test Git in a 32-bit environment
|
||||||
#
|
#
|
||||||
# Usage:
|
# Usage:
|
||||||
# run-linux32-build.sh [host-user-id]
|
# run-linux32-build.sh <host-user-id>
|
||||||
#
|
#
|
||||||
|
|
||||||
set -x
|
set -ex
|
||||||
|
|
||||||
|
if test $# -ne 1 || test -z "$1"
|
||||||
|
then
|
||||||
|
echo >&2 "usage: run-linux32-build.sh <host-user-id>"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
# Update packages to the latest available versions
|
# Update packages to the latest available versions
|
||||||
linux32 --32bit i386 sh -c '
|
linux32 --32bit i386 sh -c '
|
||||||
apt update >/dev/null &&
|
apt update >/dev/null &&
|
||||||
apt install -y build-essential libcurl4-openssl-dev libssl-dev \
|
apt install -y build-essential libcurl4-openssl-dev libssl-dev \
|
||||||
libexpat-dev gettext python >/dev/null
|
libexpat-dev gettext python >/dev/null
|
||||||
' &&
|
'
|
||||||
|
|
||||||
# If this script runs inside a docker container, then all commands are
|
# If this script runs inside a docker container, then all commands are
|
||||||
# usually executed as root. Consequently, the host user might not be
|
# usually executed as root. Consequently, the host user might not be
|
||||||
# able to access the test output files.
|
# able to access the test output files.
|
||||||
# If a host user id is given, then create a user "ci" with the host user
|
# If a non 0 host user id is given, then create a user "ci" with that
|
||||||
# id to make everything accessible to the host user.
|
# user id to make everything accessible to the host user.
|
||||||
HOST_UID=$1 &&
|
HOST_UID=$1
|
||||||
CI_USER=$USER &&
|
if test $HOST_UID -eq 0
|
||||||
test -z $HOST_UID || (CI_USER="ci" && useradd -u $HOST_UID $CI_USER) &&
|
then
|
||||||
|
# Just in case someone does want to run the test suite as root.
|
||||||
|
CI_USER=root
|
||||||
|
else
|
||||||
|
CI_USER=ci
|
||||||
|
if test "$(id -u $CI_USER 2>/dev/null)" = $HOST_UID
|
||||||
|
then
|
||||||
|
echo "user '$CI_USER' already exists with the requested ID $HOST_UID"
|
||||||
|
else
|
||||||
|
useradd -u $HOST_UID $CI_USER
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Due to a bug the test suite was run as root in the past, so
|
||||||
|
# a prove state file created back then is only accessible by
|
||||||
|
# root. Now that bug is fixed, the test suite is run as a
|
||||||
|
# regular user, but the prove state file coming from Travis
|
||||||
|
# CI's cache might still be owned by root.
|
||||||
|
# Make sure that this user has rights to any cached files,
|
||||||
|
# including an existing prove state file.
|
||||||
|
test -n "$cache_dir" && chown -R $HOST_UID:$HOST_UID "$cache_dir"
|
||||||
|
fi
|
||||||
|
|
||||||
# Build and test
|
# Build and test
|
||||||
linux32 --32bit i386 su -m -l $CI_USER -c '
|
linux32 --32bit i386 su -m -l $CI_USER -c '
|
||||||
cd /usr/src/git &&
|
set -ex
|
||||||
ln -s /tmp/travis-cache/.prove t/.prove &&
|
cd /usr/src/git
|
||||||
make --jobs=2 &&
|
test -n "$cache_dir" && ln -s "$cache_dir/.prove" t/.prove
|
||||||
make --quiet test
|
make --jobs=2
|
||||||
|
make --quiet test
|
||||||
'
|
'
|
||||||
|
|
|
@ -9,7 +9,9 @@ docker pull daald/ubuntu32:xenial
|
||||||
|
|
||||||
# Use the following command to debug the docker build locally:
|
# Use the following command to debug the docker build locally:
|
||||||
# $ docker run -itv "${PWD}:/usr/src/git" --entrypoint /bin/bash daald/ubuntu32:xenial
|
# $ docker run -itv "${PWD}:/usr/src/git" --entrypoint /bin/bash daald/ubuntu32:xenial
|
||||||
# root@container:/# /usr/src/git/ci/run-linux32-build.sh
|
# root@container:/# /usr/src/git/ci/run-linux32-build.sh <host-user-id>
|
||||||
|
|
||||||
|
container_cache_dir=/tmp/travis-cache
|
||||||
|
|
||||||
docker run \
|
docker run \
|
||||||
--interactive \
|
--interactive \
|
||||||
|
@ -18,8 +20,9 @@ docker run \
|
||||||
--env GIT_PROVE_OPTS \
|
--env GIT_PROVE_OPTS \
|
||||||
--env GIT_TEST_OPTS \
|
--env GIT_TEST_OPTS \
|
||||||
--env GIT_TEST_CLONE_2GB \
|
--env GIT_TEST_CLONE_2GB \
|
||||||
|
--env cache_dir="$container_cache_dir" \
|
||||||
--volume "${PWD}:/usr/src/git" \
|
--volume "${PWD}:/usr/src/git" \
|
||||||
--volume "${HOME}/travis-cache:/tmp/travis-cache" \
|
--volume "$cache_dir:$container_cache_dir" \
|
||||||
daald/ubuntu32:xenial \
|
daald/ubuntu32:xenial \
|
||||||
/usr/src/git/ci/run-linux32-build.sh $(id -u $USER)
|
/usr/src/git/ci/run-linux32-build.sh $(id -u $USER)
|
||||||
|
|
||||||
|
|
|
@ -5,7 +5,8 @@
|
||||||
|
|
||||||
. ${0%/*}/lib-travisci.sh
|
. ${0%/*}/lib-travisci.sh
|
||||||
|
|
||||||
ln -s $HOME/travis-cache/.prove t/.prove
|
ln -s "$cache_dir/.prove" t/.prove
|
||||||
|
|
||||||
make --quiet test
|
make --quiet test
|
||||||
if test "$jobname" = "linux-gcc"
|
if test "$jobname" = "linux-gcc"
|
||||||
then
|
then
|
||||||
|
|
Loading…
Reference in New Issue