{"thread":{"id":"45295","subject":"[PATCH v3] Travis: also test on 32-bit Linux","startedAt":"2017-03-05T18:33:54Z","lastAt":"2017-03-06T19:22:15Z","messageCount":2,"participants":["Lars Schneider","Junio C Hamano"],"isPatch":true,"patchVersion":3,"patchTotal":null},"messages":[{"id":"313299","messageId":"20170305182519.98925-1-larsxschneider@gmail.com","threadId":"45295","inReplyTo":null,"subject":"[PATCH v3] Travis: also test on 32-bit Linux","fromName":"Lars Schneider","fromEmail":"larsxschneider@gmail.com","sentAt":"2017-03-05T18:25:19Z","receivedAt":"2017-03-05T18:33:54Z","isPatch":true,"sender":{"key":"larsxschneider@gmail.com","avatar":"https://avatars.githubusercontent.com/u/477434?v=4"},"body":"From: Johannes Schindelin <johannes.schindelin@gmx.de>\n\nWhen Git v2.9.1 was released, it had a bug that showed only on Windows\nand on 32-bit systems: our assumption that `unsigned long` can hold\n64-bit values turned out to be wrong.\n\nThis could have been caught earlier if we had a Continuous Testing\nset up that includes a build and test run on 32-bit Linux.\n\nLet's do this (and take care of the Windows build later). This patch\nasks Travis CI to install a Docker image with 32-bit libraries and then\ngoes on to build and test Git using this 32-bit setup.\n\nSigned-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>\nSigned-off-by: Lars Schneider <larsxschneider@gmail.com>\n---\n\nHi,\n\nwhen I looked into the 32-bit/line-log issue [1], I realized that my\nproposed docker setup is not ideal for local debugging. Here is an\napproach that I think is better. I changed the following:\n    - disable sudo as it is not required for the Travis job\n    - keep all docker commands in the .travis.yml\n    - add option to run commands inside docker with the same UID as the\n      host user to make output files accessible\n    - pass environment variables directly to the docker container\n\nSorry for the back and forth.\n\nCheers,\nLars\n\n\n[1] http://public-inbox.org/git/2205F1A7-A694-4F40-B994-D68C3947F2BB@gmail.com/\n\n\nNotes:\n    Base Ref: master\n    Web-Diff: https://github.com/larsxschneider/git/commit/a6fe1def16\n    Checkout: git fetch https://github.com/larsxschneider/git travisci/linux32-v3 && git checkout a6fe1def16\n\n    Interdiff (v2..v3):\n\n    diff --git a/.travis.yml b/.travis.yml\n    index fd60fd8328..591cc57b80 100644\n    --- a/.travis.yml\n    +++ b/.travis.yml\n    @@ -41,13 +41,25 @@ matrix:\n       include:\n         - env: Linux32\n           os: linux\n    -      sudo: required\n           services:\n             - docker\n           before_install:\n             - docker pull daald/ubuntu32:xenial\n           before_script:\n    -      script: ci/run-linux32-build.sh daald/ubuntu32:xenial\n    +      script:\n    +        - >\n    +          docker run\n    +          --interactive\n    +          --env DEFAULT_TEST_TARGET\n    +          --env GIT_PROVE_OPTS\n    +          --env GIT_TEST_OPTS\n    +          --env GIT_TEST_CLONE_2GB\n    +          --volume \"${PWD}:/usr/src/git\"\n    +          daald/ubuntu32:xenial\n    +          /usr/src/git/ci/run-linux32-build.sh $(id -u $USER)\n    +        # Use the following command to debug the docker build locally:\n    +        # $ docker run -itv \"${PWD}:/usr/src/git\" --entrypoint /bin/bash daald/ubuntu32:xenial\n    +        # root@container:/# /usr/src/git/ci/run-linux32-build.sh\n         - env: Documentation\n           os: linux\n           compiler: clang\n    diff --git a/ci/run-linux32-build.sh b/ci/run-linux32-build.sh\n    index 13c184d41c..f7a3434985 100755\n    --- a/ci/run-linux32-build.sh\n    +++ b/ci/run-linux32-build.sh\n    @@ -1,31 +1,30 @@\n     #!/bin/sh\n     #\n    -# Build and test Git in a docker container running a 32-bit Ubuntu Linux\n    +# Build and test Git in a 32-bit environment\n     #\n     # Usage:\n    -#   run-linux32-build.sh [container-image]\n    +#   run-linux32-build.sh [host-user-id]\n     #\n\n    -CONTAINER=\"${1:-daald/ubuntu32:xenial}\"\n    -\n    -sudo docker run --interactive --volume \"${PWD}:/usr/src/git\" \"$CONTAINER\" \\\n    -    /bin/bash -c 'linux32 --32bit i386 sh -c \"\n    -    : update packages &&\n    +# Update packages to the latest available versions\n    +linux32 --32bit i386 sh -c '\n         apt update >/dev/null &&\n         apt install -y build-essential libcurl4-openssl-dev libssl-dev \\\n    -        libexpat-dev gettext python >/dev/null &&\n    +        libexpat-dev gettext python >/dev/null\n    +' &&\n    +\n    +# If this script runs inside a docker container, then all commands are\n    +# usually executed as root. Consequently, the host user might not be\n    +# able to access the test output files.\n    +# If a host user id is given, then create a user \"ci\" with the host user\n    +# id to make everything accessible to the host user.\n    +HOST_UID=$1 &&\n    +CI_USER=$USER &&\n    +test -z $HOST_UID || (CI_USER=\"ci\" && useradd -u $HOST_UID $CI_USER) &&\n\n    -    : build and test &&\n    +# Build and test\n    +linux32 --32bit i386 su -m -l $CI_USER -c '\n         cd /usr/src/git &&\n    -    export DEFAULT_TEST_TARGET='$DEFAULT_TEST_TARGET' &&\n    -    export GIT_PROVE_OPTS=\\\"'\"$GIT_PROVE_OPTS\"'\\\" &&\n    -    export GIT_TEST_OPTS=\\\"'\"$GIT_TEST_OPTS\"'\\\" &&\n    -    export GIT_TEST_CLONE_2GB='$GIT_TEST_CLONE_2GB' &&\n         make --jobs=2 &&\n    -    make --quiet test || (\n    -\n    -    : make test-results readable to non-root user on TravisCI &&\n    -    test '$TRAVIS' &&\n    -    find t/test-results/ -type f -exec chmod o+r {} \\; &&\n    -    false )\n    -\"'\n    +    make --quiet test\n    +'\n\n    \\0\n\n .travis.yml             | 21 +++++++++++++++++++++\n ci/run-linux32-build.sh | 30 ++++++++++++++++++++++++++++++\n 2 files changed, 51 insertions(+)\n create mode 100755 ci/run-linux32-build.sh\n\ndiff --git a/.travis.yml b/.travis.yml\nindex 9c63c8c3f6..591cc57b80 100644\n--- a/.travis.yml\n+++ b/.travis.yml\n@@ -39,6 +39,27 @@ env:\n\n matrix:\n   include:\n+    - env: Linux32\n+      os: linux\n+      services:\n+        - docker\n+      before_install:\n+        - docker pull daald/ubuntu32:xenial\n+      before_script:\n+      script:\n+        - >\n+          docker run\n+          --interactive\n+          --env DEFAULT_TEST_TARGET\n+          --env GIT_PROVE_OPTS\n+          --env GIT_TEST_OPTS\n+          --env GIT_TEST_CLONE_2GB\n+          --volume \"${PWD}:/usr/src/git\"\n+          daald/ubuntu32:xenial\n+          /usr/src/git/ci/run-linux32-build.sh $(id -u $USER)\n+        # Use the following command to debug the docker build locally:\n+        # $ docker run -itv \"${PWD}:/usr/src/git\" --entrypoint /bin/bash daald/ubuntu32:xenial\n+        # root@container:/# /usr/src/git/ci/run-linux32-build.sh\n     - env: Documentation\n       os: linux\n       compiler: clang\ndiff --git a/ci/run-linux32-build.sh b/ci/run-linux32-build.sh\nnew file mode 100755\nindex 0000000000..f7a3434985\n--- /dev/null\n+++ b/ci/run-linux32-build.sh\n@@ -0,0 +1,30 @@\n+#!/bin/sh\n+#\n+# Build and test Git in a 32-bit environment\n+#\n+# Usage:\n+#   run-linux32-build.sh [host-user-id]\n+#\n+\n+# Update packages to the latest available versions\n+linux32 --32bit i386 sh -c '\n+    apt update >/dev/null &&\n+    apt install -y build-essential libcurl4-openssl-dev libssl-dev \\\n+        libexpat-dev gettext python >/dev/null\n+' &&\n+\n+# If this script runs inside a docker container, then all commands are\n+# usually executed as root. Consequently, the host user might not be\n+# able to access the test output files.\n+# If a host user id is given, then create a user \"ci\" with the host user\n+# id to make everything accessible to the host user.\n+HOST_UID=$1 &&\n+CI_USER=$USER &&\n+test -z $HOST_UID || (CI_USER=\"ci\" && useradd -u $HOST_UID $CI_USER) &&\n+\n+# Build and test\n+linux32 --32bit i386 su -m -l $CI_USER -c '\n+    cd /usr/src/git &&\n+    make --jobs=2 &&\n+    make --quiet test\n+'\n\nbase-commit: 3bc53220cb2dcf709f7a027a3f526befd021d858\n--\n2.11.1\n\n"},{"id":"313349","messageId":"xmqqmvcynrd5.fsf@junio-linux.mtv.corp.google.com","threadId":"45295","inReplyTo":"20170305182519.98925-1-larsxschneider@gmail.com","subject":"Re: [PATCH v3] Travis: also test on 32-bit Linux","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2017-03-06T19:21:26Z","receivedAt":"2017-03-06T19:22:15Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Lars Schneider <larsxschneider@gmail.com> writes:\n\n> when I looked into the 32-bit/line-log issue [1], I realized that my\n> proposed docker setup is not ideal for local debugging. Here is an\n> approach that I think is better. I changed the following:\n>     - disable sudo as it is not required for the Travis job\n>     - keep all docker commands in the .travis.yml\n>     - add option to run commands inside docker with the same UID as the\n>       host user to make output files accessible\n>     - pass environment variables directly to the docker container\n>\n> Sorry for the back and forth.\n\nAnything that makes further diag easier when a problem is spotted by\nthe automated machinery is a very welcome change.\n\nWill replace; let's see what others think.\n\nThanks.\n\n"}]}