From 4bd8f060f95c0d50249c2713ed1b210b51742680 Mon Sep 17 00:00:00 2001 From: Cristian Cadar Date: Fri, 5 Jun 2009 22:53:07 +0000 Subject: Fixed a division by zero triggered by straight-line code in klee-stats. Added an error message when no directories are given. git-svn-id: https://llvm.org/svn/llvm-project/klee/trunk@72966 91177308-0d34-0410-b5e6-96231b3b80d8 --- tools/klee-stats/klee-stats | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/tools/klee-stats/klee-stats b/tools/klee-stats/klee-stats index 40994f87..42f486bf 100755 --- a/tools/klee-stats/klee-stats +++ b/tools/klee-stats/klee-stats @@ -123,7 +123,7 @@ def printTable(table): def main(args): from optparse import OptionParser - op = OptionParser(usage="usage: %prog [options] directories*", + op = OptionParser(usage="usage: %prog [options] directories", epilog= "LEGEND " "------ " @@ -154,6 +154,9 @@ def main(args): op.add_option('','--compare-by', dest='compBy', help="key value on which to compare runs to the reference one (which is the first one). E.g., --compare-by=Instrs shows how each run compares to the reference run after executing the same number of instructions as the reference run. If a run hasn't executed as many instructions as the reference one, we simply print the statistics at the end of that run.") opts,dirs = op.parse_args() + + if not dirs: + op.error("no directories given.") actualDirs = [] for dir in dirs: @@ -179,6 +182,11 @@ def main(args): def addRecord(Path,rec): (I,BFull,BPart,BTot,T,St,Mem,QTot,QCon,NObjs,Treal,SCov,SUnc,QT,Ts,Tcex,Tf) = rec + + # special case for straight-line code: report 100% branch coverage + if BTot == 0: + BFull = BTot = 1 + Mem=Mem/1024./1024. AvgQC = int(QCon/max(1,QTot)) if (opts.printAll): -- cgit 1.4.1