Travis: also test on 32-bit Linux

When Git v2.9.1 was released, it had a bug that showed only on Windows and on 32-bit systems: our assumption that `unsigned long` can hold 64-bit values turned out to be wrong. This could have been caught earlier if we had a Continuous Testing set up that includes a build and test run on 32-bit Linux. Let's do this (and take care of the Windows build later). This patch asks Travis CI to install a Docker image with 32-bit libraries and then goes on to build and test Git using this 32-bit setup. Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de> Signed-off-by: Lars Schneider <larsxschneider@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Johannes Schindelin committed Mar 5, 2017 at 19:25 UTC 88dedd5e72c082b741744c393567d7e5b4d03241
2 files changed +51
.travis.yml
+21
@@ -39,6 +39,27 @@ env:
39
40 matrix:
41 include:
42 + - env: Linux32
43 + os: linux
44 + services:
45 + - docker
46 + before_install:
47 + - docker pull daald/ubuntu32:xenial
48 + before_script:
49 + script:
50 + - >
51 + docker run
52 + --interactive
53 + --env DEFAULT_TEST_TARGET
54 + --env GIT_PROVE_OPTS
55 + --env GIT_TEST_OPTS
56 + --env GIT_TEST_CLONE_2GB
57 + --volume "${PWD}:/usr/src/git"
58 + daald/ubuntu32:xenial
59 + /usr/src/git/ci/run-linux32-build.sh $(id -u $USER)
60 + # Use the following command to debug the docker build locally:
61 + # $ docker run -itv "${PWD}:/usr/src/git" --entrypoint /bin/bash daald/ubuntu32:xenial
62 + # root@container:/# /usr/src/git/ci/run-linux32-build.sh
63 - env: Documentation
64 os: linux
65 compiler: clang
ci/run-linux32-build.sh new
+30
@@ -0,0 +1,30 @@
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 +
9 +# Update packages to the latest available versions
10 +linux32 --32bit i386 sh -c '
11 + apt update >/dev/null &&
12 + apt install -y build-essential libcurl4-openssl-dev libssl-dev \
13 + libexpat-dev gettext python >/dev/null
14 +' &&
15 +
16 +# If this script runs inside a docker container, then all commands are
17 +# usually executed as root. Consequently, the host user might not be
18 +# able to access the test output files.
19 +# If a host user id is given, then create a user "ci" with the host user
20 +# id to make everything accessible to the host user.
21 +HOST_UID=$1 &&
22 +CI_USER=$USER &&
23 +test -z $HOST_UID || (CI_USER="ci" && useradd -u $HOST_UID $CI_USER) &&
24 +
25 +# Build and test
26 +linux32 --32bit i386 su -m -l $CI_USER -c '
27 + cd /usr/src/git &&
28 + make --jobs=2 &&
29 + make --quiet test
30 +'