daca2: write current time in report

This commit is contained in:
Daniel Marjamäki 2016-07-22 08:31:00 +02:00
parent 1b6ae0de8f
commit 035a9a162a
1 changed files with 7 additions and 3 deletions

View File

@ -122,6 +122,8 @@ def removeLargeFiles(path):
if path.find('/clang/INPUTS/') > 0 or statinfo.st_size > 1000000: if path.find('/clang/INPUTS/') > 0 or statinfo.st_size > 1000000:
os.remove(g) os.remove(g)
def strfCurrTime(fmt):
return datetime.time.strftime(datetime.datetime.now().time(), fmt)
def scanarchive(filepath, jobs): def scanarchive(filepath, jobs):
# remove all files/folders except results.txt # remove all files/folders except results.txt
@ -148,7 +150,7 @@ def scanarchive(filepath, jobs):
removeLargeFiles('') removeLargeFiles('')
print('cppcheck ' + filename) print(strfCurrTime('[%H:%M] cppcheck ' ) + filename)
p = subprocess.Popen( p = subprocess.Popen(
['nice', ['nice',
@ -165,9 +167,9 @@ def scanarchive(filepath, jobs):
results = open('results.txt', 'at') results = open('results.txt', 'at')
if p.returncode == 0: if p.returncode == 0:
results.write(comm[1]) results.write(comm[1] + strfCurrTime('[%H:%M]') + '\n')
elif comm[0].find('cppcheck: error: could not find or open any of the paths given.') < 0: elif comm[0].find('cppcheck: error: could not find or open any of the paths given.') < 0:
results.write(comm[1]) results.write(comm[1] + strfCurrTime('[%H:%M]') + '\n')
results.write('Exit code is not zero! Crash?\n') results.write('Exit code is not zero! Crash?\n')
results.write('\n') results.write('\n')
results.close() results.close()
@ -205,6 +207,7 @@ os.chdir(workdir + FOLDER)
try: try:
results = open('results.txt', 'wt') results = open('results.txt', 'wt')
results.write('STARTDATE ' + str(datetime.date.today()) + '\n') results.write('STARTDATE ' + str(datetime.date.today()) + '\n')
results.write('STARTTIME ' + strfCurrTime('%H:%M:%S') + '\n')
if REV: if REV:
results.write('GIT-REVISION ' + REV + '\n') results.write('GIT-REVISION ' + REV + '\n')
results.write('\n') results.write('\n')
@ -215,6 +218,7 @@ try:
results = open('results.txt', 'at') results = open('results.txt', 'at')
results.write('DATE ' + str(datetime.date.today()) + '\n') results.write('DATE ' + str(datetime.date.today()) + '\n')
results.write('TIME ' + strfCurrTime('%H:%M:%S') + '\n')
results.close() results.close()
except EOFError: except EOFError: