diff --git a/tools/dashboard/generate_dashboard.py b/tools/dashboard/generate_dashboard.py index 76b469320c..689f7caed4 100755 --- a/tools/dashboard/generate_dashboard.py +++ b/tools/dashboard/generate_dashboard.py @@ -30,9 +30,9 @@ def main(): config.read(config_fn) if(path.exists(status_fn)): - last_change = eval(open(status_fn).read()) + last_ok = eval(open(status_fn).read()) else: - last_change = dict() + last_ok = dict() svn_info = check_output("svn info svn://svn.code.sf.net/p/cp2k/code/trunk".split()) trunk_revision = int(re.search('Last Changed Rev: (\d+)\n', svn_info).group(1)) @@ -76,7 +76,7 @@ def main(): except: print traceback.print_exc() report = dict() - report['status'] = "UNKOWN" + report['status'] = "UNKOWN" report['summary'] = "Could not retrieve and parse report" output += '' @@ -84,7 +84,7 @@ def main(): output += '%s'%(link_url, name) else: output += '%s'%name - output += '%s'%host + output += '%s'%host #Status if(report['status'] == "OK"): @@ -98,8 +98,8 @@ def main(): #Revision if(report.has_key('revision')): output += rev_link(report['revision'], trunk_revision) - if(not last_change.has_key(s) or last_change[s][0]!=report['status']): - last_change[s] = (report['status'], report['revision']) + if(report['status'] == "OK"): + last_ok[s] = report['revision'] else: output += 'N/A' @@ -107,10 +107,13 @@ def main(): output += '%s'%report['summary'] #Since - if(last_change.has_key(s)): - output += rev_link(last_change[s][1], trunk_revision) + if(report['status'] != "OK"): + if(last_ok.has_key(s)): + output += rev_link(last_ok[s]+1, trunk_revision) + else: + output += 'N/A' else: - output += 'N/A' + output += '' output += '\n\n' @@ -118,7 +121,7 @@ def main(): output += '

Page last updated: %s

\n'%now.isoformat() output += '' - open(status_fn, "w").write(pformat(last_change)) + open(status_fn, "w").write(pformat(last_ok)) print("Wrote "+status_fn) open(output_fn, "w").write(output) diff --git a/tools/dashboard/test_coverage.py b/tools/dashboard/test_coverage.py index bb378b3887..51e9cffdbb 100755 --- a/tools/dashboard/test_coverage.py +++ b/tools/dashboard/test_coverage.py @@ -21,14 +21,19 @@ def main(): ref_fn, lcov_fn = sys.argv[1:] content = open(lcov_fn).read() lines = content.split("\n") - data_lines = lines[4:-3] + assert(lines[2] == "="*80) + assert(lines[-3] == "="*80) + assert(lines[3][0] == "[") coverage = {} - for l in data_lines: + for l in lines[4:-3]: + assert(len(l.strip())>0) + assert(l[0] != "[") parts = [p.strip() for p in l.split("|")] - p = parts[1].split("%")[0] - coverage[parts[0]] = float(p) + rate, nlines = parts[1].split() + assert(rate[-1] == "%") + coverage[parts[0]] = (float(rate[:-1]), int(nlines)) if(not path.exists(ref_fn)): open(ref_fn, "w").write(pformat(coverage)) @@ -40,22 +45,30 @@ def main(): issues = 0 new_ref_coverage = dict() - for n, c in coverage.items(): - if(ref_coverage.has_key(n)): - if(c < ref_coverage[n]): + for fn in coverage.keys(): + cov_rate, nlines = coverage[fn] + uncov_lines = nlines*(100.0 - cov_rate)/100.0 + if(ref_coverage.has_key(fn)): + cov_rate0, nlines0 = ref_coverage[fn] + uncov_lines0 = nlines0*(100.0 - cov_rate0)/100.0 + tol = max(nlines, nlines0) * 0.001 # uncov_lines has limited precision + if(uncov_lines-uncov_lines0>tol and cov_rate 90.0): - new_ref_coverage[n] = c + print('Coverage of file "%s" decreased from %.1f%% to %.1f%%.'%(fn, cov_rate0, cov_rate)) + print('Number of untests lines of file "%s" increased from %d to %d.'%(fn, uncov_lines0, uncov_lines)) + new_ref_coverage[fn] = (cov_rate0, nlines0) else: + new_ref_coverage[fn] = (cov_rate, nlines) + else: + if(cov_rate < 90.0): issues += 1 - print('New file "%s" has only %.1f%% coverage.'%(n, c)) + print('New file "%s" has only %.1f%% coverage.'%(fn, cov_rate)) + else: + new_ref_coverage[fn] = (cov_rate, nlines) assert("Total:" in lines[-2]) total_coverage = float(lines[-2].split("|")[1].split("%")[0]) - print "Summary: Found %d issues, total coverage is at %.f%%."%(issues, total_coverage) + print "Summary: Found %d issues, total coverage is at %.1f%%."%(issues, total_coverage) print "Status: "+ ("OK" if(issues==0) else "FAILED") open(ref_fn, "w").write(pformat(new_ref_coverage)) diff --git a/tools/dashboard/test_formatting.sh b/tools/dashboard/test_formatting.sh index 3aeeda05f0..7530cbbe7a 100755 --- a/tools/dashboard/test_formatting.sh +++ b/tools/dashboard/test_formatting.sh @@ -11,19 +11,30 @@ svn up svn info find ./src/ -type f -not -path "*/preprettify/*" -not -path "*/.svn/*" -print0 | xargs -0 md5sum > checksums.md5 +md5sum ./data/POTENTIAL >> checksums.md5 + find ./src/ -type f -name "*instantiation" -not -path "*/.svn/*" -print0 | xargs -0 ./tools/instantiateTemplates.py cd makefiles make --jobs=20 pretty cd .. +cd data +cat GTH_POTENTIALS HF_POTENTIALS NLCC_POTENTIALS ALL_POTENTIALS > POTENTIAL +cd .. + nfiles=`wc -l checksums.md5 | cut -f 1 -d " "` summary="Checked $nfiles files." status="OK" -echo "Searching for UNMATCHED_PROCEDURE_ARGUMENT ..." -if grep -r "UNMATCHED_PROCEDURE_ARGUMENT" ./src/* ; then - summary="Found UNMATCHED_PROCEDURE_ARGUMENT" +echo "Searching for doxify warnings ..." +if grep -r -e "UNMATCHED_PROCEDURE_ARGUMENT" \ + -e "UNKNOWN_DOXYGEN_COMMENT" \ + -e "UNKNOWN_COMMENT" \ + --exclude-dir=".svn" \ + --exclude-dir="preprettify" \ + ./src/* ; then + summary="Found doxify warnings" status="FAILED" fi