From 7722eb55eae91252a235ba8f0f624b331b1b8d3f Mon Sep 17 00:00:00 2001 From: Steven Li Date: Sun, 26 Jul 2020 23:32:04 +0000 Subject: [PATCH] Adjusted crash_gen tool to save old log files, instead of deleting them --- tests/pytest/crash_gen.py | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/tests/pytest/crash_gen.py b/tests/pytest/crash_gen.py index 5a26719f76..fead65596f 100755 --- a/tests/pytest/crash_gen.py +++ b/tests/pytest/crash_gen.py @@ -2455,11 +2455,16 @@ class TdeSubProcess: # Delete the log files logPath = self.getBuildPath() + "/test/log" # ref: https://stackoverflow.com/questions/1995373/deleting-all-files-in-a-directory-with-python/1995397 - filelist = [ f for f in os.listdir(logPath) ] # if f.endswith(".bak") ] - for f in filelist: - filePath = os.path.join(logPath, f) - print("Removing log file: {}".format(filePath)) - os.remove(filePath) + # filelist = [ f for f in os.listdir(logPath) ] # if f.endswith(".bak") ] + # for f in filelist: + # filePath = os.path.join(logPath, f) + # print("Removing log file: {}".format(filePath)) + # os.remove(filePath) + logPathSaved = logPath + "_" + time.strftime('%Y-%m-%d-%H-%M-%S') + logger.info("Saving old log files to: {}".format(logPathSaved)) + os.rename(logPath, logPathSaved) + os.mkdir(logPath) # recreate + svcCmd = [taosdPath, '-c', cfgPath] # svcCmd = ['vmstat', '1']