diff --git a/tests/integration/gepetto_example_adder/gepetto_example_adder-3.0.2-cp36-cp36m-linux_x86_64.whl b/tests/integration/gepetto_example_adder/gepetto_example_adder-3.0.2-cp36-cp36m-linux_x86_64.whl new file mode 100644 index 00000000..f0dbc18a Binary files /dev/null and b/tests/integration/gepetto_example_adder/gepetto_example_adder-3.0.2-cp36-cp36m-linux_x86_64.whl differ diff --git a/tests/integration/gepetto_example_adder/gepetto_example_adder-3.0.2-cp37-cp37m-linux_x86_64.whl b/tests/integration/gepetto_example_adder/gepetto_example_adder-3.0.2-cp37-cp37m-linux_x86_64.whl new file mode 100644 index 00000000..785ecad1 Binary files /dev/null and b/tests/integration/gepetto_example_adder/gepetto_example_adder-3.0.2-cp37-cp37m-linux_x86_64.whl differ diff --git a/tests/integration/gepetto_example_adder/gepetto_example_adder-3.0.2-cp38-cp38-linux_x86_64.whl b/tests/integration/gepetto_example_adder/gepetto_example_adder-3.0.2-cp38-cp38-linux_x86_64.whl new file mode 100644 index 00000000..f8f34dbe Binary files /dev/null and b/tests/integration/gepetto_example_adder/gepetto_example_adder-3.0.2-cp38-cp38-linux_x86_64.whl differ diff --git a/tests/integration/gepetto_example_adder/gepetto_example_adder-3.0.2-cp39-cp39-linux_x86_64.whl b/tests/integration/gepetto_example_adder/gepetto_example_adder-3.0.2-cp39-cp39-linux_x86_64.whl new file mode 100644 index 00000000..6ddbf972 Binary files /dev/null and b/tests/integration/gepetto_example_adder/gepetto_example_adder-3.0.2-cp39-cp39-linux_x86_64.whl differ diff --git a/tests/integration/gepetto_example_adder/libboost_python36.so.1.72.0.xz b/tests/integration/gepetto_example_adder/libboost_python36.so.1.72.0.xz new file mode 100644 index 00000000..986ed993 Binary files /dev/null and b/tests/integration/gepetto_example_adder/libboost_python36.so.1.72.0.xz differ diff --git a/tests/integration/gepetto_example_adder/libboost_python37.so.1.72.0.xz b/tests/integration/gepetto_example_adder/libboost_python37.so.1.72.0.xz new file mode 100644 index 00000000..11b8110a Binary files /dev/null and b/tests/integration/gepetto_example_adder/libboost_python37.so.1.72.0.xz differ diff --git a/tests/integration/gepetto_example_adder/libboost_python38.so.1.72.0.xz b/tests/integration/gepetto_example_adder/libboost_python38.so.1.72.0.xz new file mode 100644 index 00000000..2beb3a04 Binary files /dev/null and b/tests/integration/gepetto_example_adder/libboost_python38.so.1.72.0.xz differ diff --git a/tests/integration/gepetto_example_adder/libboost_python39.so.1.72.0.xz b/tests/integration/gepetto_example_adder/libboost_python39.so.1.72.0.xz new file mode 100644 index 00000000..64a1004f Binary files /dev/null and b/tests/integration/gepetto_example_adder/libboost_python39.so.1.72.0.xz differ diff --git a/tests/integration/gepetto_example_adder/libexample-adder.so.3.0.2-6-gd319.xz b/tests/integration/gepetto_example_adder/libexample-adder.so.3.0.2-6-gd319.xz new file mode 100644 index 00000000..880ee2a4 Binary files /dev/null and b/tests/integration/gepetto_example_adder/libexample-adder.so.3.0.2-6-gd319.xz differ diff --git a/tests/integration/gepetto_example_adder/script.sh b/tests/integration/gepetto_example_adder/script.sh new file mode 100755 index 00000000..50f04af4 --- /dev/null +++ b/tests/integration/gepetto_example_adder/script.sh @@ -0,0 +1,56 @@ +#!/bin/bash + +# This shall be run on manylinux2014_x86_64 to create test data for gepetto_example_adder + +# Stop at any error, show all commands +set -exuo pipefail + +OUTPUT_DIR=$(dirname $0) + +#mkdir /root/maketest +cd /root/maketest + +# Install ninja +PY38_BIN=/opt/python/cp38-cp38/bin +$PY38_BIN/pip install ninja +ln -sf $PY38_BIN/ninja /usr/local/bin/ +ln -sf $PY38_BIN/wheel /usr/local/bin/ + +# build boost +curl -fsSLO https://dl.bintray.com/boostorg/release/1.72.0/source/boost_1_72_0.tar.bz2 +tar -xf boost_1_72_0.tar.bz2 +pushd boost_1_72_0 +./bootstrap.sh --prefix=/usr/local +sed -i 's/using python.*/python_config/g' project-config.jam +sed -i 's&python_config&python_config\n using python : 3.9 : /opt/python/cp39-cp39/bin/python : /opt/python/cp39-cp39/include/python3.9 : /opt/python/cp39-cp39/lib ;&g' project-config.jam +sed -i 's&python_config&python_config\n using python : 3.8 : /opt/python/cp38-cp38/bin/python : /opt/python/cp38-cp38/include/python3.8 : /opt/python/cp38-cp38/lib ;&g' project-config.jam +sed -i 's&python_config&python_config\n using python : 3.7 : /opt/python/cp37-cp37m/bin/python : /opt/python/cp37-cp37m/include/python3.7m : /opt/python/cp37-cp37m/lib ;&g' project-config.jam +sed -i 's&python_config&python_config\n using python : 3.6 : /opt/python/cp36-cp36m/bin/python : /opt/python/cp36-cp36m/include/python3.6m : /opt/python/cp36-cp36m/lib ;&g' project-config.jam +sed -i 's/python_config//g' project-config.jam + +./b2 install link=shared python=3.6,3.7,3.8,3.9 --with-python --with-test -j"$(nproc)" +popd + +# build example-adder +git clone --recursive https://github.com/Ozon2/example-adder.git +pushd example-adder +git checkout d319dae3849b9dc3161b2b6cbafa9e45204dcc14 + +for PYBIN in /opt/python/{cp36*,cp37*,cp38*,cp39*}/bin; do + rm -rf _skbuild/ + "$PYBIN"/pip install --upgrade pip + "$PYBIN"/pip install scikit-build + "$PYBIN"/python setup.py bdist_wheel +done +popd + +# strip/compress dependencies +for PYVER in 36 37 38 39; do + strip --strip-unneeded /usr/local/lib/libboost_python${PYVER}.so.1.72.0 + xz -z -c -e /usr/local/lib/libboost_python${PYVER}.so.1.72.0 > ${OUTPUT_DIR}/libboost_python${PYVER}.so.1.72.0.xz +done +strip --strip-unneeded example-adder/_skbuild/linux-x86_64-3.9/cmake-build/libexample-adder.so.3.0.2-6-gd319 +xz -z -c -e example-adder/_skbuild/linux-x86_64-3.9/cmake-build/libexample-adder.so.3.0.2-6-gd319 > ${OUTPUT_DIR}/libexample-adder.so.3.0.2-6-gd319.xz + +# copy wheels +cp example-adder/dist/* ${OUTPUT_DIR}/ diff --git a/tests/integration/test_manylinux.py b/tests/integration/test_manylinux.py index d6ffeb59..5ee4477b 100644 --- a/tests/integration/test_manylinux.py +++ b/tests/integration/test_manylinux.py @@ -657,3 +657,61 @@ def test_strip_wheel(any_manylinux_container, docker_python, io_folder): ["python", "-c", "from sample_extension import test_func; print(test_func(1))"] ) assert output.strip() == "2" + + +def test_rpath(any_manylinux_container, docker_python, io_folder): + policy, manylinux_ctr = any_manylinux_container + if policy != 'manylinux2014_x86_64': + pytest.skip('This test can only run on manylinux2014_x86_64') + orig_wheel = f'gepetto_example_adder-3.0.2-{PYTHON_ABI}-linux_x86_64.whl' + # decompress dependencies + docker_exec(manylinux_ctr, [ + 'bash', '-c', + 'xz -d -c /auditwheel_src/tests/integration/gepetto_example_adder/' + f'libboost_python{PYTHON_ABI_MAJ_MIN}.so.1.72.0.xz > ' + f'/usr/local/lib/libboost_python{PYTHON_ABI_MAJ_MIN}.so.1.72.0' + ]) + docker_exec(manylinux_ctr, [ + 'bash', '-c', + 'xz -d -c /auditwheel_src/tests/integration/gepetto_example_adder/' + 'libexample-adder.so.3.0.2-6-gd319.xz > ' + '/usr/local/lib/libexample-adder.so.3.0.2-6-gd319' + ]) + + # check the original wheel is not compliant + output = docker_exec(manylinux_ctr, [ + 'auditwheel', 'show', + f'/auditwheel_src/tests/integration/gepetto_example_adder/{orig_wheel}' + ]) + assert ( + f'{orig_wheel} is consistent with the following platform tag: ' + f'"linux_{PLATFORM}"' + ) in output.replace('\n', ' ') + + # repair + docker_exec(manylinux_ctr, [ + 'auditwheel', '-v', 'repair', '-w', '/io', + f'/auditwheel_src/tests/integration/gepetto_example_adder/{orig_wheel}' + ]) + filenames = os.listdir(io_folder) + assert len(filenames) == 1 + repaired_wheels = [fn for fn in filenames if policy in fn] + expected_wheel_name = \ + f'gepetto_example_adder-3.0.2-{PYTHON_ABI}-{policy}.whl' + assert repaired_wheels == [expected_wheel_name] + repaired_wheel = repaired_wheels[0] + output = docker_exec(manylinux_ctr, [ + 'auditwheel', 'show', f'/io/{repaired_wheel}' + ]) + assert ( + f'{expected_wheel_name} is consistent with the following platform tag: ' + f'"{policy}"' + ) in output.replace('\n', ' ') + + docker_exec(docker_python, ['pip', 'install', f'/io/{repaired_wheel}']) + with pytest.raises(CalledProcessError): + docker_exec(docker_python, [ + 'python', '-c', + 'import example_adder as exa; assert exa.add(4, 3) == 7' + ]) + pytest.xfail('Bad RPATH')