Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

stress-ng: fix teardown #2910

Merged
merged 1 commit into from
Oct 24, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions generic/stress-ng.py
Original file line number Diff line number Diff line change
Expand Up @@ -198,11 +198,12 @@ def test(self):
"\n".join(ERROR))

def tearDown(self):
if 'filesystem' in self.class_type:
if hasattr(self, 'loop_dev') and os.path.exists(self.loop_dev):
process.run("umount %s" % self.loop_dev, ignore_status=True,
sudo=True)
process.run("losetup -d %s" % self.loop_dev, ignore_status=True,
sudo=True)
if os.path.exists('/tmp/blockfile'):
process.run("rm -rf /tmp/blockfile", ignore_status=True, sudo=True)
if (os.path.exists(self.stressmnt)):
process.run(f"rm -rf {self.stressmnt}")
if hasattr(self, 'stressmnt') and os.path.exists(self.stressmnt):
Copy link
Collaborator

Choose a reason for hiding this comment

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

@disgoel is stressmnt and /tmp/blockfile are the same?
if so why are we using variable at one place and hardcoded value at another place?
prefer not to hard code as it may fail if variable name differs

Copy link
Contributor Author

Choose a reason for hiding this comment

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

both are different
self.stressmnt is a directory and /tmp/blockfile is a block device

process.run(f"rm -rf {self.stressmnt}", ignore_status=True)
Loading