-
Notifications
You must be signed in to change notification settings - Fork 273
Closed
Labels
Description
On both 21.0 and the current main branch, the musllinux tests fail on s390x, possibly because it is Big Endian.
Steps to reproduce:
$ podman run --rm -ti docker://fedorapython/fedora-python-tox:s390x /usr/bin/bash
[root@a3025a1b5b30 /]# git clone https://github.com/pypa/packaging/
...
[root@a3025a1b5b30 /]# cd packaging/
[root@a3025a1b5b30 packaging]# pip install nox
...
[root@a3025a1b5b30 packaging]# nox -e tests-3.9 -- tests/test_musllinux.py
nox > Running session tests-3.9
nox > Re-using existing virtual environment at .nox/tests-3-9.
nox > python -m pip install coverage<5.0.0 pretend pytest>=6.2.0 pip>=9.0.2
nox > python -m coverage run --source packaging/ -m pytest --strict-markers tests/test_musllinux.py
============================= test session starts ==============================
platform linux -- Python 3.9.7, pytest-6.2.5, py-1.10.0, pluggy-1.0.0
rootdir: /packaging
collected 20 items
tests/test_musllinux.py ......FFF.....F..FFF [100%]
=================================== FAILURES ===================================
_____________________ test_parse_ld_musl_from_elf[x86_64] ______________________
executable = PosixPath('/packaging/tests/musllinux/musl-x86_64')
location = '/lib/ld-musl-x86_64.so.1'
@pytest.mark.parametrize(
"executable, location",
[
(BIN_GLIBC_X86_64, None),
(BIN_MUSL_X86_64, LD_MUSL_X86_64),
(BIN_MUSL_I386, LD_MUSL_I386),
(BIN_MUSL_AARCH64, LD_MUSL_AARCH64),
],
ids=["glibc", "x86_64", "i386", "aarch64"],
)
def test_parse_ld_musl_from_elf(executable, location):
with executable.open("rb") as f:
> assert _parse_ld_musl_from_elf(f) == location
E AssertionError: assert None == '/lib/ld-musl-x86_64.so.1'
E + where None = _parse_ld_musl_from_elf(<_io.BufferedReader name='/packaging/tests/musllinux/musl-x86_64'>)
tests/test_musllinux.py:69: AssertionError
______________________ test_parse_ld_musl_from_elf[i386] _______________________
executable = PosixPath('/packaging/tests/musllinux/musl-i386')
location = '/lib/ld-musl-i386.so.1'
@pytest.mark.parametrize(
"executable, location",
[
(BIN_GLIBC_X86_64, None),
(BIN_MUSL_X86_64, LD_MUSL_X86_64),
(BIN_MUSL_I386, LD_MUSL_I386),
(BIN_MUSL_AARCH64, LD_MUSL_AARCH64),
],
ids=["glibc", "x86_64", "i386", "aarch64"],
)
def test_parse_ld_musl_from_elf(executable, location):
with executable.open("rb") as f:
> assert _parse_ld_musl_from_elf(f) == location
E AssertionError: assert None == '/lib/ld-musl-i386.so.1'
E + where None = _parse_ld_musl_from_elf(<_io.BufferedReader name='/packaging/tests/musllinux/musl-i386'>)
tests/test_musllinux.py:69: AssertionError
_____________________ test_parse_ld_musl_from_elf[aarch64] _____________________
executable = PosixPath('/packaging/tests/musllinux/musl-aarch64')
location = '/lib/ld-musl-aarch64.so.1'
@pytest.mark.parametrize(
"executable, location",
[
(BIN_GLIBC_X86_64, None),
(BIN_MUSL_X86_64, LD_MUSL_X86_64),
(BIN_MUSL_I386, LD_MUSL_I386),
(BIN_MUSL_AARCH64, LD_MUSL_AARCH64),
],
ids=["glibc", "x86_64", "i386", "aarch64"],
)
def test_parse_ld_musl_from_elf(executable, location):
with executable.open("rb") as f:
> assert _parse_ld_musl_from_elf(f) == location
E AssertionError: assert None == '/lib/ld-musl-aarch64.so.1'
E + where None = _parse_ld_musl_from_elf(<_io.BufferedReader name='/packaging/tests/musllinux/musl-aarch64'>)
tests/test_musllinux.py:69: AssertionError
______________ test_parse_ld_musl_from_elf_no_interpreter_section ______________
def test_parse_ld_musl_from_elf_no_interpreter_section():
with BIN_MUSL_X86_64.open("rb") as f:
data = f.read()
# Change all sections to *not* PT_INTERP.
unpacked = struct.unpack("16BHHIQQQIHHH", data[:58])
*_, e_phoff, _, _, _, e_phentsize, e_phnum = unpacked
for i in range(e_phnum + 1):
sb = e_phoff + e_phentsize * i
se = sb + 56
> section = struct.unpack("IIQQQQQQ", data[sb:se])
E struct.error: unpack requires a buffer of 56 bytes
tests/test_musllinux.py:110: error
________________________ test_get_musl_version[x86_64] _________________________
monkeypatch = <_pytest.monkeypatch.MonkeyPatch object at 0x4003182d90>
executable = PosixPath('/packaging/tests/musllinux/musl-x86_64')
output = 'musl libc (x86_64)\nVersion 1.2.2\n'
version = _MuslVersion(major=1, minor=2), ld_musl = '/lib/ld-musl-x86_64.so.1'
@pytest.mark.parametrize(
"executable, output, version, ld_musl",
[
(MUSL_DIR.joinpath("does-not-exist"), "error", None, None),
(BIN_GLIBC_X86_64, "error", None, None),
(BIN_MUSL_X86_64, MUSL_AMD64, _MuslVersion(1, 2), LD_MUSL_X86_64),
(BIN_MUSL_I386, MUSL_I386, _MuslVersion(1, 2), LD_MUSL_I386),
(BIN_MUSL_AARCH64, MUSL_AARCH64, _MuslVersion(1, 1), LD_MUSL_AARCH64),
],
ids=["does-not-exist", "glibc", "x86_64", "i386", "aarch64"],
)
def test_get_musl_version(monkeypatch, executable, output, version, ld_musl):
def mock_run(*args, **kwargs):
return collections.namedtuple("Proc", "stderr")(output)
run_recorder = pretend.call_recorder(mock_run)
monkeypatch.setattr(_musllinux.subprocess, "run", run_recorder)
> assert _get_musl_version(str(executable)) == version
E AssertionError: assert None == _MuslVersion(major=1, minor=2)
E + where None = _get_musl_version('/packaging/tests/musllinux/musl-x86_64')
E + where '/packaging/tests/musllinux/musl-x86_64' = str(PosixPath('/packaging/tests/musllinux/musl-x86_64'))
tests/test_musllinux.py:134: AssertionError
_________________________ test_get_musl_version[i386] __________________________
monkeypatch = <_pytest.monkeypatch.MonkeyPatch object at 0x400314a3a0>
executable = PosixPath('/packaging/tests/musllinux/musl-i386')
output = 'musl libc (i386)\nVersion 1.2.1\n'
version = _MuslVersion(major=1, minor=2), ld_musl = '/lib/ld-musl-i386.so.1'
@pytest.mark.parametrize(
"executable, output, version, ld_musl",
[
(MUSL_DIR.joinpath("does-not-exist"), "error", None, None),
(BIN_GLIBC_X86_64, "error", None, None),
(BIN_MUSL_X86_64, MUSL_AMD64, _MuslVersion(1, 2), LD_MUSL_X86_64),
(BIN_MUSL_I386, MUSL_I386, _MuslVersion(1, 2), LD_MUSL_I386),
(BIN_MUSL_AARCH64, MUSL_AARCH64, _MuslVersion(1, 1), LD_MUSL_AARCH64),
],
ids=["does-not-exist", "glibc", "x86_64", "i386", "aarch64"],
)
def test_get_musl_version(monkeypatch, executable, output, version, ld_musl):
def mock_run(*args, **kwargs):
return collections.namedtuple("Proc", "stderr")(output)
run_recorder = pretend.call_recorder(mock_run)
monkeypatch.setattr(_musllinux.subprocess, "run", run_recorder)
> assert _get_musl_version(str(executable)) == version
E AssertionError: assert None == _MuslVersion(major=1, minor=2)
E + where None = _get_musl_version('/packaging/tests/musllinux/musl-i386')
E + where '/packaging/tests/musllinux/musl-i386' = str(PosixPath('/packaging/tests/musllinux/musl-i386'))
tests/test_musllinux.py:134: AssertionError
________________________ test_get_musl_version[aarch64] ________________________
monkeypatch = <_pytest.monkeypatch.MonkeyPatch object at 0x400317e130>
executable = PosixPath('/packaging/tests/musllinux/musl-aarch64')
output = 'musl libc (aarch64)\nVersion 1.1.24\n'
version = _MuslVersion(major=1, minor=1), ld_musl = '/lib/ld-musl-aarch64.so.1'
@pytest.mark.parametrize(
"executable, output, version, ld_musl",
[
(MUSL_DIR.joinpath("does-not-exist"), "error", None, None),
(BIN_GLIBC_X86_64, "error", None, None),
(BIN_MUSL_X86_64, MUSL_AMD64, _MuslVersion(1, 2), LD_MUSL_X86_64),
(BIN_MUSL_I386, MUSL_I386, _MuslVersion(1, 2), LD_MUSL_I386),
(BIN_MUSL_AARCH64, MUSL_AARCH64, _MuslVersion(1, 1), LD_MUSL_AARCH64),
],
ids=["does-not-exist", "glibc", "x86_64", "i386", "aarch64"],
)
def test_get_musl_version(monkeypatch, executable, output, version, ld_musl):
def mock_run(*args, **kwargs):
return collections.namedtuple("Proc", "stderr")(output)
run_recorder = pretend.call_recorder(mock_run)
monkeypatch.setattr(_musllinux.subprocess, "run", run_recorder)
> assert _get_musl_version(str(executable)) == version
E AssertionError: assert None == _MuslVersion(major=1, minor=1)
E + where None = _get_musl_version('/packaging/tests/musllinux/musl-aarch64')
E + where '/packaging/tests/musllinux/musl-aarch64' = str(PosixPath('/packaging/tests/musllinux/musl-aarch64'))
tests/test_musllinux.py:134: AssertionError
=========================== short test summary info ============================
FAILED tests/test_musllinux.py::test_parse_ld_musl_from_elf[x86_64] - Asserti...
FAILED tests/test_musllinux.py::test_parse_ld_musl_from_elf[i386] - Assertion...
FAILED tests/test_musllinux.py::test_parse_ld_musl_from_elf[aarch64] - Assert...
FAILED tests/test_musllinux.py::test_parse_ld_musl_from_elf_no_interpreter_section
FAILED tests/test_musllinux.py::test_get_musl_version[x86_64] - AssertionErro...
FAILED tests/test_musllinux.py::test_get_musl_version[i386] - AssertionError:...
FAILED tests/test_musllinux.py::test_get_musl_version[aarch64] - AssertionErr...
========================= 7 failed, 13 passed in 0.80s =========================
nox > Command python -m coverage run --source packaging/ -m pytest --strict-markers tests/test_musllinux.py failed with exit code 1
nox > Session tests-3.9 failed.