Xfail timouts in Valgrind tests

* ensure that the env variable is set in the makefile
This commit is contained in:
Eric Soroos 2025-05-16 12:08:45 +02:00
parent 2d506f6f5a
commit f1957b49b2
3 changed files with 13 additions and 2 deletions

View File

@ -95,14 +95,14 @@ test:
.PHONY: valgrind .PHONY: valgrind
valgrind: valgrind:
python3 -c "import pytest_valgrind" > /dev/null 2>&1 || python3 -m pip install pytest-valgrind python3 -c "import pytest_valgrind" > /dev/null 2>&1 || python3 -m pip install pytest-valgrind
PYTHONMALLOC=malloc valgrind --suppressions=Tests/oss-fuzz/python.supp --leak-check=no \ PILLOW_VALGRIND_TEST=true PYTHONMALLOC=malloc valgrind --suppressions=Tests/oss-fuzz/python.supp --leak-check=no \
--log-file=/tmp/valgrind-output \ --log-file=/tmp/valgrind-output \
python3 -m pytest --no-memcheck -vv --valgrind --valgrind-log=/tmp/valgrind-output python3 -m pytest --no-memcheck -vv --valgrind --valgrind-log=/tmp/valgrind-output
.PHONY: valgrind-leak .PHONY: valgrind-leak
valgrind-leak: valgrind-leak:
python3 -c "import pytest_valgrind" > /dev/null 2>&1 || python3 -m pip install pytest-valgrind python3 -c "import pytest_valgrind" > /dev/null 2>&1 || python3 -m pip install pytest-valgrind
PYTHONMALLOC=malloc valgrind --suppressions=Tests/oss-fuzz/python.supp \ PILLOW_VALGRIND_TEST=true PYTHONMALLOC=malloc valgrind --suppressions=Tests/oss-fuzz/python.supp \
--leak-check=full --show-leak-kinds=definite --errors-for-leak-kinds=definite \ --leak-check=full --show-leak-kinds=definite --errors-for-leak-kinds=definite \
--log-file=/tmp/valgrind-output \ --log-file=/tmp/valgrind-output \
python3 -m pytest -vv --valgrind --valgrind-log=/tmp/valgrind-output Tests/ python3 -m pytest -vv --valgrind --valgrind-log=/tmp/valgrind-output Tests/

View File

@ -1034,6 +1034,11 @@ class TestFileJpeg:
im.save(f, xmp=b"1" * 65505) im.save(f, xmp=b"1" * 65505)
@pytest.mark.timeout(timeout=1) @pytest.mark.timeout(timeout=1)
@pytest.mark.xfail(
"PILLOW_VALGRIND_TEST" in os.environ,
reason="Valgrind is slower",
raises=TimeoutError
)
def test_eof(self, monkeypatch: pytest.MonkeyPatch) -> None: def test_eof(self, monkeypatch: pytest.MonkeyPatch) -> None:
# Even though this decoder never says that it is finished # Even though this decoder never says that it is finished
# the image should still end when there is no new data # the image should still end when there is no new data

View File

@ -2,6 +2,7 @@ from __future__ import annotations
import struct import struct
from io import BytesIO from io import BytesIO
import os
import pytest import pytest
@ -73,6 +74,11 @@ def test_decompression_bomb() -> None:
@pytest.mark.timeout(4) @pytest.mark.timeout(4)
@pytest.mark.xfail(
"PILLOW_VALGRIND_TEST" in os.environ,
reason="Valgrind is slower",
raises=TimeoutError
)
def test_oom() -> None: def test_oom() -> None:
glyph = struct.pack( glyph = struct.pack(
">hhhhhhhhhh", 1, 0, -32767, -32767, 32767, 32767, -32767, -32767, 32767, 32767 ">hhhhhhhhhh", 1, 0, -32767, -32767, 32767, 32767, -32767, -32767, 32767, 32767