Skip to content

Commit

Permalink
fix tear down
Browse files Browse the repository at this point in the history
The test result shows test passed with warning when test did not ran.
Fix the tear down by adding a check to ensure removal of files
only occurs if they exist.

Signed-off-by: Disha Goel <disgoel@linux.ibm.com>
disgoel committed Mar 6, 2024
1 parent f9427aa commit eff496b
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions perf/perf_stress_ng.py
Original file line number Diff line number Diff line change
@@ -243,10 +243,12 @@ def tearDown(self):
removes the log files and collects the dmesg data
:param: none
"""

file_name = "rm -rf /tmp/stdout /tmp/stderr /tmp/data* /tmp/stressng_output*"
try:
os.remove(file_name)
except OSError:
self.log.warn("Files do not exist")
files_to_remove = ["/tmp/stdout", "/tmp/stderr", "/tmp/data*",
"/tmp/stressng_output*"]
for file_path in files_to_remove:
if os.path.exists(file_path):
try:
os.remove(file_path)
except OSError:
self.log.warn("Files do not exist")
dmesg.collect_dmesg()

0 comments on commit eff496b

Please sign in to comment.