From dca346941cf1b85f76c587cbe6525cdba1ad4fff Mon Sep 17 00:00:00 2001 From: Sebastian Berg Date: Wed, 17 Jun 2026 08:53:11 +0200 Subject: [PATCH 1/4] test(bindings): Fix unsupported FS check in cufile This is a follow-up from making cufile tests use temporary directories as noted by Leo I don't think QA is a problem, because the previous xfail was guarded by having `CI` in the environment variables. However, the `isSupportedFilesystem` was using the wrong directory now as we are now running the test in the temporary directory. My suspicion is that there is some additional check that would be strictly needed (e.g. to check that it isn't just ext4 but also directly mounted on a local nvme device) but I have not figured out a check for that. --- cuda_bindings/tests/test_cufile.py | 54 +++++++++++++----------------- 1 file changed, 23 insertions(+), 31 deletions(-) diff --git a/cuda_bindings/tests/test_cufile.py b/cuda_bindings/tests/test_cufile.py index 3a4d9b1c0e3..295ac758b8f 100644 --- a/cuda_bindings/tests/test_cufile.py +++ b/cuda_bindings/tests/test_cufile.py @@ -78,15 +78,20 @@ def cufileVersionLessThan(target): return True # Assume old version if any error occurs -@cache -def isSupportedFilesystem(): - """Check if the current filesystem is supported (ext4 or xfs). +@pytest.fixture(scope="session") +def skipIfUnsupportedFilesystem(tmpdir_factory): + """Fixture that skips if the current filesystem is supported (ext4 or xfs). + + The actual requirements are probably both stricter (ext4 was not working on CI previously) + and possibly also less strict. This uses `findmnt` so the kernel's mount table logic owns the decoding of the filesystem type. """ - fs_type = subprocess.check_output(["findmnt", "-no", "FSTYPE", "-T", os.getcwd()], text=True).strip() # noqa: S603, S607 + cmd = ["findmnt", "-no", "FSTYPE", "-T", tmpdir_factory.getbasetemp()] + fs_type = subprocess.check_output(cmd, text=True).strip() # noqa S603, S607 logging.info(f"Current filesystem type (findmnt): {fs_type}") - return fs_type in ("ext4", "xfs") + if fs_type not in ("ext4", "xfs"): + pytest.skip("cuFile handle_register requires ext4 or xfs filesystem") @cache @@ -195,8 +200,7 @@ def driver(ctx): cufile.driver_close() -@pytest.mark.skipif(not isSupportedFilesystem(), reason="cuFile handle_register requires ext4 or xfs filesystem") -@pytest.mark.usefixtures("driver") +@pytest.mark.usefixtures("driver", "skipIfUnsupportedFilesystem") def test_handle_register(tmpdir): """Test file handle registration with cuFile.""" # Create test file @@ -385,8 +389,7 @@ def test_buf_register_already_registered(): cuda.cuMemFree(buf_ptr) -@pytest.mark.skipif(not isSupportedFilesystem(), reason="cuFile handle_register requires ext4 or xfs filesystem") -@pytest.mark.usefixtures("driver") +@pytest.mark.usefixtures("driver", "skipIfUnsupportedFilesystem") def test_cufile_read_write(tmpdir): """Test cuFile read and write operations.""" # Create test file @@ -469,8 +472,7 @@ def test_cufile_read_write(tmpdir): cuda.cuMemFree(read_buf) -@pytest.mark.skipif(not isSupportedFilesystem(), reason="cuFile handle_register requires ext4 or xfs filesystem") -@pytest.mark.usefixtures("driver") +@pytest.mark.usefixtures("driver", "skipIfUnsupportedFilesystem") def test_cufile_read_write_host_memory(tmpdir): """Test cuFile read and write operations using host memory.""" # Create test file @@ -549,8 +551,7 @@ def test_cufile_read_write_host_memory(tmpdir): cuda.cuMemFreeHost(read_buf) -@pytest.mark.skipif(not isSupportedFilesystem(), reason="cuFile handle_register requires ext4 or xfs filesystem") -@pytest.mark.usefixtures("driver") +@pytest.mark.usefixtures("driver", "skipIfUnsupportedFilesystem") def test_cufile_read_write_large(tmpdir): """Test cuFile read and write operations with large data.""" # Create test file @@ -636,8 +637,7 @@ def test_cufile_read_write_large(tmpdir): cuda.cuMemFree(read_buf) -@pytest.mark.skipif(not isSupportedFilesystem(), reason="cuFile handle_register requires ext4 or xfs filesystem") -@pytest.mark.usefixtures("ctx", "cufile_env_json", "driver") +@pytest.mark.usefixtures("ctx", "cufile_env_json", "driver", "skipIfUnsupportedFilesystem") def test_cufile_write_async(tmpdir): """Test cuFile asynchronous write operations.""" # Create test file @@ -711,8 +711,7 @@ def test_cufile_write_async(tmpdir): os.close(fd) -@pytest.mark.skipif(not isSupportedFilesystem(), reason="cuFile handle_register requires ext4 or xfs filesystem") -@pytest.mark.usefixtures("ctx", "cufile_env_json", "driver") +@pytest.mark.usefixtures("ctx", "cufile_env_json", "driver", "skipIfUnsupportedFilesystem") def test_cufile_read_async(tmpdir): """Test cuFile asynchronous read operations.""" # Create test file @@ -799,8 +798,7 @@ def test_cufile_read_async(tmpdir): os.close(fd) -@pytest.mark.skipif(not isSupportedFilesystem(), reason="cuFile handle_register requires ext4 or xfs filesystem") -@pytest.mark.usefixtures("ctx", "cufile_env_json", "driver") +@pytest.mark.usefixtures("ctx", "cufile_env_json", "driver", "skipIfUnsupportedFilesystem") def test_cufile_async_read_write(tmpdir): """Test cuFile asynchronous read and write operations in sequence.""" # Create test file @@ -910,8 +908,7 @@ def test_cufile_async_read_write(tmpdir): os.close(fd) -@pytest.mark.skipif(not isSupportedFilesystem(), reason="cuFile handle_register requires ext4 or xfs filesystem") -@pytest.mark.usefixtures("driver") +@pytest.mark.usefixtures("driver", "skipIfUnsupportedFilesystem") def test_batch_io_basic(tmpdir): """Test basic batch IO operations with multiple read/write operations.""" # Create test file @@ -1106,8 +1103,7 @@ def test_batch_io_basic(tmpdir): cuda.cuMemFree(buf) -@pytest.mark.skipif(not isSupportedFilesystem(), reason="cuFile handle_register requires ext4 or xfs filesystem") -@pytest.mark.usefixtures("driver") +@pytest.mark.usefixtures("driver", "skipIfUnsupportedFilesystem") def test_batch_io_cancel(tmpdir): """Test batch IO cancellation.""" # Create test file @@ -1183,8 +1179,7 @@ def test_batch_io_cancel(tmpdir): cuda.cuMemFree(buf) -@pytest.mark.skipif(not isSupportedFilesystem(), reason="cuFile handle_register requires ext4 or xfs filesystem") -@pytest.mark.usefixtures("driver") +@pytest.mark.usefixtures("driver", "skipIfUnsupportedFilesystem") def test_batch_io_large_operations(tmpdir): """Test batch IO with large buffer operations.""" # Create test file @@ -1585,8 +1580,7 @@ def test_stats_start_stop(): @pytest.mark.skipif( cufileVersionLessThan(1150), reason="cuFile parameter APIs require cuFile library version 13.0 or later" ) -@pytest.mark.skipif(not isSupportedFilesystem(), reason="cuFile handle_register requires ext4 or xfs filesystem") -@pytest.mark.usefixtures("stats") +@pytest.mark.usefixtures("stats", "skipIfUnsupportedFilesystem") @pytest.mark.thread_unsafe(reason="cuFile stats counters and collection state are process-global") def test_get_stats_l1(tmpdir): """Test cuFile L1 statistics retrieval with file operations.""" @@ -1663,8 +1657,7 @@ def test_get_stats_l1(tmpdir): @pytest.mark.skipif( cufileVersionLessThan(1150), reason="cuFile parameter APIs require cuFile library version 13.0 or later" ) -@pytest.mark.skipif(not isSupportedFilesystem(), reason="cuFile handle_register requires ext4 or xfs filesystem") -@pytest.mark.usefixtures("stats") +@pytest.mark.usefixtures("stats", "skipIfUnsupportedFilesystem") @pytest.mark.thread_unsafe(reason="cuFile stats counters and collection state are process-global") def test_get_stats_l2(tmpdir): """Test cuFile L2 statistics retrieval with file operations.""" @@ -1745,8 +1738,7 @@ def test_get_stats_l2(tmpdir): @pytest.mark.skipif( cufileVersionLessThan(1150), reason="cuFile parameter APIs require cuFile library version 13.0 or later" ) -@pytest.mark.skipif(not isSupportedFilesystem(), reason="cuFile handle_register requires ext4 or xfs filesystem") -@pytest.mark.usefixtures("stats") +@pytest.mark.usefixtures("stats", "skipIfUnsupportedFilesystem") @pytest.mark.thread_unsafe(reason="cuFile stats counters and collection state are process-global") def test_get_stats_l3(tmpdir): """Test cuFile L3 statistics retrieval with file operations.""" From 245198542b61f0b4188eec8225f54a14c5410c6e Mon Sep 17 00:00:00 2001 From: Sebastian Berg Date: Wed, 24 Jun 2026 20:46:21 +0200 Subject: [PATCH 2/4] Apply suggestions from code review Co-authored-by: Leo Fang Signed-off-by: Sebastian Berg --- cuda_bindings/tests/test_cufile.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/cuda_bindings/tests/test_cufile.py b/cuda_bindings/tests/test_cufile.py index 295ac758b8f..7f23ff296ae 100644 --- a/cuda_bindings/tests/test_cufile.py +++ b/cuda_bindings/tests/test_cufile.py @@ -80,7 +80,7 @@ def cufileVersionLessThan(target): @pytest.fixture(scope="session") def skipIfUnsupportedFilesystem(tmpdir_factory): - """Fixture that skips if the current filesystem is supported (ext4 or xfs). + """Fixture that skips if the current filesystem is not supported (ext4 or xfs). The actual requirements are probably both stricter (ext4 was not working on CI previously) and possibly also less strict. @@ -88,7 +88,7 @@ def skipIfUnsupportedFilesystem(tmpdir_factory): This uses `findmnt` so the kernel's mount table logic owns the decoding of the filesystem type. """ cmd = ["findmnt", "-no", "FSTYPE", "-T", tmpdir_factory.getbasetemp()] - fs_type = subprocess.check_output(cmd, text=True).strip() # noqa S603, S607 + fs_type = subprocess.check_output(cmd, text=True).strip() # noqa: S603 logging.info(f"Current filesystem type (findmnt): {fs_type}") if fs_type not in ("ext4", "xfs"): pytest.skip("cuFile handle_register requires ext4 or xfs filesystem") From f4984ae2d80627f2f2af8a3eec7509b6e6b247cd Mon Sep 17 00:00:00 2001 From: Sebastian Berg Date: Mon, 6 Jul 2026 18:38:46 +0200 Subject: [PATCH 3/4] Also allow tmpfs on current cufile (where we know it works) so it runs in CI --- cuda_bindings/tests/test_cufile.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/cuda_bindings/tests/test_cufile.py b/cuda_bindings/tests/test_cufile.py index 7f23ff296ae..35147096f98 100644 --- a/cuda_bindings/tests/test_cufile.py +++ b/cuda_bindings/tests/test_cufile.py @@ -90,8 +90,13 @@ def skipIfUnsupportedFilesystem(tmpdir_factory): cmd = ["findmnt", "-no", "FSTYPE", "-T", tmpdir_factory.getbasetemp()] fs_type = subprocess.check_output(cmd, text=True).strip() # noqa: S603 logging.info(f"Current filesystem type (findmnt): {fs_type}") - if fs_type not in ("ext4", "xfs"): - pytest.skip("cuFile handle_register requires ext4 or xfs filesystem") + # tmpfs is supported since 13.2 (probably), 1.18 definitely seems fine: + if cufileVersionLessThan(1180): + supported_fs_types = ("ext4", "xfs") + else: + supported_fs_types = ("ext4", "xfs", "tmpfs") + if fs_type not in supported_fs_types: + pytest.skip(f"cuFile handle_register does not support filesystem: {fs_type}") @cache From a9f5f14c54ec1c11a9b15bd85fe463b36301b18a Mon Sep 17 00:00:00 2001 From: Sebastian Berg Date: Mon, 6 Jul 2026 19:29:38 +0200 Subject: [PATCH 4/4] Just hack that overlay + CI env variable seems to be fine :/ --- cuda_bindings/tests/test_cufile.py | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/cuda_bindings/tests/test_cufile.py b/cuda_bindings/tests/test_cufile.py index 35147096f98..30070da15e0 100644 --- a/cuda_bindings/tests/test_cufile.py +++ b/cuda_bindings/tests/test_cufile.py @@ -90,11 +90,14 @@ def skipIfUnsupportedFilesystem(tmpdir_factory): cmd = ["findmnt", "-no", "FSTYPE", "-T", tmpdir_factory.getbasetemp()] fs_type = subprocess.check_output(cmd, text=True).strip() # noqa: S603 logging.info(f"Current filesystem type (findmnt): {fs_type}") - # tmpfs is supported since 13.2 (probably), 1.18 definitely seems fine: - if cufileVersionLessThan(1180): - supported_fs_types = ("ext4", "xfs") - else: - supported_fs_types = ("ext4", "xfs", "tmpfs") + + if fs_type == "overlay" and os.environ.get("CI") is not None: + # Things seems to be fine on CI tmpfiles which report as "overlay". + # (Previously the build folder reporting as ext4 was not fine, though.) + return + + # Newer versions may actuall support more (e.g. tmpfs) + supported_fs_types = ("ext4", "xfs") if fs_type not in supported_fs_types: pytest.skip(f"cuFile handle_register does not support filesystem: {fs_type}")