about summary refs log tree commit diff homepage
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/Runtime/POSIX/Isatty.c4
-rw-r--r--test/lit.cfg38
2 files changed, 33 insertions, 9 deletions
diff --git a/test/Runtime/POSIX/Isatty.c b/test/Runtime/POSIX/Isatty.c
index bd514d48..3054aadb 100644
--- a/test/Runtime/POSIX/Isatty.c
+++ b/test/Runtime/POSIX/Isatty.c
@@ -1,5 +1,5 @@
 // RUN: %llvmgcc %s -emit-llvm -O0 -c -o %t.bc
-// RUN: %klee --libc=uclibc --posix-runtime %t.bc --sym-files 0 10 --sym-stdout 2>%t.log
+// RUN: %klee --libc=uclibc --posix-runtime %t.bc --sym-files 0 10 --sym-stdout > %t.log 2>&1
 // RUN: test -f %T/klee-last/test000001.ktest
 // RUN: test -f %T/klee-last/test000002.ktest
 // RUN: test -f %T/klee-last/test000003.ktest
@@ -10,7 +10,7 @@
 // RUN: grep -q "stdout is NOT a tty" %t.log
 
 // Depending on how uClibc is compiled (i.e. without -DKLEE_SYM_PRINTF)
-// fprintf prints out on stdout even stderr is provided.
+// fprintf prints out on stdout even if stderr is provided.
 #include <unistd.h>
 #include <stdio.h>
 #include <assert.h>
diff --git a/test/lit.cfg b/test/lit.cfg
index 36a79b42..23696138 100644
--- a/test/lit.cfg
+++ b/test/lit.cfg
@@ -36,9 +36,20 @@ if klee_obj_root is not None:
     path = os.path.pathsep.join((llvm_tools_dir, klee_tools_dir, config.environment['PATH'] ))
     config.environment['PATH'] = path
 
-# Propogate 'HOME' through the environment.
-config.environment['HOME'] = os.environ['HOME']
-config.environment['PWD'] = os.environ['PWD']
+
+# Propogate some environment variable to test environment.
+def addEnv(name):
+    if name in os.environ:
+        config.environment[name] = os.environ[name]
+
+addEnv('HOME')
+addEnv('PWD')
+
+# llvm-gcc on Ubuntu needs to be told where to look
+# for headers. If user has these in their environment
+# we should propagate to test environment
+addEnv('C_INCLUDE_PATH')
+addEnv('CPLUS_INCLUDE_PATH')
 
 # Check that the object root is known.
 if config.test_exec_root is None:
@@ -53,10 +64,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