Add times script for windows that uses VS compiler

This commit is contained in:
Daniel Marjamäki 2016-01-19 13:35:38 +01:00
parent dc5e2d5c8d
commit 93dd3a21fd
1 changed files with 42 additions and 0 deletions

42
tools/times-vs.py Normal file
View File

@ -0,0 +1,42 @@
import subprocess
import glob
import re
import sys
if len(sys.argv) != 2:
print('revisions not specified')
sys.exit(1)
res = re.match(r'([0-9]+):([0-9]+)', sys.argv[1])
if res is None:
print('invalid format, 11111:22222')
sys.exit(1)
rev1 = int(res.group(1))
rev2 = int(res.group(2))
if rev1>rev2 or rev1<10000 or rev2>20000 or rev2-rev1>500:
print('range, aborting')
sys.exit(1)
print('Revisions: ' + str(rev1) + ':' + str(rev2))
f = open('results.txt', 'wt')
f.write('\n')
f.close()
for rev in range(rev1,rev2):
subprocess.call(['svn', 'revert', '-R', '.'])
subprocess.call(['svn', 'up', '-r' + str(rev)])
for vcxproj in glob.glob('*/*.vcxproj'):
subprocess.call([r'c:\cygwin64\bin\sed.exe', '-i', 's/140/120/', vcxproj])
subprocess.call('msbuild cppcheck.sln /t:build /p:configuration=Release,platform=x64'.split())
print('Revision:' + str(rev))
p = subprocess.Popen(r'bin\cppcheck.exe src -q --showtime=summary'.split(), stdout=subprocess.PIPE, stderr=subprocess.PIPE)
comm = p.communicate()
f = open('results.txt', 'at')
f.write('\nREV ' + str(rev) + '\n')
f.write(comm[0].decode('utf-8'))
f.close()