Skip to content

Commit

Permalink
Add manylinux_2_24 tests (#266)
Browse files Browse the repository at this point in the history
  • Loading branch information
mayeut authored Mar 27, 2021
1 parent 28964ef commit bcf8083
Show file tree
Hide file tree
Showing 4 changed files with 33 additions and 7 deletions.
28 changes: 23 additions & 5 deletions tests/integration/test_manylinux.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,16 @@

ENCODING = 'utf-8'
PLATFORM = get_arch_name()
MANYLINUX1_IMAGE_ID = f'quay.io/pypa/manylinux1_{PLATFORM}'
MANYLINUX2010_IMAGE_ID = f'quay.io/pypa/manylinux2010_{PLATFORM}'
MANYLINUX1_IMAGE_ID = f'quay.io/pypa/manylinux1_{PLATFORM}:latest'
MANYLINUX2010_IMAGE_ID = f'quay.io/pypa/manylinux2010_{PLATFORM}:latest'
MANYLINUX2014_IMAGE_ID = f'quay.io/pypa/manylinux2014_{PLATFORM}:latest'
MANYLINUX_2_24_IMAGE_ID = f'quay.io/pypa/manylinux_2_24_{PLATFORM}:latest'
if PLATFORM in {'i686', 'x86_64'}:
MANYLINUX_IMAGES = {
'manylinux_2_5': MANYLINUX1_IMAGE_ID,
'manylinux_2_12': MANYLINUX2010_IMAGE_ID,
'manylinux_2_17': MANYLINUX2014_IMAGE_ID,
'manylinux_2_24': MANYLINUX_2_24_IMAGE_ID,
}
POLICY_ALIASES = {
'manylinux_2_5': ['manylinux1'],
Expand All @@ -37,6 +39,7 @@
else:
MANYLINUX_IMAGES = {
'manylinux_2_17': MANYLINUX2014_IMAGE_ID,
'manylinux_2_24': MANYLINUX_2_24_IMAGE_ID,
}
POLICY_ALIASES = {
'manylinux_2_17': ['manylinux2014'],
Expand All @@ -51,6 +54,7 @@
'manylinux_2_5': 'devtoolset-2',
'manylinux_2_12': 'devtoolset-8',
'manylinux_2_17': 'devtoolset-9',
'manylinux_2_24': 'devtoolset-not-present',
}
PATH_DIRS = [
f'/opt/python/{PYTHON_ABI}/bin',
Expand Down Expand Up @@ -160,7 +164,7 @@ def tmp_docker_image(base, commands, setup_env={}):
@pytest.fixture(scope='session')
def docker_python_img():
"""The Python base image with up-to-date pip"""
with tmp_docker_image(PYTHON_IMAGE_ID, ['pip install pip']) as img_id:
with tmp_docker_image(PYTHON_IMAGE_ID, ['pip install -U pip']) as img_id:
yield img_id


Expand Down Expand Up @@ -234,7 +238,14 @@ def test_build_repair_numpy(any_manylinux_container, docker_python, io_folder):
# First build numpy from source as a naive linux wheel that is tied
# to system libraries (atlas, libgfortran...)
policy, tag, manylinux_ctr = any_manylinux_container
docker_exec(manylinux_ctr, 'yum install -y atlas atlas-devel')
if policy.startswith('manylinux_2_24_'):
docker_exec(manylinux_ctr, 'apt-get update')
docker_exec(
manylinux_ctr,
'apt-get install -y --no-install-recommends libatlas-dev'
)
else:
docker_exec(manylinux_ctr, 'yum install -y atlas atlas-devel')

if op.exists(op.join(WHEEL_CACHE_FOLDER, policy, ORIGINAL_NUMPY_WHEEL)):
# If numpy has already been built and put in cache, let's reuse this.
Expand Down Expand Up @@ -290,7 +301,14 @@ def test_build_wheel_with_binary_executable(any_manylinux_container, docker_pyth
# Test building a wheel that contains a binary executable (e.g., a program)

policy, tag, manylinux_ctr = any_manylinux_container
docker_exec(manylinux_ctr, 'yum install -y gsl-devel')
if policy.startswith('manylinux_2_24_'):
docker_exec(manylinux_ctr, 'apt-get update')
docker_exec(
manylinux_ctr,
'apt-get install -y --no-install-recommends libgsl-dev'
)
else:
docker_exec(manylinux_ctr, 'yum install -y gsl-devel')

docker_exec(
manylinux_ctr,
Expand Down
5 changes: 4 additions & 1 deletion tests/integration/testdependencies/dependency.c
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,13 @@
#include <malloc.h>
#include <stdlib.h>
#include <stdint.h>
#include <math.h>

int dep_run()
{
#if defined(__GLIBC_PREREQ) && __GLIBC_PREREQ(2, 17)
#if defined(__GLIBC_PREREQ) && __GLIBC_PREREQ(2, 24)
return (int)nextupf(0.0F);
#elif defined(__GLIBC_PREREQ) && __GLIBC_PREREQ(2, 17)
return (int)(intptr_t)secure_getenv("NON_EXISTING_ENV_VARIABLE");
#elif defined(__GLIBC_PREREQ) && __GLIBC_PREREQ(2, 10)
return malloc_info(0, stdout);
Expand Down
4 changes: 3 additions & 1 deletion tests/integration/testdependencies/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
from os import path
from os import getenv

cmd = 'gcc -shared -fPIC -D_GNU_SOURCE dependency.c -o libdependency.so'
cmd = 'gcc -shared -fPIC -D_GNU_SOURCE dependency.c -o libdependency.so -lm -lc'
subprocess.check_call(cmd.split())

define_macros = [('_GNU_SOURCE', None)]
Expand All @@ -15,6 +15,8 @@
library_dirs.append(path.abspath(path.dirname(__file__)))
define_macros.append(('WITH_DEPENDENCY', '1'))

libraries.extend(['m', 'c'])

setup(
name='testdependencies',
version='0.0.1',
Expand Down
3 changes: 3 additions & 0 deletions tests/integration/testdependencies/testdependencies.c
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
#include <malloc.h>
#include <stdlib.h>
#include <stdint.h>
#include <math.h>
#endif
#include <Python.h>

Expand All @@ -19,6 +20,8 @@ run(PyObject *self, PyObject *args)

#ifdef WITH_DEPENDENCY
res = dep_run();
#elif defined(__GLIBC_PREREQ) && __GLIBC_PREREQ(2, 24)
res = (int)nextupf(0.0F);
#elif defined(__GLIBC_PREREQ) && __GLIBC_PREREQ(2, 17)
res = (int)(intptr_t)secure_getenv("NON_EXISTING_ENV_VARIABLE");
#elif defined(__GLIBC_PREREQ) && __GLIBC_PREREQ(2, 10)
Expand Down

0 comments on commit bcf8083

Please sign in to comment.