Skip to content

Commit c99e7cf

Browse files
committed
test(cufile): use cufile_env_json for parameter round-trip tests
Attach cufile_env_json fixture to size_t, bool, and string parameter tests so compat-related bools can be exercised before first driver_open without relying on skipping allow_compat_mode/force_compat_mode on systems without nvidia-fs (Ralf's patch).
1 parent ed1a6bd commit c99e7cf

1 file changed

Lines changed: 6 additions & 15 deletions

File tree

cuda_bindings/tests/test_cufile.py

Lines changed: 6 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1432,7 +1432,7 @@ def test_batch_io_large_operations():
14321432
@pytest.mark.skipif(
14331433
cufileVersionLessThan(1140), reason="cuFile parameter APIs require cuFile library version 1.14.0 or later"
14341434
)
1435-
@pytest.mark.usefixtures("ctx")
1435+
@pytest.mark.usefixtures("ctx", "cufile_env_json")
14361436
def test_set_get_parameter_size_t():
14371437
"""Test setting and getting size_t parameters with cuFile validation."""
14381438
param_val_pairs = (
@@ -1469,17 +1469,11 @@ def test_param(param, val):
14691469
@pytest.mark.skipif(
14701470
cufileVersionLessThan(1140), reason="cuFile parameter APIs require cuFile library version 1.14.0 or later"
14711471
)
1472-
@pytest.mark.usefixtures("ctx")
1472+
@pytest.mark.usefixtures("ctx", "cufile_env_json")
14731473
def test_set_get_parameter_bool():
14741474
"""Test setting and getting boolean parameters with cuFile validation."""
1475-
# Do not exercise allow/force compat via set_parameter_bool before any driver_open:
1476-
# pending API values are applied after JSON load on first open and can overwrite
1477-
# cufile.json (e.g. allow_compat_mode: true), causing DRIVER_NOT_INITIALIZED when
1478-
# nvidia-fs is not loaded. Other tests cover compat behavior where appropriate.
1479-
_COMPAT_PARAMS = (
1480-
cufile.BoolConfigParameter.PROPERTIES_ALLOW_COMPAT_MODE,
1481-
cufile.BoolConfigParameter.FORCE_COMPAT_MODE,
1482-
)
1475+
# Load the compat-enabled test config before the first driver_open so the compat
1476+
# bool params can still be round-tripped on systems without nvidia-fs.
14831477
param_val_pairs = (
14841478
(cufile.BoolConfigParameter.PROPERTIES_USE_POLL_MODE, True),
14851479
(cufile.BoolConfigParameter.PROPERTIES_ALLOW_COMPAT_MODE, False),
@@ -1494,12 +1488,9 @@ def test_set_get_parameter_bool():
14941488
(cufile.BoolConfigParameter.SKIP_TOPOLOGY_DETECTION, False),
14951489
(cufile.BoolConfigParameter.STREAM_MEMOPS_BYPASS, True),
14961490
)
1497-
param_val_pairs = tuple((p, v) for p, v in param_val_pairs if p not in _COMPAT_PARAMS)
14981491
# PROFILE_NVTX is deprecated (CTK 13.1.0+); cuFile >= 1.16 rejects bool getters for it.
14991492
if cufile.get_version() >= 1160:
1500-
param_val_pairs = tuple(
1501-
(p, v) for p, v in param_val_pairs if p is not cufile.BoolConfigParameter.PROFILE_NVTX
1502-
)
1493+
param_val_pairs = tuple((p, v) for p, v in param_val_pairs if p is not cufile.BoolConfigParameter.PROFILE_NVTX)
15031494

15041495
with _cufile_driver_session():
15051496
originals = {param: cufile.get_parameter_bool(param) for param, _ in param_val_pairs}
@@ -1519,7 +1510,7 @@ def test_param(param, val):
15191510
@pytest.mark.skipif(
15201511
cufileVersionLessThan(1140), reason="cuFile parameter APIs require cuFile library version 1.14.0 or later"
15211512
)
1522-
@pytest.mark.usefixtures("ctx")
1513+
@pytest.mark.usefixtures("ctx", "cufile_env_json")
15231514
def test_set_get_parameter_string(tmp_path):
15241515
"""Test setting and getting string parameters with cuFile validation."""
15251516
temp_dir = tempfile.gettempdir()

0 commit comments

Comments
 (0)