blob: 2c60d2e70ae56b59b1ff8046a21b9bc4bf87e3e6 [file] [log] [blame]
# Build and test Git in a 32-bit environment
# Usage:
# <host-user-id>
set -ex
if test $# -ne 1 || test -z "$1"
echo >&2 "usage: <host-user-id>"
exit 1
# Update packages to the latest available versions
linux32 --32bit i386 sh -c '
apt update >/dev/null &&
apt install -y build-essential libcurl4-openssl-dev libssl-dev \
libexpat-dev gettext python >/dev/null
# If this script runs inside a docker container, then all commands are
# usually executed as root. Consequently, the host user might not be
# able to access the test output files.
# If a non 0 host user id is given, then create a user "ci" with that
# user id to make everything accessible to the host user.
if test $HOST_UID -eq 0
# Just in case someone does want to run the test suite as root.
if test "$(id -u $CI_USER 2>/dev/null)" = $HOST_UID
echo "user '$CI_USER' already exists with the requested ID $HOST_UID"
useradd -u $HOST_UID $CI_USER
# 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"
# Build and test
linux32 --32bit i386 su -m -l $CI_USER -c '
set -ex
cd /usr/src/git
test -n "$cache_dir" && ln -s "$cache_dir/.prove" t/.prove
make --jobs=2
make --quiet test