2017-06-04 22:51:48 +02:00
|
|
|
#!/usr/bin/env python3
|
2016-01-19 13:46:21 +01:00
|
|
|
# Times script using Visual Studio compiler in Windows
|
|
|
|
#
|
|
|
|
# This script assumes that you have:
|
|
|
|
# Python 3
|
|
|
|
# Visual Studio (script assumes VS2013, manipulate the sed command otherwise)
|
|
|
|
# Cygwin64 for the sed command
|
|
|
|
# Command line svn. TortoiseSVN with that feature selected works.
|
|
|
|
#
|
|
|
|
# Usage:
|
|
|
|
# Open VS command prompt.
|
|
|
|
# cd c:\users\...
|
|
|
|
# svn checkout https://github.com/danmar/cppcheck/trunk cppcheck-svn
|
|
|
|
# cd cppcheck-svn
|
|
|
|
# c:\python34\python.exe times-vs.py rev1:rev2
|
|
|
|
|
|
|
|
|
2016-01-19 13:35:38 +01:00
|
|
|
import subprocess
|
|
|
|
import glob
|
|
|
|
import re
|
|
|
|
import sys
|
|
|
|
|
|
|
|
if len(sys.argv) != 2:
|
2016-07-23 13:44:05 +02:00
|
|
|
print('revisions not specified')
|
|
|
|
sys.exit(1)
|
2016-01-19 13:35:38 +01:00
|
|
|
|
|
|
|
res = re.match(r'([0-9]+):([0-9]+)', sys.argv[1])
|
|
|
|
if res is None:
|
2016-07-23 13:44:05 +02:00
|
|
|
print('invalid format, 11111:22222')
|
|
|
|
sys.exit(1)
|
2016-01-19 13:35:38 +01:00
|
|
|
|
|
|
|
rev1 = int(res.group(1))
|
|
|
|
rev2 = int(res.group(2))
|
|
|
|
|
2016-07-23 13:44:05 +02:00
|
|
|
if rev1 > rev2 or rev1 < 10000 or rev2 > 20000 or rev2 - rev1 > 500:
|
|
|
|
print('range, aborting')
|
|
|
|
sys.exit(1)
|
2016-01-19 13:35:38 +01:00
|
|
|
|
|
|
|
print('Revisions: ' + str(rev1) + ':' + str(rev2))
|
|
|
|
|
|
|
|
f = open('results.txt', 'wt')
|
|
|
|
f.write('\n')
|
|
|
|
f.close()
|
|
|
|
|
2016-07-23 13:44:05 +02:00
|
|
|
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))
|
2017-06-04 22:51:48 +02:00
|
|
|
p = subprocess.Popen(r'bin\cppcheck.exe src -q --showtime=summary'.split(),
|
|
|
|
stdout=subprocess.PIPE, stderr=subprocess.PIPE)
|
2016-07-23 13:44:05 +02:00
|
|
|
comm = p.communicate()
|
|
|
|
f = open('results.txt', 'at')
|
|
|
|
f.write('\nREV ' + str(rev) + '\n')
|
|
|
|
f.write(comm[0].decode('utf-8'))
|
|
|
|
f.close()
|