Skip to content

Commit

Permalink
test: Fix fuser invocation in directory cleanup
Browse files Browse the repository at this point in the history
stdout gets captured by Machine.execute(). Write the fuser output to
stderr so that we can actually see it.

Also cover the directory itself, not just its contents.
  • Loading branch information
martinpitt committed Jul 19, 2023
1 parent b0426f8 commit 1d8864a
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion test/common/testlib.py
Original file line number Diff line number Diff line change
Expand Up @@ -2049,7 +2049,7 @@ def restore_dir(self, path: str, post_restore_action: Optional[str] = None, rebo
if path.startswith("/home"):
cmd = f"umount -lf {path}"
else:
cmd = f"umount {path} || {{ fuser -uvk {path}/* || true; sleep 1; umount {path}; }}"
cmd = f"umount {path} || {{ fuser -uvk {path} {path}/* >&2 || true; sleep 1; umount {path}; }}"
self.addCleanup(self.machine.execute, cmd)

def restore_file(self, path: str, post_restore_action: Optional[str] = None):
Expand Down

0 comments on commit 1d8864a

Please sign in to comment.