Skip to content

Commit 55bc5ee

Browse files
authored
Merge pull request #369 from mayeut/manylinux_2_28
test: add manylinux_2_28 tests
2 parents fe45465 + 3d9bb59 commit 55bc5ee

File tree

5 files changed

+98
-1
lines changed

5 files changed

+98
-1
lines changed

Diff for: tests/integration/test_glibcxx_3_4_25/setup.py

+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
from setuptools import Extension, setup
2+
3+
setup(
4+
name="testentropy",
5+
version="0.0.1",
6+
ext_modules=[
7+
Extension(
8+
"testentropy",
9+
language="c++",
10+
sources=["testentropy.cpp"],
11+
extra_compile_args=["-std=c++11"],
12+
),
13+
],
14+
)
+28
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
#include <Python.h>
2+
#include <random>
3+
4+
static PyObject *
5+
run(PyObject *self, PyObject *args)
6+
{
7+
(void)self;
8+
(void)args;
9+
std::random_device rd;
10+
return PyLong_FromLong(rd.entropy() >= 0.0 ? 0 : -1);
11+
}
12+
13+
/* Module initialization */
14+
PyMODINIT_FUNC PyInit_testentropy(void)
15+
{
16+
static PyMethodDef module_methods[] = {
17+
{"run", (PyCFunction)run, METH_NOARGS, "run."},
18+
{NULL} /* Sentinel */
19+
};
20+
static struct PyModuleDef moduledef = {
21+
PyModuleDef_HEAD_INIT,
22+
"testentropy",
23+
"testentropy module",
24+
-1,
25+
module_methods,
26+
};
27+
return PyModule_Create(&moduledef);
28+
}

Diff for: tests/integration/test_manylinux.py

+45
Original file line numberDiff line numberDiff line change
@@ -25,12 +25,14 @@
2525
MANYLINUX2010_IMAGE_ID = f"quay.io/pypa/manylinux2010_{PLATFORM}:latest"
2626
MANYLINUX2014_IMAGE_ID = f"quay.io/pypa/manylinux2014_{PLATFORM}:latest"
2727
MANYLINUX_2_24_IMAGE_ID = f"quay.io/pypa/manylinux_2_24_{PLATFORM}:latest"
28+
MANYLINUX_2_28_IMAGE_ID = f"quay.io/pypa/manylinux_2_28_{PLATFORM}:latest"
2829
if PLATFORM in {"i686", "x86_64"}:
2930
MANYLINUX_IMAGES = {
3031
"manylinux_2_5": MANYLINUX1_IMAGE_ID,
3132
"manylinux_2_12": MANYLINUX2010_IMAGE_ID,
3233
"manylinux_2_17": MANYLINUX2014_IMAGE_ID,
3334
"manylinux_2_24": MANYLINUX_2_24_IMAGE_ID,
35+
"manylinux_2_28": MANYLINUX_2_28_IMAGE_ID,
3436
}
3537
POLICY_ALIASES = {
3638
"manylinux_2_5": ["manylinux1"],
@@ -42,6 +44,8 @@
4244
"manylinux_2_17": MANYLINUX2014_IMAGE_ID,
4345
"manylinux_2_24": MANYLINUX_2_24_IMAGE_ID,
4446
}
47+
if PLATFORM in {"aarch64", "ppc64le"}:
48+
MANYLINUX_IMAGES["manylinux_2_28"] = MANYLINUX_2_28_IMAGE_ID
4549
POLICY_ALIASES = {
4650
"manylinux_2_17": ["manylinux2014"],
4751
}
@@ -60,6 +64,7 @@
6064
"manylinux_2_12": "devtoolset-8",
6165
"manylinux_2_17": "devtoolset-10",
6266
"manylinux_2_24": "devtoolset-not-present",
67+
"manylinux_2_28": "gcc-toolset-11",
6368
"musllinux_1_1": "devtoolset-not-present",
6469
}
6570
PATH_DIRS = [
@@ -688,6 +693,46 @@ def test_nonpy_rpath(self, any_manylinux_container, docker_python, io_folder):
688693
],
689694
)
690695

696+
def test_glibcxx_3_4_25(self, any_manylinux_container, docker_python, io_folder):
697+
policy, tag, manylinux_ctr = any_manylinux_container
698+
docker_exec(
699+
manylinux_ctr,
700+
[
701+
"bash",
702+
"-c",
703+
"cd /auditwheel_src/tests/integration/test_glibcxx_3_4_25 && "
704+
"if [ -d ./build ]; then rm -rf ./build ./*.egg-info; fi && "
705+
"python -m pip wheel --no-deps -w /io .",
706+
],
707+
)
708+
709+
orig_wheel, *_ = os.listdir(io_folder)
710+
assert orig_wheel.startswith("testentropy-0.0.1")
711+
712+
# Repair the wheel using the appropriate manylinux container
713+
repair_command = f"auditwheel repair --plat {policy} -w /io /io/{orig_wheel}"
714+
if policy.startswith("manylinux_2_28_"):
715+
with pytest.raises(CalledProcessError):
716+
docker_exec(manylinux_ctr, repair_command)
717+
# TODO if a "permissive" mode is implemented, add the relevant flag to the
718+
# repair_command here and drop the return statement below
719+
return
720+
721+
docker_exec(manylinux_ctr, repair_command)
722+
723+
repaired_wheel, *_ = glob.glob(f"{io_folder}/*{policy}*.whl")
724+
repaired_wheel = os.path.basename(repaired_wheel)
725+
726+
docker_exec(docker_python, "pip install /io/" + repaired_wheel)
727+
docker_exec(
728+
docker_python,
729+
[
730+
"python",
731+
"-c",
732+
"from testentropy import run; exit(run())",
733+
],
734+
)
735+
691736

692737
class TestManylinux(Anylinux):
693738
@pytest.fixture(scope="session")

Diff for: tests/integration/testdependencies/dependency.c

+6-1
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,15 @@
33
#include <stdlib.h>
44
#include <stdint.h>
55
#include <math.h>
6+
#if defined(__GLIBC_PREREQ) && __GLIBC_PREREQ(2, 28)
7+
#include <threads.h>
8+
#endif
69

710
int dep_run()
811
{
9-
#if defined(__GLIBC_PREREQ) && __GLIBC_PREREQ(2, 24)
12+
#if defined(__GLIBC_PREREQ) && __GLIBC_PREREQ(2, 28)
13+
return thrd_equal(thrd_current(), thrd_current()) ? 0 : 1;
14+
#elif defined(__GLIBC_PREREQ) && __GLIBC_PREREQ(2, 24)
1015
return (int)nextupf(0.0F);
1116
#elif defined(__GLIBC_PREREQ) && __GLIBC_PREREQ(2, 17)
1217
return (int)(intptr_t)secure_getenv("NON_EXISTING_ENV_VARIABLE");

Diff for: tests/integration/testdependencies/testdependencies.c

+5
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,9 @@
55
#include <stdlib.h>
66
#include <stdint.h>
77
#include <math.h>
8+
#if defined(__GLIBC_PREREQ) && __GLIBC_PREREQ(2, 28)
9+
#include <threads.h>
10+
#endif
811
#endif
912
#include <Python.h>
1013

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

2124
#ifdef WITH_DEPENDENCY
2225
res = dep_run();
26+
#elif defined(__GLIBC_PREREQ) && __GLIBC_PREREQ(2, 28)
27+
res = thrd_equal(thrd_current(), thrd_current()) ? 0 : 1;
2328
#elif defined(__GLIBC_PREREQ) && __GLIBC_PREREQ(2, 24)
2429
res = (int)nextupf(0.0F);
2530
#elif defined(__GLIBC_PREREQ) && __GLIBC_PREREQ(2, 17)

0 commit comments

Comments
 (0)