2015-08-20 12:57:45 +02:00
|
|
|
#!/usr/bin/python
|
|
|
|
|
|
|
|
import subprocess
|
|
|
|
import pexpect
|
|
|
|
import os
|
|
|
|
import shutil
|
|
|
|
import time
|
|
|
|
import sys
|
|
|
|
|
2016-05-10 11:00:57 +02:00
|
|
|
START = 0
|
2015-08-20 12:57:45 +02:00
|
|
|
PASSWORD = ''
|
2016-02-08 09:28:02 +01:00
|
|
|
for arg in sys.argv[1:]:
|
|
|
|
if len(arg)==1:
|
|
|
|
START = '0123456789abcdefghijklmnopqrstuvwxyz'.find(arg)
|
|
|
|
if START < 0:
|
|
|
|
START = 0
|
|
|
|
else:
|
|
|
|
PASSWORD = arg
|
2015-08-20 12:57:45 +02:00
|
|
|
|
|
|
|
# Upload file to sourceforge web server using scp
|
|
|
|
def upload(file_to_upload, destination):
|
|
|
|
if not os.path.isfile(file_to_upload):
|
|
|
|
return
|
|
|
|
|
|
|
|
try:
|
|
|
|
child = pexpect.spawn(
|
|
|
|
'scp ' + file_to_upload + ' upload@trac.cppcheck.net:' + destination)
|
|
|
|
child.expect('upload@trac.cppcheck.net\'s password:')
|
|
|
|
child.sendline(PASSWORD)
|
|
|
|
child.interact()
|
|
|
|
except IOError:
|
|
|
|
pass
|
|
|
|
except OSError:
|
|
|
|
pass
|
|
|
|
except pexpect.TIMEOUT:
|
|
|
|
pass
|
|
|
|
|
2015-08-21 10:55:19 +02:00
|
|
|
|
2015-08-20 12:57:45 +02:00
|
|
|
def daca2(foldernum):
|
|
|
|
folders = '0123456789abcdefghijklmnopqrstuvwxyz'
|
|
|
|
folder = folders[foldernum % len(folders)]
|
|
|
|
|
|
|
|
print('Daca2 folder=' + folder)
|
|
|
|
|
|
|
|
os.chdir(os.path.expanduser('~/cppcheck'))
|
|
|
|
subprocess.call(['git', 'pull'])
|
|
|
|
p = subprocess.Popen(['git', 'show', '--format=%h'],
|
|
|
|
stdout=subprocess.PIPE, stderr=subprocess.PIPE)
|
|
|
|
comm = p.communicate()
|
|
|
|
rev = comm[0]
|
|
|
|
rev = rev[:rev.find('\n')]
|
|
|
|
|
2015-08-21 15:46:10 +02:00
|
|
|
# compile cppcheck
|
2016-07-01 15:46:20 +02:00
|
|
|
subprocess.call(['nice', 'make', 'SRCDIR=build', 'CFGDIR=' + os.path.expanduser('~/cppcheck/cfg'), 'CXXFLAGS=-g -O2', 'CPPFLAGS=-DMAXTIME=600'])
|
2015-11-23 11:19:44 +01:00
|
|
|
subprocess.call(['cp', 'cppcheck', os.path.expanduser('~/daca2/cppcheck-O2')])
|
2015-08-20 12:57:45 +02:00
|
|
|
|
2015-08-21 15:46:10 +02:00
|
|
|
# run cppcheck
|
2015-09-28 09:08:37 +02:00
|
|
|
subprocess.call(['rm', '-rf', os.path.expanduser('~/daca2/' + folder)])
|
2015-08-20 12:57:45 +02:00
|
|
|
subprocess.call(['nice', '--adjustment=19', 'python', os.path.expanduser('~/cppcheck/tools/daca2.py'), folder, '--rev=' + rev])
|
2015-08-21 10:55:19 +02:00
|
|
|
upload(os.path.expanduser('~/daca2/' + folder + '/results.txt'), 'evidente/results-' + folder + '.txt')
|
2015-09-28 09:08:37 +02:00
|
|
|
subprocess.call(['rm', '-rf', os.path.expanduser('~/daca2/lib' + folder)])
|
2015-08-20 12:57:45 +02:00
|
|
|
subprocess.call(['nice', '--adjustment=19', 'python', os.path.expanduser('~/cppcheck/tools/daca2.py'), 'lib' + folder, '--rev=' + rev])
|
2015-08-21 10:55:19 +02:00
|
|
|
upload(os.path.expanduser('~/daca2/lib' + folder + '/results.txt'), 'evidente/results-lib' + folder + '.txt')
|
2015-08-20 12:57:45 +02:00
|
|
|
|
2015-08-21 15:46:10 +02:00
|
|
|
# run cppcheck addons
|
2015-09-28 09:08:37 +02:00
|
|
|
subprocess.call(['rm', '-rf', os.path.expanduser('~/daca2/' + folder)])
|
2015-08-21 15:46:10 +02:00
|
|
|
subprocess.call(['nice', '--adjustment=19', 'python', os.path.expanduser('~/cppcheck/tools/daca2-addons.py'), folder, '--rev=' + rev])
|
2016-01-05 13:28:42 +01:00
|
|
|
upload(os.path.expanduser('~/daca2/' + folder + '/results.txt'), 'evidente/addons-' + folder + '.txt')
|
2015-09-28 09:08:37 +02:00
|
|
|
subprocess.call(['rm', '-rf', os.path.expanduser('~/daca2/lib' + folder)])
|
2015-08-21 15:46:10 +02:00
|
|
|
subprocess.call(['nice', '--adjustment=19', 'python', os.path.expanduser('~/cppcheck/tools/daca2-addons.py'), 'lib' + folder, '--rev=' + rev])
|
2016-01-05 13:28:42 +01:00
|
|
|
upload(os.path.expanduser('~/daca2/lib' + folder + '/results.txt'), 'evidente/addons-lib' + folder + '.txt')
|
2015-08-21 15:46:10 +02:00
|
|
|
|
2016-02-08 09:28:02 +01:00
|
|
|
foldernum = START
|
2015-08-20 12:57:45 +02:00
|
|
|
while True:
|
|
|
|
daca2(foldernum)
|
|
|
|
foldernum = foldernum + 1
|