Unverified Commit 3bd75eee authored by Matthew Brett's avatar Matthew Brett Committed by GitHub
Browse files

Merge pull request #314 from mattip/test-images

MRG: allow choosing the test docker image

Machinery to specify docker image on which to run tests.
parents b943f33a 3ffa2d1e
...@@ -26,6 +26,7 @@ matrix: ...@@ -26,6 +26,7 @@ matrix:
env: env:
- TEST_BUILDS=1 - TEST_BUILDS=1
- MB_ML_VER=2010 - MB_ML_VER=2010
- DOCKER_TEST_IMAGE=multibuild/xenial_{PLAT}
# 32-bit builds # 32-bit builds
- os: linux - os: linux
dist: xenial dist: xenial
...@@ -38,6 +39,7 @@ matrix: ...@@ -38,6 +39,7 @@ matrix:
- TEST_BUILDS=1 - TEST_BUILDS=1
- PLAT=i686 - PLAT=i686
- MB_ML_VER=2010 - MB_ML_VER=2010
- DOCKER_TEST_IMAGE=multibuild/xenial_{PLAT}
# Builds with caching # Builds with caching
- os: linux - os: linux
dist: xenial dist: xenial
...@@ -50,6 +52,7 @@ matrix: ...@@ -50,6 +52,7 @@ matrix:
- MB_PYTHON_VERSION=pypy3.6-7.3 - MB_PYTHON_VERSION=pypy3.6-7.3
- MB_ML_VER=2014 - MB_ML_VER=2014
- TEST_BUILDS=1 - TEST_BUILDS=1
- DOCKER_TEST_IMAGE=multibuild/xenial_{PLAT}
# OSX builds # OSX builds
- os: osx - os: osx
env: env:
...@@ -101,19 +104,7 @@ matrix: ...@@ -101,19 +104,7 @@ matrix:
- VENV=venv - VENV=venv
- os: osx - os: osx
env: env:
- MB_PYTHON_VERSION=pypy-6.0 - MB_PYTHON_VERSION=pypy-7.3
- VENV=venv
- os: osx
env:
- MB_PYTHON_VERSION=pypy-7.0
- VENV=venv
- os: osx
env:
- MB_PYTHON_VERSION=pypy-7.1
- VENV=venv
- os: osx
env:
- MB_PYTHON_VERSION=pypy-7.2
- TEST_BUILDS=1 - TEST_BUILDS=1
- VENV=venv - VENV=venv
# Default OSX (xcode image) is 10.13 (xcode 9.4.1) as of 2018-08-03 # Default OSX (xcode image) is 10.13 (xcode 9.4.1) as of 2018-08-03
...@@ -193,6 +184,7 @@ matrix: ...@@ -193,6 +184,7 @@ matrix:
- MB_ML_VER=2014 - MB_ML_VER=2014
- TEST_BUILDS=1 - TEST_BUILDS=1
- PLAT=aarch64 - PLAT=aarch64
- DOCKER_TEST_IMAGE=multibuild/xenial_{PLAT}
# s390x builds # s390x builds
- os: linux - os: linux
arch: s390x arch: s390x
...@@ -201,6 +193,7 @@ matrix: ...@@ -201,6 +193,7 @@ matrix:
- MB_ML_VER=2014 - MB_ML_VER=2014
- TEST_BUILDS=1 - TEST_BUILDS=1
- PLAT=s390x - PLAT=s390x
- DOCKER_TEST_IMAGE=multibuild/xenial_{PLAT}
# ppc64le builds # ppc64le builds
- os: linux - os: linux
arch: ppc64le arch: ppc64le
...@@ -209,6 +202,7 @@ matrix: ...@@ -209,6 +202,7 @@ matrix:
- MB_ML_VER=2014 - MB_ML_VER=2014
- TEST_BUILDS=1 - TEST_BUILDS=1
- PLAT=ppc64le - PLAT=ppc64le
- DOCKER_TEST_IMAGE=multibuild/xenial_{PLAT}
script: script:
- export ENV_VARS_PATH="tests/env_vars.sh" - export ENV_VARS_PATH="tests/env_vars.sh"
......
...@@ -24,7 +24,7 @@ The AppVeyor setup is designed to build *and test*: ...@@ -24,7 +24,7 @@ The AppVeyor setup is designed to build *and test*:
* 64-bit Windows ``win_amd64`` wheels * 64-bit Windows ``win_amd64`` wheels
* 32-bit Windows ``win32`` wheels * 32-bit Windows ``win32`` wheels
You can currently build and test against Pythons 2.7, 3.5, 3.6, 3.7. You can currently build and test against Pythons 2.7, 3.5, 3.6, 3.7, 3.8
***************** *****************
How does it work? How does it work?
...@@ -78,7 +78,7 @@ Manylinux ...@@ -78,7 +78,7 @@ Manylinux
========= =========
The build phase is in a Manylinux Docker container, but the test phase is in The build phase is in a Manylinux Docker container, but the test phase is in
a clean Ubuntu 14.04 container. a clean container.
Build phase Build phase
...@@ -125,11 +125,25 @@ real ``build_wheel`` function, which now comes (by default) from ...@@ -125,11 +125,25 @@ real ``build_wheel`` function, which now comes (by default) from
Test phase Test phase
---------- ----------
Testing is in an Ubuntu 14.04 Docker container - see Specify the version to test with the ``DOCKER_TEST_IMAGE`` environment
``multibuild/docker_test_wrap.sh``. ``multibuild/travis_linux_steps.sh`` variable. The default version is dependent on ``PLAT``:
defines the ``install_run`` function, which starts up the testing Docker
container with a wrapper script ``multibuild/docker_test_wrap.sh``. The * ``matthewbrett/trusty:64``, for ``x86_64``
wrapper script sources the following bash scripts:: * ``matthewbrett/trusty:32`` for ``i686``
* ``multibuild/xenial_arm64v8`` for ``aarch64``
* ``multibuild/xenial_ppc64le`` for ``ppc64le``
* ``mutlibuild/xenial_s390x`` for ``s390x``
Other valid values are any in https://hub.docker.com/orgs/multibuild/repositories,
using the correct platform code. Alternatively, you can use the substitution
pattern ``multibuild/xenial_{PLAT}`` in the ``.travis.yml`` file.
See ``multibuild/docker_test_wrap.sh``.
``multibuild/travis_linux_steps.sh`` defines the ``install_run`` function,
which starts up the testing Docker container with the wrapper script
``multibuild/docker_test_wrap.sh``. The wrapper script sources the following
bash scripts::
multibuild/common_utils.sh multibuild/common_utils.sh
config.sh config.sh
......
...@@ -16,6 +16,12 @@ DOWNLOADS_SDIR=downloads ...@@ -16,6 +16,12 @@ DOWNLOADS_SDIR=downloads
PYPY_URL=https://bitbucket.org/pypy/pypy/downloads PYPY_URL=https://bitbucket.org/pypy/pypy/downloads
GET_PIP_URL=https://bootstrap.pypa.io/get-pip.py GET_PIP_URL=https://bootstrap.pypa.io/get-pip.py
# Unicode width, default 32. Used here and in travis_linux_steps.sh
# In docker_build_wrap.sh it is passed in when calling "docker run"
# The docker test images also use it when choosing the python to run
# with, so it is passed in when calling "docker run" for tests.
UNICODE_WIDTH=${UNICODE_WIDTH:-32}
if [ $(uname) == "Darwin" ]; then IS_OSX=1; fi if [ $(uname) == "Darwin" ]; then IS_OSX=1; fi
# Work round bug in travis xcode image described at # Work round bug in travis xcode image described at
...@@ -336,18 +342,17 @@ function install_wheel { ...@@ -336,18 +342,17 @@ function install_wheel {
local wheelhouse=$(abspath ${WHEEL_SDIR:-wheelhouse}) local wheelhouse=$(abspath ${WHEEL_SDIR:-wheelhouse})
if [ -n "$TEST_DEPENDS" ]; then if [ -n "$TEST_DEPENDS" ]; then
while read TEST_DEPENDENCY; do while read TEST_DEPENDENCY; do
pip install $(pip_opts) $@ $TEST_DEPENDENCY $PYTHON_EXE -mpip install $(pip_opts) $@ $TEST_DEPENDENCY
done <<< "$TEST_DEPENDS" done <<< "$TEST_DEPENDS"
fi fi
$PYTHON_EXE -mpip install packaging
pip install packaging local supported_wheels=$($PYTHON_EXE $MULTIBUILD_DIR/supported_wheels.py $wheelhouse/*.whl)
local supported_wheels=$(python $MULTIBUILD_DIR/supported_wheels.py $wheelhouse/*.whl)
if [ -z "$supported_wheels" ]; then if [ -z "$supported_wheels" ]; then
echo "ERROR: no supported wheels found" echo "ERROR: no supported wheels found"
exit 1 exit 1
fi fi
# Install compatible wheel # Install compatible wheel
pip install $(pip_opts) $@ $supported_wheels $PYTHON_EXE -mpip install $(pip_opts) $@ $supported_wheels
} }
function install_run { function install_run {
...@@ -458,6 +463,7 @@ function install_pypy { ...@@ -458,6 +463,7 @@ function install_pypy {
fi fi
PYTHON_EXE=$(realpath $py_build/bin/pypy) PYTHON_EXE=$(realpath $py_build/bin/pypy)
$PYTHON_EXE -mensurepip $PYTHON_EXE -mensurepip
$PYTHON_EXE -mpip install --upgrade pip setuptools wheel
if [ "$major" == "3" ] && [ ! -x "$py_build/bin/pip" ]; then if [ "$major" == "3" ] && [ ! -x "$py_build/bin/pip" ]; then
ln $py_build/bin/pip3 $py_build/bin/pip ln $py_build/bin/pip3 $py_build/bin/pip
fi fi
...@@ -560,4 +566,33 @@ function get_py_mm { ...@@ -560,4 +566,33 @@ function get_py_mm {
$PYTHON_EXE -c "import sys; print('{0}.{1}'.format(*sys.version_info[0:2]))" $PYTHON_EXE -c "import sys; print('{0}.{1}'.format(*sys.version_info[0:2]))"
} }
function cpython_path {
# Return path to cpython given
# * version (of form "2.7")
# * u_width ("16" or "32" default "32")
#
# For back-compatibility "u" as u_width also means "32"
local py_ver="${1:-2.7}"
local abi_suff=m
local u_width="${2:-${UNICODE_WIDTH}}"
local u_suff=u
# Python 3.8 and up no longer uses the PYMALLOC 'm' suffix
# https://github.com/pypa/wheel/pull/303
if [ $(lex_ver $py_ver) -ge $(lex_ver 3.8) ]; then
abi_suff=""
fi
# Back-compatibility
if [ "$u_width" == "u" ]; then u_width=32; fi
# For Python >= 3.4, "u" suffix not meaningful
if [ $(lex_ver $py_ver) -ge $(lex_ver 3.4) ] ||
[ "$u_width" == "16" ]; then
u_suff=""
elif [ "$u_width" == "" ]; then
u_width="32"
elif [ "$u_width" != "32" ]; then
echo "Incorrect u_width value $u_width"
exit 1
fi
local no_dots=$(echo $py_ver | tr -d .)
echo "/opt/python/cp${no_dots}-cp${no_dots}$abi_suff${u_suff}"
}
...@@ -11,9 +11,6 @@ set -e ...@@ -11,9 +11,6 @@ set -e
# Change into root directory of repo # Change into root directory of repo
cd /io cd /io
# Unicode width, default 32
UNICODE_WIDTH=${UNICODE_WIDTH:-32}
# Location of wheels, default "wheelhouse" # Location of wheels, default "wheelhouse"
WHEEL_SDIR=${WHEEL_SDIR:-wheelhouse} WHEEL_SDIR=${WHEEL_SDIR:-wheelhouse}
......
...@@ -2,6 +2,13 @@ ...@@ -2,6 +2,13 @@
# Install and test steps on Linux # Install and test steps on Linux
set -e set -e
# "python" and "pip" are already on the path as part of the docker
# startup code in choose_python.sh, but the following are required and not
# necessarily already set
PYTHON_EXE=${PYTHON_EXE:-python}
PIP_CMD=${PIP_CMD:-pip}
# Get needed utilities # Get needed utilities
MULTIBUILD_DIR=$(dirname "${BASH_SOURCE[0]}") MULTIBUILD_DIR=$(dirname "${BASH_SOURCE[0]}")
source $MULTIBUILD_DIR/common_utils.sh source $MULTIBUILD_DIR/common_utils.sh
......
...@@ -4,43 +4,11 @@ ...@@ -4,43 +4,11 @@
MULTIBUILD_DIR=$(dirname "${BASH_SOURCE[0]}") MULTIBUILD_DIR=$(dirname "${BASH_SOURCE[0]}")
source $MULTIBUILD_DIR/common_utils.sh source $MULTIBUILD_DIR/common_utils.sh
# UNICODE_WIDTH selects "32"=wide (UCS4) or "16"=narrow (UCS2/UTF16) builds
UNICODE_WIDTH="${UNICODE_WIDTH:-32}"
function get_platform { function get_platform {
# Report platform as given by uname # Report platform as given by uname
python -c 'import platform; print(platform.uname()[4])' python -c 'import platform; print(platform.uname()[4])'
} }
function cpython_path {
# Return path to cpython given
# * version (of form "2.7")
# * u_width ("16" or "32" default "32")
#
# For back-compatibility "u" as u_width also means "32"
local py_ver="${1:-2.7}"
local abi_suff=m
local u_width="${2:-${UNICODE_WIDTH}}"
local u_suff=u
# Python 3.8 and up no longer uses the PYMALLOC 'm' suffix
# https://github.com/pypa/wheel/pull/303
if [ $(lex_ver $py_ver) -ge $(lex_ver 3.8) ]; then
abi_suff=""
fi
# Back-compatibility
if [ "$u_width" == "u" ]; then u_width=32; fi
# For Python >= 3.4, "u" suffix not meaningful
if [ $(lex_ver $py_ver) -ge $(lex_ver 3.4) ] ||
[ "$u_width" == "16" ]; then
u_suff=""
elif [ "$u_width" != "32" ]; then
echo "Incorrect u_width value $u_width"
exit 1
fi
local no_dots=$(echo $py_ver | tr -d .)
echo "/opt/python/cp${no_dots}-cp${no_dots}$abi_suff${u_suff}"
}
function repair_wheelhouse { function repair_wheelhouse {
local in_dir=$1 local in_dir=$1
local out_dir=${2:-$in_dir} local out_dir=${2:-$in_dir}
......
...@@ -34,6 +34,5 @@ def main(): ...@@ -34,6 +34,5 @@ def main():
if supported.intersection(tags): if supported.intersection(tags):
print(fname) print(fname)
if __name__ == '__main__': if __name__ == '__main__':
main() main()
function run_tests {
$PYTHON_EXE -c "import simplejson"
}
...@@ -31,6 +31,7 @@ if [ -n "$TEST_BUILDS" ]; then ...@@ -31,6 +31,7 @@ if [ -n "$TEST_BUILDS" ]; then
# Will be set automatically by docker call in build_multilinux below. # Will be set automatically by docker call in build_multilinux below.
PYTHON_VERSION=${MB_PYTHON_VERSION} PYTHON_VERSION=${MB_PYTHON_VERSION}
source tests/test_library_builders.sh source tests/test_library_builders.sh
source tests/config.sh
elif [ ! -x "$(command -v docker)" ]; then elif [ ! -x "$(command -v docker)" ]; then
echo "Skipping build tests; no docker available" echo "Skipping build tests; no docker available"
else else
...@@ -42,7 +43,10 @@ if [ -n "$TEST_BUILDS" ]; then ...@@ -42,7 +43,10 @@ if [ -n "$TEST_BUILDS" ]; then
source tests/test_library_builders.sh source tests/test_library_builders.sh
" "
build_multilinux $my_plat "pip install simplejson" build_multilinux $my_plat "pip install simplejson"
CONFIG_PATH=tests/config.sh
fi fi
build_index_wheel simplejson
install_run $PLAT
fi fi
source tests/test_supported_wheels.sh source tests/test_supported_wheels.sh
......
...@@ -119,9 +119,16 @@ function install_run { ...@@ -119,9 +119,16 @@ function install_run {
# WHEEL_SDIR (optional) # WHEEL_SDIR (optional)
# MANYLINUX_URL (optional) # MANYLINUX_URL (optional)
# TEST_DEPENDS (optional) # TEST_DEPENDS (optional)
# MB_TEST_VER (optional)
local plat=${1:-${PLAT:-x86_64}} local plat=${1:-${PLAT:-x86_64}}
bitness=$([ "$plat" == i686 ] && echo 32 || echo 64) if [ -z "$DOCKER_TEST_IMAGE" ]; then
local docker_image="matthewbrett/trusty:$bitness" local bitness=$([ "$plat" == i686 ] && echo 32 || echo 64)
local docker_image="matthewbrett/trusty:$bitness"
else
# aarch64 is called arm64v8 in Ubuntu
local plat_subst=$([ "$plat" == aarch64 ] && echo arm64v8 || echo $plat)
local docker_image="${DOCKER_TEST_IMAGE/\{PLAT\}/$plat_subst}"
fi
docker pull $docker_image docker pull $docker_image
docker run --rm \ docker run --rm \
-e PYTHON_VERSION="$MB_PYTHON_VERSION" \ -e PYTHON_VERSION="$MB_PYTHON_VERSION" \
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment