Skip to content

Commit

Permalink
Merge pull request #2910 from disgoel/stress-ng-fix
Browse files Browse the repository at this point in the history
stress-ng: fix teardown
  • Loading branch information
Naresh-ibm authored Oct 24, 2024
2 parents 5d7c4df + 8b8766c commit 0ad19b1
Showing 1 changed file with 4 additions and 3 deletions.
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):
process.run(f"rm -rf {self.stressmnt}", ignore_status=True)

0 comments on commit 0ad19b1

Please sign in to comment.