From dd4353fac8a340323ae7af25ff6fe01b36bf3661 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Marjam=C3=A4ki?= Date: Sat, 3 Jun 2017 11:34:11 +0200 Subject: [PATCH] daca2: run stable and unstable separately --- tools/daca2-report.py | 24 +++++++++++------ tools/rundaca2.py | 60 ++++++++++++++++++++++++++----------------- 2 files changed, 52 insertions(+), 32 deletions(-) diff --git a/tools/daca2-report.py b/tools/daca2-report.py index ef01fbe63..6730d7968 100644 --- a/tools/daca2-report.py +++ b/tools/daca2-report.py @@ -31,11 +31,19 @@ def readdate(data): return None datepos = datepos + 1 -path = '.' -if len(sys.argv) == 2: - path = sys.argv[1] +daca2folder = os.path.expanduser('~/daca2/') +path = '' +for arg in sys.argv[1:]: + if arg.startswith('--daca2='): + daca2folder = arg[8:] + if daca2folder[-1:] != '/': + daca2folder = daca2folder + '/' + else + path = arg + if daca2folder[-1:] != '/': + daca2folder = daca2folder + '/' -mainpage = open(path + '/daca2.html', 'wt') +mainpage = open(path + 'daca2.html', 'wt') mainpage.write('\n') mainpage.write('\n') mainpage.write('\n') @@ -64,10 +72,10 @@ mainpage.write( lastupdate = None recent = [] -daca2 = os.path.expanduser('~/daca2/') -for lib in range(2): +daca2 = daca2folder +for lib in [False, True]: for a in "0123456789abcdefghijklmnopqrstuvwxyz": - if lib == 1: + if lib == True: a = "lib" + a if os.path.isfile(daca2 + a + '/results.txt'): f = open(daca2 + a + '/results.txt', 'rt') @@ -113,7 +121,7 @@ for lib in range(2): data = data.replace('>', '>') data = data.replace('\n', '\n') - f = open(path + '/daca2-' + a + '.html', 'wt') + f = open(path + 'daca2-' + a + '.html', 'wt') f.write('\n') f.write('\n') f.write('\n') diff --git a/tools/rundaca2.py b/tools/rundaca2.py index f1ae14fa7..918b92e97 100644 --- a/tools/rundaca2.py +++ b/tools/rundaca2.py @@ -17,14 +17,34 @@ for arg in sys.argv[1:]: else: PASSWORD = arg -# Upload file to trac.cppcheck.net server using scp -def upload(file_to_upload, destination): - if not os.path.isfile(file_to_upload): - return + +def compilecppcheck(CPPFLAGS): + subprocess.call(['nice', 'make', 'clean']) + subprocess.call(['nice', 'make', 'SRCDIR=build', 'CFGDIR=' + os.path.expanduser('~/cppcheck/cfg'), 'CXXFLAGS=-g -O2', 'CPPFLAGS=' + CPPFLAGS]) + subprocess.call(['cp', 'cppcheck', os.path.expanduser('~/daca2/cppcheck-O2')]) + +def runcppcheck(rev, folder, destpath): + subprocess.call(['rm', '-rf', os.path.expanduser('~/daca2/' + folder)]) + subprocess.call(['nice', '--adjustment=19', 'python', os.path.expanduser('~/cppcheck/tools/daca2.py'), folder, '--rev=' + rev, '--skip=virtuoso-opensource']) + subprocess.call(['rm', '-rf', destpath + folder]) + subprocess.call(['cp', '-R', os.path.expanduser('~/daca2/' + folder), destpath + folder]) + subprocess.call(['cp', '', os.path.expanduser('~/daca2/' + folder)]) + upload(os.path.expanduser('~/daca2/' + folder + '/results.txt'), 'evidente/results-' + folder + '.txt') + subprocess.call(['rm', '-rf', os.path.expanduser('~/daca2/lib' + folder)]) + subprocess.call(['nice', '--adjustment=19', 'python', os.path.expanduser('~/cppcheck/tools/daca2.py'), 'lib' + folder, '--rev=' + rev]) + upload(os.path.expanduser('~/daca2/lib' + folder + '/results.txt'), 'evidente/results-lib' + folder + '.txt') + +def daca2report(daca2folder): + subprocess.call(['rm', '-rf', os.path.expanduser('~/daca2-report')]) + subprocess.call(['mkdir', os.path.expanduser('~/daca2-report')]) + subprocess.call(['python', os.path.expanduser('~/cppcheck/tools/daca2-report.py'), '--daca2='+daca2folder, os.path.expanduser('~/daca2-report')]) + +# Upload file to sourceforge server using scp +def upload(folder): try: child = pexpect.spawn( - 'scp ' + file_to_upload + ' upload@trac.cppcheck.net:' + destination) + 'scp -r ' + os.path.expanduser('~/daca2-report') + ' danmar,cppcheck@web.sf.net:htdocs/devinfo/' + folder) child.expect('upload@trac.cppcheck.net\'s password:') child.sendline(PASSWORD) child.interact() @@ -43,32 +63,24 @@ def daca2(foldernum): print('Daca2 folder=' + folder) os.chdir(os.path.expanduser('~/cppcheck')) - subprocess.call(['git', 'pull']) + #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')] - # compile cppcheck - subprocess.call(['nice', 'make', 'SRCDIR=build', 'CFGDIR=' + os.path.expanduser('~/cppcheck/cfg'), 'CXXFLAGS=-g -O2', 'CPPFLAGS=-DMAXTIME=600']) - subprocess.call(['cp', 'cppcheck', os.path.expanduser('~/daca2/cppcheck-O2')]) + # unstable + compilecppcheck('-DMAXTIME=600 -DUNSTABLE') + runcppcheck(rev, folder, os.path.expanduser('~/daca2-unstable/')) + daca2report(os.path.expanduser('~/daca2-unstable/')) + #upload('daca2-unstable') - # run cppcheck - subprocess.call(['rm', '-rf', os.path.expanduser('~/daca2/' + folder)]) - subprocess.call(['nice', '--adjustment=19', 'python', os.path.expanduser('~/cppcheck/tools/daca2.py'), folder, '--rev=' + rev, '--skip=virtuoso-opensource']) - upload(os.path.expanduser('~/daca2/' + folder + '/results.txt'), 'evidente/results-' + folder + '.txt') - subprocess.call(['rm', '-rf', os.path.expanduser('~/daca2/lib' + folder)]) - subprocess.call(['nice', '--adjustment=19', 'python', os.path.expanduser('~/cppcheck/tools/daca2.py'), 'lib' + folder, '--rev=' + rev]) - upload(os.path.expanduser('~/daca2/lib' + folder + '/results.txt'), 'evidente/results-lib' + folder + '.txt') - - # run cppcheck addons - subprocess.call(['rm', '-rf', os.path.expanduser('~/daca2/' + folder)]) - subprocess.call(['nice', '--adjustment=19', 'python', os.path.expanduser('~/cppcheck/tools/daca2-addons.py'), folder, '--rev=' + rev, '--skip=virtuoso-opensource']) - upload(os.path.expanduser('~/daca2/' + folder + '/results.txt'), 'evidente/addons-' + folder + '.txt') - subprocess.call(['rm', '-rf', os.path.expanduser('~/daca2/lib' + folder)]) - subprocess.call(['nice', '--adjustment=19', 'python', os.path.expanduser('~/cppcheck/tools/daca2-addons.py'), 'lib' + folder, '--rev=' + rev]) - upload(os.path.expanduser('~/daca2/lib' + folder + '/results.txt'), 'evidente/addons-lib' + folder + '.txt') + # stable + compilecppcheck('-DMAXTIME=600') + runcppcheck(rev, folder, os.path.expanduser('~/daca2-stable/')) + daca2report(os.path.expanduser('~/daca2-stable/')) + #upload('daca2-stable') foldernum = START while True: