about summary refs log tree commit diff homepage
path: root/tools/klee-stats
diff options
context:
space:
mode:
authorCristian Cadar <cristic@cs.stanford.edu>2009-06-05 22:53:07 +0000
committerCristian Cadar <cristic@cs.stanford.edu>2009-06-05 22:53:07 +0000
commit4bd8f060f95c0d50249c2713ed1b210b51742680 (patch)
tree31b285e6ae8b4519eb24a7964a42bbcb0e2ba0cb /tools/klee-stats
parent450eae13bfd668ebd938218c0687213fcba8dd13 (diff)
downloadklee-4bd8f060f95c0d50249c2713ed1b210b51742680.tar.gz
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
Diffstat (limited to 'tools/klee-stats')
-rwxr-xr-xtools/klee-stats/klee-stats10
1 files changed, 9 insertions, 1 deletions
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):