Skip to content

Commit f1957b4

Browse files
committed
Xfail timouts in Valgrind tests
* ensure that the env variable is set in the makefile
1 parent 2d506f6 commit f1957b4

File tree

3 files changed

+13
-2
lines changed

3 files changed

+13
-2
lines changed

Makefile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -95,14 +95,14 @@ test:
9595
.PHONY: valgrind
9696
valgrind:
9797
python3 -c "import pytest_valgrind" > /dev/null 2>&1 || python3 -m pip install pytest-valgrind
98-
PYTHONMALLOC=malloc valgrind --suppressions=Tests/oss-fuzz/python.supp --leak-check=no \
98+
PILLOW_VALGRIND_TEST=true PYTHONMALLOC=malloc valgrind --suppressions=Tests/oss-fuzz/python.supp --leak-check=no \
9999
--log-file=/tmp/valgrind-output \
100100
python3 -m pytest --no-memcheck -vv --valgrind --valgrind-log=/tmp/valgrind-output
101101

102102
.PHONY: valgrind-leak
103103
valgrind-leak:
104104
python3 -c "import pytest_valgrind" > /dev/null 2>&1 || python3 -m pip install pytest-valgrind
105-
PYTHONMALLOC=malloc valgrind --suppressions=Tests/oss-fuzz/python.supp \
105+
PILLOW_VALGRIND_TEST=true PYTHONMALLOC=malloc valgrind --suppressions=Tests/oss-fuzz/python.supp \
106106
--leak-check=full --show-leak-kinds=definite --errors-for-leak-kinds=definite \
107107
--log-file=/tmp/valgrind-output \
108108
python3 -m pytest -vv --valgrind --valgrind-log=/tmp/valgrind-output Tests/

Tests/test_file_jpeg.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1034,6 +1034,11 @@ def test_save_xmp(self, tmp_path: Path) -> None:
10341034
im.save(f, xmp=b"1" * 65505)
10351035

10361036
@pytest.mark.timeout(timeout=1)
1037+
@pytest.mark.xfail(
1038+
"PILLOW_VALGRIND_TEST" in os.environ,
1039+
reason="Valgrind is slower",
1040+
raises=TimeoutError
1041+
)
10371042
def test_eof(self, monkeypatch: pytest.MonkeyPatch) -> None:
10381043
# Even though this decoder never says that it is finished
10391044
# the image should still end when there is no new data

Tests/test_imagefontpil.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
import struct
44
from io import BytesIO
5+
import os
56

67
import pytest
78

@@ -73,6 +74,11 @@ def test_decompression_bomb() -> None:
7374

7475

7576
@pytest.mark.timeout(4)
77+
@pytest.mark.xfail(
78+
"PILLOW_VALGRIND_TEST" in os.environ,
79+
reason="Valgrind is slower",
80+
raises=TimeoutError
81+
)
7682
def test_oom() -> None:
7783
glyph = struct.pack(
7884
">hhhhhhhhhh", 1, 0, -32767, -32767, 32767, 32767, -32767, -32767, 32767, 32767

0 commit comments

Comments
 (0)