Skip to content

Commit 50d2496

Browse files
committed
Fix Unix mount-tests: unmount detection and ps truncation
1 parent 5663135 commit 50d2496

2 files changed

Lines changed: 16 additions & 9 deletions

File tree

amifuse/platform.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -563,10 +563,11 @@ def _find_amifuse_mounts_unix():
563563
is_mac = sys.platform.startswith("darwin")
564564

565565
# macOS: lstart gives absolute start time; Linux: etimes gives elapsed seconds
566+
# -ww prevents truncation of long command lines in headless environments
566567
if is_mac:
567-
ps_cmd = ["ps", "-axo", "pid=,ppid=,lstart=,command="]
568+
ps_cmd = ["ps", "-axwwo", "pid=,ppid=,lstart=,command="]
568569
else:
569-
ps_cmd = ["ps", "-axo", "pid=,ppid=,etimes=,command="]
570+
ps_cmd = ["ps", "-axwwo", "pid=,ppid=,etimes=,command="]
570571

571572
try:
572573
result = subprocess.run(

tests/integration/test_mount_lifecycle.py

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -147,16 +147,22 @@ def test_unmount_cleans_up(mount_image, pfs3_image, pfs3_driver):
147147
proc.wait(timeout=5)
148148

149149
# Poll until unmount detected
150-
# On Windows, os.path.ismount on a drive letter may remain True briefly
151-
# after the FUSE process exits. Use listdir failure as the signal.
152150
deadline = time.monotonic() + 10.0
153151
unmounted = False
154152
while time.monotonic() < deadline:
155-
try:
156-
os.listdir(mp_str)
157-
except OSError:
158-
unmounted = True
159-
break
153+
if sys.platform.startswith("win"):
154+
# Windows: drive letter disappears, listdir throws
155+
try:
156+
os.listdir(mp_str)
157+
except OSError:
158+
unmounted = True
159+
break
160+
else:
161+
# Unix: mountpoint reverts to empty dir after FUSE detaches,
162+
# so listdir won't throw. Use ismount (st_dev comparison).
163+
if not os.path.ismount(mp_str):
164+
unmounted = True
165+
break
160166
time.sleep(0.5)
161167

162168
assert unmounted, (

0 commit comments

Comments
 (0)