aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVincent Mahe <v.mahe@orange.com>2020-09-15 17:41:38 +0200
committerCédric Ollivier <cedric.ollivier@orange.com>2021-02-09 19:35:46 +0100
commit902e1e624393f59d18e0d44f4590743e8010ce1d (patch)
tree381901a1b3c80271b6e2f66c7900cb45253f39f9
parentaf4d52066af5951118a9ab710858a994ebaf61bd (diff)
Cleanup previous run output files
Signed-off-by: Vincent Mahe <v.mahe@orange.com> Change-Id: I9ec39012457ae1a5f7017d41d79237d7a1e300d4 (cherry picked from commit 43d5772accb16742f09ddbc3d89ff5c315a2c0a4)
-rw-r--r--xtesting/core/mts.py17
1 files changed, 13 insertions, 4 deletions
diff --git a/xtesting/core/mts.py b/xtesting/core/mts.py
index 0c861e90..a7ec9d23 100644
--- a/xtesting/core/mts.py
+++ b/xtesting/core/mts.py
@@ -18,6 +18,7 @@ helpers to run any python method or any bash command.
import csv
import logging
import os
+import shutil
import subprocess
import sys
import time
@@ -209,10 +210,18 @@ class MTSLauncher(testcase.TestCase):
self.mts_logs_dir)
# Make sure to create the necessary output sub-folders for MTS
- if not os.path.isdir(self.mts_stats_dir):
- os.makedirs(self.mts_stats_dir)
- if not os.path.isdir(self.mts_logs_dir):
- os.makedirs(self.mts_logs_dir)
+ # and cleanup output files from previous run.
+ if os.path.exists(self.mts_result_csv_file):
+ os.remove(self.mts_result_csv_file)
+
+ if os.path.isdir(self.mts_stats_dir):
+ shutil.rmtree(self.mts_stats_dir)
+ os.makedirs(self.mts_stats_dir)
+
+ if os.path.isdir(self.mts_logs_dir):
+ shutil.rmtree(self.mts_logs_dir)
+ os.makedirs(self.mts_logs_dir)
+
self.__logger.info(
"MTS statistics output dir: %s ", self.mts_stats_dir)
self.__logger.info("MTS logs output dir: %s ", self.mts_logs_dir)