Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions tests/integration/test_glibcxx_3_4_25/setup.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
from setuptools import Extension, setup

setup(
name="testentropy",
version="0.0.1",
ext_modules=[
Extension(
"testentropy",
language="c++",
sources=["testentropy.cpp"],
extra_compile_args=["-std=c++11"],
),
],
)
28 changes: 28 additions & 0 deletions tests/integration/test_glibcxx_3_4_25/testentropy.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
#include <Python.h>
#include <random>

static PyObject *
run(PyObject *self, PyObject *args)
{
(void)self;
(void)args;
std::random_device rd;
return PyLong_FromLong(rd.entropy() >= 0.0 ? 0 : -1);
}

/* Module initialization */
PyMODINIT_FUNC PyInit_testentropy(void)
{
static PyMethodDef module_methods[] = {
{"run", (PyCFunction)run, METH_NOARGS, "run."},
{NULL} /* Sentinel */
};
static struct PyModuleDef moduledef = {
PyModuleDef_HEAD_INIT,
"testentropy",
"testentropy module",
-1,
module_methods,
};
return PyModule_Create(&moduledef);
}
45 changes: 45 additions & 0 deletions tests/integration/test_manylinux.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,14 @@
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"
MANYLINUX_2_28_IMAGE_ID = f"quay.io/pypa/manylinux_2_28_{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,
"manylinux_2_28": MANYLINUX_2_28_IMAGE_ID,
}
POLICY_ALIASES = {
"manylinux_2_5": ["manylinux1"],
Expand All @@ -42,6 +44,8 @@
"manylinux_2_17": MANYLINUX2014_IMAGE_ID,
"manylinux_2_24": MANYLINUX_2_24_IMAGE_ID,
}
if PLATFORM in {"aarch64", "ppc64le"}:
MANYLINUX_IMAGES["manylinux_2_28"] = MANYLINUX_2_28_IMAGE_ID
POLICY_ALIASES = {
"manylinux_2_17": ["manylinux2014"],
}
Expand All @@ -60,6 +64,7 @@
"manylinux_2_12": "devtoolset-8",
"manylinux_2_17": "devtoolset-10",
"manylinux_2_24": "devtoolset-not-present",
"manylinux_2_28": "gcc-toolset-11",
"musllinux_1_1": "devtoolset-not-present",
}
PATH_DIRS = [
Expand Down Expand Up @@ -688,6 +693,46 @@ def test_nonpy_rpath(self, any_manylinux_container, docker_python, io_folder):
],
)

def test_glibcxx_3_4_25(self, any_manylinux_container, docker_python, io_folder):
policy, tag, manylinux_ctr = any_manylinux_container
docker_exec(
manylinux_ctr,
[
"bash",
"-c",
"cd /auditwheel_src/tests/integration/test_glibcxx_3_4_25 && "
"if [ -d ./build ]; then rm -rf ./build ./*.egg-info; fi && "
"python -m pip wheel --no-deps -w /io .",
],
)

orig_wheel, *_ = os.listdir(io_folder)
assert orig_wheel.startswith("testentropy-0.0.1")

# Repair the wheel using the appropriate manylinux container
repair_command = f"auditwheel repair --plat {policy} -w /io /io/{orig_wheel}"
if policy.startswith("manylinux_2_28_"):
with pytest.raises(CalledProcessError):
docker_exec(manylinux_ctr, repair_command)
# TODO if a "permissive" mode is implemented, add the relevant flag to the
# repair_command here and drop the return statement below
return

docker_exec(manylinux_ctr, repair_command)

repaired_wheel, *_ = glob.glob(f"{io_folder}/*{policy}*.whl")
repaired_wheel = os.path.basename(repaired_wheel)

docker_exec(docker_python, "pip install /io/" + repaired_wheel)
docker_exec(
docker_python,
[
"python",
"-c",
"from testentropy import run; exit(run())",
],
)


class TestManylinux(Anylinux):
@pytest.fixture(scope="session")
Expand Down
7 changes: 6 additions & 1 deletion tests/integration/testdependencies/dependency.c
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,15 @@
#include <stdlib.h>
#include <stdint.h>
#include <math.h>
#if defined(__GLIBC_PREREQ) && __GLIBC_PREREQ(2, 28)
#include <threads.h>
#endif

int dep_run()
{
#if defined(__GLIBC_PREREQ) && __GLIBC_PREREQ(2, 24)
#if defined(__GLIBC_PREREQ) && __GLIBC_PREREQ(2, 28)
return thrd_equal(thrd_current(), thrd_current()) ? 0 : 1;
#elif 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");
Expand Down
5 changes: 5 additions & 0 deletions tests/integration/testdependencies/testdependencies.c
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@
#include <stdlib.h>
#include <stdint.h>
#include <math.h>
#if defined(__GLIBC_PREREQ) && __GLIBC_PREREQ(2, 28)
#include <threads.h>
#endif
#endif
#include <Python.h>

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

#ifdef WITH_DEPENDENCY
res = dep_run();
#elif defined(__GLIBC_PREREQ) && __GLIBC_PREREQ(2, 28)
res = thrd_equal(thrd_current(), thrd_current()) ? 0 : 1;
#elif defined(__GLIBC_PREREQ) && __GLIBC_PREREQ(2, 24)
res = (int)nextupf(0.0F);
#elif defined(__GLIBC_PREREQ) && __GLIBC_PREREQ(2, 17)
Expand Down