about summary refs log tree commit diff homepage
path: root/test
diff options
context:
space:
mode:
authorDan Liew <daniel.liew@imperial.ac.uk>2014-01-28 00:11:16 +0000
committerDan Liew <daniel.liew@imperial.ac.uk>2014-01-28 00:11:16 +0000
commitaa9c2410b3fea708fbd6f62f346c9c864a96598e (patch)
treef789a9e46d39ddce1d27917e9cbfbab52da8b9b1 /test
parente49c1e1958e863195b01d99c92194289b4034bbb (diff)
downloadklee-aa9c2410b3fea708fbd6f62f346c9c864a96598e.tar.gz
Allow passing arbitrary command line flags to klee and kleaver
when running llvm-lit. This is done by doing something like

$ cd test/
$ llvm-lit --param klee_opts=--xxx --param kleaver_opts=--yyy .

This would pass "--xxx" as an extra option to KLEE when running
tests and would pass "--yyy" as an extra option to kleaver when
running tests.

This feature has been added to make it easy to pass different flags to
KLEE or Kleaver without needing to modify tests or recompile KLEE with
different defaults (yuck!).
Diffstat (limited to 'test')
-rw-r--r--test/lit.cfg21
1 files changed, 17 insertions, 4 deletions
diff --git a/test/lit.cfg b/test/lit.cfg
index 36a79b42..ab1b7678 100644
--- a/test/lit.cfg
+++ b/test/lit.cfg
@@ -53,10 +53,23 @@ for name in subs:
         lit.fatal('{0} is not set'.format(name))
     config.substitutions.append( ('%' + name, value))
 
-# Set absolute paths for KLEE's tools
-subs = [ ('%kleaver', 'kleaver'), ('%klee','klee') ]
-for s,basename in subs:
-    config.substitutions.append( (s, os.path.join(klee_tools_dir, basename) ) )
+# Get KLEE and Kleaver specific parameters passed on llvm-lit cmd line
+# e.g. llvm-lit --param klee_opts=--help
+klee_extra_params = lit.params.get('klee_opts',"")
+kleaver_extra_params = lit.params.get('kleaver_opts',"")
+
+if len(klee_extra_params) != 0:
+    print("Passing extra KLEE command line args: {0}".format(klee_extra_params))
+if len(kleaver_extra_params) != 0:
+    print("Passing extra Kleaver command line args: {0}".format(kleaver_extra_params))
+
+# Set absolute paths and extra cmdline args for KLEE's tools
+subs = [ ('%kleaver', 'kleaver', kleaver_extra_params), ('%klee','klee', klee_extra_params) ]
+for s,basename,extra_args in subs:
+    config.substitutions.append( ( s,
+                                   "{0} {1}".format( os.path.join(klee_tools_dir, basename), extra_args )
+                                 )
+                               )
 
 
 # LLVM < 3.0 doesn't Support %T directive