Skip to content

test(bindings): Fix unsupported FS check in cufile#2233

Open
seberg wants to merge 2 commits into
NVIDIA:mainfrom
seberg:supported-fs-fixture
Open

test(bindings): Fix unsupported FS check in cufile#2233
seberg wants to merge 2 commits into
NVIDIA:mainfrom
seberg:supported-fs-fixture

Conversation

@seberg

@seberg seberg commented Jun 17, 2026

Copy link
Copy Markdown
Contributor

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.

(I don't love pytest.skip() use, but no good way around as we need the tempdir.)

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.
@copy-pr-bot

copy-pr-bot Bot commented Jun 17, 2026

Copy link
Copy Markdown
Contributor

This pull request requires additional validation before any workflows can run on NVIDIA's runners.

Pull request vetters can view their responsibilities here.

Contributors can view more details about this message here.

@github-actions github-actions Bot added the cuda.bindings Everything related to the cuda.bindings module label Jun 17, 2026
@seberg seberg added test Improvements or additions to tests bug Something isn't working labels Jun 17, 2026
@seberg seberg self-assigned this Jun 17, 2026
@seberg seberg added this to the cuda.core v1.1.0 milestone Jun 17, 2026

@leofang leofang left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A few items — main concern is fixture execution ordering (inline below): usefixtures order is not an execution-order guarantee, so driver can set up before the skip resolves and we'd hit cufile.driver_open() on tests we're about to skip (or error in driver setup on an unsupported FS instead of cleanly skipping). Docstring inversion and # noqa colon are quick fixes. Two minor nits.

Doesn't address #1307 itself — fine, that's a separate root-cause question we can keep open.

-- Leo's bot

Comment thread cuda_bindings/tests/test_cufile.py Outdated
Comment thread cuda_bindings/tests/test_cufile.py Outdated

@pytest.mark.skipif(not isSupportedFilesystem(), reason="cuFile handle_register requires ext4 or xfs filesystem")
@pytest.mark.usefixtures("driver")
@pytest.mark.usefixtures("driver", "skipIfUnsupportedFilesystem")

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

usefixtures string order is not an execution-order guarantee — pytest orders fixtures by scope and dependency graph, not by position in the marker. With ("driver", "skipIfUnsupportedFilesystem") driver can (and likely will) set up first, so we'll run cufile.driver_open() on every test we then skip, and if driver setup itself touches the FS on an unsupported mount it'll error instead of cleanly skipping.

Suggest making the skip a dependency of driver (and stats) so it always resolves first:

@pytest.fixture
def driver(ctx, skipIfUnsupportedFilesystem):
    ...

@pytest.fixture
def stats(..., skipIfUnsupportedFilesystem):
    ...

Then skipIfUnsupportedFilesystem can be dropped from each test's usefixtures list — the dependency carries it transitively.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This seems like the bot is not thinking it through?

driver is used in basically all tests, this just skips some. If it depended on it, sure we skip some setup work but we would stop running tests that can run just fine?!

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()]

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: tmpdir_factory.getbasetemp() returns py.path.local. subprocess coerces via os.fspath, so it works today, but explicit str(...) is more defensive against future py deprecation.

Suggested change
cmd = ["findmnt", "-no", "FSTYPE", "-T", tmpdir_factory.getbasetemp()]
cmd = ["findmnt", "-no", "FSTYPE", "-T", str(tmpdir_factory.getbasetemp())]

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

while I don't care, I really don't see why it makes sense to be "defensive" about this here.

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")

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: worth a sentence in the PR body or docstring that on dev machines where the pytest basetemp lands on tmpfs (a common default for /tmp), the cuFile suite will now silently skip — previously it would attempt to run from CWD. Correct behavior, but a noticeable change for local devs that's worth flagging so nobody is puzzled by 100% skipped tests.

@seberg seberg Jun 24, 2026

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmmmm, but this is a point because the tests did pass, but it might be that they are now indeed skipped (sometimes/always?).

I.e. things are working (maybe in cufile compat mode) here and skipping them would be just because of the FS check not being very good.

EDIT: Sorry, let me just run and see what is the actual situation and then rethink...

Co-authored-by: Leo Fang <leo80042@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working cuda.bindings Everything related to the cuda.bindings module test Improvements or additions to tests

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants