Skip to content

Commit ef594db

Browse files
committed
chore: actually find the mount point first
1 parent 1e61ea2 commit ef594db

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

cuda_bindings/tests/test_cufile.py

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
import tempfile
1111
from contextlib import suppress
1212
from functools import cache
13+
from pathlib import Path
1314

1415
import cuda.bindings.driver as cuda
1516
import pytest
@@ -90,21 +91,28 @@ def cufileVersionLessThan(target):
9091
return True # Assume old version if any error occurs
9192

9293

94+
def find_mount_point(path):
95+
return next((str(parent) for parent in Path(path).absolute().parents if parent.is_mount()), None)
96+
97+
9398
@cache
9499
def isSupportedFilesystem():
95100
"""Check if the current filesystem is supported (ext4 or xfs)."""
101+
96102
try:
97103
current_dir = os.getcwd()
98104
# Try to get filesystem type from /proc/mounts
105+
mount = find_mount_point(current_dir)
106+
assert mount is not None
99107
with open("/proc/mounts") as f:
100108
for line in f:
101109
parts = line.split()
102-
if len(parts) >= 2:
110+
if len(parts) >= 3:
103111
mount_point = parts[1]
104112
fs_type = parts[2]
105113

106114
# Check if current directory is under this mount point
107-
if current_dir.startswith(mount_point):
115+
if mount == mount_point:
108116
fs_type_lower = fs_type.lower()
109117
logging.info(f"Current filesystem type: {fs_type_lower}")
110118
if fs_type_lower in ("ext4", "xfs"):

0 commit comments

Comments
 (0)