Skip to content

Commit 5917506

Browse files
committed
Improve ASAN detection and pytest markers
1 parent afa70cc commit 5917506

4 files changed

Lines changed: 16 additions & 5 deletions

File tree

ci/pixi/asan/python/pixi.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ pytest = "*"
4141
pytest-timeout = "*"
4242

4343
[feature.test.tasks]
44-
test = "pytest -r s --pyargs pyarrow --timeout=180 -m 'not fail_asan'"
44+
test = "pytest -r s --pyargs pyarrow --timeout=180"
4545

4646
[package]
4747
name = "pyarrow"

python/pyarrow/conftest.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717

1818
import pytest
1919

20+
import ctypes
2021
import os
2122
import pyarrow as pa
2223
from pyarrow import Codec
@@ -25,6 +26,14 @@
2526
import sys
2627

2728

29+
def _is_asan_build():
30+
try:
31+
ctypes.CDLL(None).__asan_init
32+
return True
33+
except (OSError, AttributeError):
34+
return False
35+
36+
2837
groups = [
2938
'acero',
3039
'azure',
@@ -43,6 +52,7 @@
4352
'large_memory',
4453
'lz4',
4554
'memory_leak',
55+
'noasan',
4656
'nopandas',
4757
'nonumpy',
4858
'numpy',
@@ -80,6 +90,7 @@
8090
'large_memory': False,
8191
'lz4': Codec.is_available('lz4'),
8292
'memory_leak': False,
93+
'noasan': not _is_asan_build(),
8394
'nopandas': False,
8495
'nonumpy': False,
8596
'numpy': False,

python/pyarrow/tests/test_dlpack.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ def wrapper(*args, **kwargs):
5656

5757

5858
# Asan tests are flacky on check_bytes_allocated assertion.
59-
@pytest.mark.fail_asan
59+
@pytest.mark.noasan
6060
@check_bytes_allocated
6161
@pytest.mark.parametrize(
6262
('value_type', 'np_type_str'),

python/pyarrow/tests/test_memory.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -258,21 +258,21 @@ def check_debug_memory_pool_disabled(pool_factory, env_value, msg):
258258

259259

260260
# Asan test fails as we are doing an out-of-bounds write.
261-
@pytest.mark.fail_asan
261+
@pytest.mark.noasan
262262
@pytest.mark.parametrize('pool_factory', supported_factories())
263263
def test_debug_memory_pool_none(pool_factory):
264264
check_debug_memory_pool_disabled(pool_factory, "none", "")
265265

266266

267267
# Asan test fails as we are doing an out-of-bounds write.
268-
@pytest.mark.fail_asan
268+
@pytest.mark.noasan
269269
@pytest.mark.parametrize('pool_factory', supported_factories())
270270
def test_debug_memory_pool_empty(pool_factory):
271271
check_debug_memory_pool_disabled(pool_factory, "", "")
272272

273273

274274
# Asan test fails as we are doing an out-of-bounds write.
275-
@pytest.mark.fail_asan
275+
@pytest.mark.noasan
276276
@pytest.mark.parametrize('pool_factory', supported_factories())
277277
def test_debug_memory_pool_unknown(pool_factory):
278278
env_value = "some_arbitrary_value"

0 commit comments

Comments
 (0)