1#!/bin/sh 2# 3# Build and test Git in a 32-bit environment 4# 5# Usage: 6# run-linux32-build.sh <host-user-id> 7# 8 9set -ex 10 11iftest$#-ne1||test -z"$1" 12then 13echo>&2"usage: run-linux32-build.sh <host-user-id>" 14exit1 15fi 16 17# Update packages to the latest available versions 18linux32 --32bit i386 sh -c' 19 apt update >/dev/null && 20 apt install -y build-essential libcurl4-openssl-dev libssl-dev \ 21 libexpat-dev gettext python >/dev/null 22' 23 24# If this script runs inside a docker container, then all commands are 25# usually executed as root. Consequently, the host user might not be 26# able to access the test output files. 27# If a non 0 host user id is given, then create a user "ci" with that 28# user id to make everything accessible to the host user. 29HOST_UID=$1 30iftest$HOST_UID-eq0 31then 32# Just in case someone does want to run the test suite as root. 33 CI_USER=root 34else 35 CI_USER=ci 36 useradd -u$HOST_UID $CI_USER 37# Due to a bug the test suite was run as root in the past, so 38# a prove state file created back then is only accessible by 39# root. Now that bug is fixed, the test suite is run as a 40# regular user, but the prove state file coming from Travis 41# CI's cache might still be owned by root. 42# Make sure that this user has rights to any cached files, 43# including an existing prove state file. 44test -n"$cache_dir"&& chown -R$HOST_UID:$HOST_UID"$cache_dir" 45fi 46 47# Build and test 48linux32 --32bit i386 su -m -l$CI_USER-c' 49 set -ex 50 cd /usr/src/git 51 test -n "$cache_dir" && ln -s "$cache_dir/.prove" t/.prove 52 make --jobs=2 53 make --quiet test 54'