File tree Expand file tree Collapse file tree 1 file changed +10
-2
lines changed Expand file tree Collapse file tree 1 file changed +10
-2
lines changed Original file line number Diff line number Diff line change 1010import tempfile
1111from contextlib import suppress
1212from functools import cache
13+ from pathlib import Path
1314
1415import cuda .bindings .driver as cuda
1516import 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
9499def 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" ):
You can’t perform that action at this time.
0 commit comments