about summary refs log tree commit diff homepage
diff options
context:
space:
mode:
authorDaniel Dunbar <daniel@zuster.org>2014-09-12 17:03:35 -0700
committerDaniel Dunbar <daniel@zuster.org>2014-09-12 17:39:18 -0700
commit9b715dfc40311247b08daf5fa8695a95fd66106f (patch)
treee45588fba94a530653d8b6bcddafc5cda3e2adef
parent9a3cf72b8979213bcc6d235856bb0ddba4ee37c8 (diff)
downloadklee-9b715dfc40311247b08daf5fa8695a95fd66106f.tar.gz
[tests] Set --output-dir on all test runs, in support of running tests in parallel.
 - It would be nice if there was an easier way to do this that didn't involve
   editing all of the tests (like running each test in its own directory), but
   this approach fixes #146 and doesn't involve changing 'lit' or writing a
   wrapper harness. My assumption is a lot of tests start are derived from
   another one, so hopefully following this convention won't be burdensome, and
   I updated 'make check' so that it will produce an error if any test runs klee
   without --output-dir (by checking for the existing of klee-last files).

 - This also helps with #147 but I still can't fully run tests in parallel (I
   start hitting STP errors).
-rw-r--r--test/CXX/ArrayNew.cpp3
-rw-r--r--test/CXX/New.cpp3
-rw-r--r--test/CXX/SimpleVirtual.cpp3
-rw-r--r--test/CXX/StaticConstructor.cpp3
-rw-r--r--test/CXX/StaticDestructor.cpp5
-rw-r--r--test/CXX/Trivial.cpp3
-rw-r--r--test/Coverage/ReadArgs.c6
-rw-r--r--test/Dogfood/ImmutableSet.cpp3
-rw-r--r--test/Feature/Alias.c3
-rw-r--r--test/Feature/AliasFunction.c3
-rw-r--r--test/Feature/AliasFunctionExit.c3
-rw-r--r--test/Feature/AsmAddresses.c7
-rw-r--r--test/Feature/BitcastAlias.ll3
-rw-r--r--test/Feature/ByteSwap.c3
-rw-r--r--test/Feature/CallToUndefinedExternal.cpp5
-rw-r--r--test/Feature/CheckForImpliedValue.c.failing3
-rw-r--r--test/Feature/CheckMemoryAccess.c3
-rw-r--r--test/Feature/ConstantStruct.ll3
-rw-r--r--test/Feature/CopyOnWrite.c3
-rw-r--r--test/Feature/DanglingConcreteReadExpr.c5
-rw-r--r--test/Feature/DefineFixedObject.c3
-rw-r--r--test/Feature/DoubleFree.c5
-rw-r--r--test/Feature/DumpStatesOnHalt.c5
-rw-r--r--test/Feature/Envp.c3
-rw-r--r--test/Feature/ExprLogging.c11
-rw-r--r--test/Feature/ExternalWeakLinkage.c3
-rw-r--r--test/Feature/Float.c3
-rw-r--r--test/Feature/FloatingPt.c3
-rw-r--r--test/Feature/FunctionPointer.c3
-rw-r--r--test/Feature/GetElementPtr.ll3
-rw-r--r--test/Feature/GetValue.c3
-rw-r--r--test/Feature/ImpliedValue.c.failing5
-rw-r--r--test/Feature/InAndOutOfBounds.c11
-rw-r--r--test/Feature/IndirectCallToBuiltin.c3
-rw-r--r--test/Feature/IndirectCallToExternal.c3
-rw-r--r--test/Feature/InsertExtractValue.ll3
-rw-r--r--test/Feature/IntrinsicTrap.ll5
-rw-r--r--test/Feature/InvalidBitfieldAccess.c.failing3
-rw-r--r--test/Feature/IsSymbolic.c3
-rw-r--r--test/Feature/KleeReportError.c9
-rw-r--r--test/Feature/LargeReturnTypes.cpp3
-rw-r--r--test/Feature/LongDouble.cpp3
-rw-r--r--test/Feature/LongDoubleSupport.c3
-rw-r--r--test/Feature/LowerSwitch.c11
-rw-r--r--test/Feature/MakeConcreteSymbolic.c11
-rw-r--r--test/Feature/MakeSymbolicName.c3
-rw-r--r--test/Feature/MemoryLimit.c6
-rw-r--r--test/Feature/MultipleFreeResolution.c13
-rw-r--r--test/Feature/MultipleReadResolution.c3
-rw-r--r--test/Feature/MultipleReallocResolution.c7
-rw-r--r--test/Feature/MultipleWriteResolution.c3
-rw-r--r--test/Feature/NamedSeedMatching.c12
-rw-r--r--test/Feature/OneFreeError.c7
-rw-r--r--test/Feature/OneOutOfBounds.c7
-rw-r--r--test/Feature/Optimize.c3
-rw-r--r--test/Feature/Overflow.ll3
-rw-r--r--test/Feature/OverflowMul.ll3
-rw-r--r--test/Feature/OverlappedError.c7
-rw-r--r--test/Feature/OvershiftCheck.c7
-rw-r--r--test/Feature/PreferCex.c5
-rw-r--r--test/Feature/RaiseAsm.c3
-rw-r--r--test/Feature/Realloc.c3
-rw-r--r--test/Feature/ReplayPath.c7
-rw-r--r--test/Feature/Searchers.c54
-rw-r--r--test/Feature/SetForking.c3
-rw-r--r--test/Feature/SolverTimeout.c3
-rw-r--r--test/Feature/Vararg.c5
-rw-r--r--test/Feature/WithLibc.c3
-rw-r--r--test/Feature/WriteCov.c19
-rw-r--r--test/Feature/arithmetic-right-overshift-sym-conc.c7
-rw-r--r--test/Feature/consecutive_divide_by_zero.c7
-rw-r--r--test/Feature/const_array_opt1.c3
-rw-r--r--test/Feature/left-overshift-sym-conc.c7
-rw-r--r--test/Feature/logical-right-overshift-sym-conc.c7
-rw-r--r--test/Makefile5
-rw-r--r--test/Programs/pcregrep.c3
-rw-r--r--test/Runtime/POSIX/DirConsistency.c6
-rw-r--r--test/Runtime/POSIX/DirSeek.c9
-rw-r--r--test/Runtime/POSIX/FDNumbers.c3
-rw-r--r--test/Runtime/POSIX/FD_Fail.c3
-rw-r--r--test/Runtime/POSIX/FD_Fail2.c17
-rw-r--r--test/Runtime/POSIX/Fcntl.c3
-rw-r--r--test/Runtime/POSIX/FilePerm.c9
-rw-r--r--test/Runtime/POSIX/FreeArgv.c9
-rw-r--r--test/Runtime/POSIX/Futimesat.c3
-rw-r--r--test/Runtime/POSIX/Getenv.c3
-rw-r--r--test/Runtime/POSIX/Ioctl.c3
-rw-r--r--test/Runtime/POSIX/Isatty.c11
-rw-r--r--test/Runtime/POSIX/Openat.c5
-rw-r--r--test/Runtime/POSIX/PrgName.c7
-rw-r--r--test/Runtime/POSIX/Read1.c3
-rw-r--r--test/Runtime/POSIX/SELinux/SELinux.c3
-rw-r--r--test/Runtime/POSIX/SeedAndFail.c9
-rw-r--r--test/Runtime/POSIX/Stdin.c3
-rw-r--r--test/Runtime/POSIX/Write1.c3
-rw-r--r--test/Runtime/POSIX/Write2.c3
-rw-r--r--test/Runtime/Uclibc/2007-10-08-optimization-calls-wrong-libc-functions.c3
-rw-r--r--test/Runtime/Uclibc/2008-03-04-libc-atexit-uses-dso-handle.c3
-rw-r--r--test/Runtime/Uclibc/Environ.c3
-rw-r--r--test/regression/2007-07-25-invalid-stp-array-binding-to-objectstate.c3
-rw-r--r--test/regression/2007-07-30-unflushed-byte.c3
-rw-r--r--test/regression/2007-08-01-bool-zext-in-call.ll12
-rw-r--r--test/regression/2007-08-01-cache-unclear-on-overwrite-flushed.c3
-rw-r--r--test/regression/2007-08-06-64bit-shift.c3
-rw-r--r--test/regression/2007-08-06-access-after-free.c3
-rw-r--r--test/regression/2007-08-08-free-zero.c5
-rw-r--r--test/regression/2007-08-16-invalid-constant-value.c3
-rw-r--r--test/regression/2007-08-16-valid-write-to-freed-object.c3
-rw-r--r--test/regression/2007-10-11-free-of-alloca.c7
-rw-r--r--test/regression/2007-10-11-illegal-access-after-free-and-branch.c7
-rw-r--r--test/regression/2007-10-12-failed-make-symbolic-after-copy.c5
-rw-r--r--test/regression/2008-03-04-free-of-global.c7
-rw-r--r--test/regression/2008-03-11-free-of-malloc-zero.c3
-rw-r--r--test/regression/2008-04-10-bad-alloca-free.c3
-rw-r--r--test/regression/2008-05-23-gep-with-global-const.c3
-rw-r--r--test/regression/2012-05-13-asm-causes-aborts.c3
-rw-r--r--test/regression/2014-07-04-unflushed-error-report.c7
117 files changed, 386 insertions, 243 deletions
diff --git a/test/CXX/ArrayNew.cpp b/test/CXX/ArrayNew.cpp
index b564316d..6a54083a 100644
--- a/test/CXX/ArrayNew.cpp
+++ b/test/CXX/ArrayNew.cpp
@@ -1,5 +1,6 @@
 // RUN: %llvmgxx %s -emit-llvm -O0 -c -o %t1.bc
-// RUN: %klee --no-output --exit-on-error --no-externals %t1.bc
+// RUN: rm -rf %t.klee-out
+// RUN: %klee --output-dir=%t.klee-out --no-output --exit-on-error --no-externals %t1.bc
 
 #include <cassert>
 
diff --git a/test/CXX/New.cpp b/test/CXX/New.cpp
index f7ecf3be..5b90c7a4 100644
--- a/test/CXX/New.cpp
+++ b/test/CXX/New.cpp
@@ -1,5 +1,6 @@
 // RUN: %llvmgxx %s -emit-llvm -O0 -c -o %t1.bc
-// RUN: %klee --no-output --exit-on-error --no-externals %t1.bc
+// RUN: rm -rf %t.klee-out
+// RUN: %klee --output-dir=%t.klee-out --no-output --exit-on-error --no-externals %t1.bc
 
 #include <cassert>
 
diff --git a/test/CXX/SimpleVirtual.cpp b/test/CXX/SimpleVirtual.cpp
index 108722c6..b2db980d 100644
--- a/test/CXX/SimpleVirtual.cpp
+++ b/test/CXX/SimpleVirtual.cpp
@@ -1,5 +1,6 @@
 // RUN: %llvmgxx %s -emit-llvm -O0 -c -o %t1.bc
-// RUN: %klee --no-output --exit-on-error --no-externals %t1.bc
+// RUN: rm -rf %t.klee-out
+// RUN: %klee --output-dir=%t.klee-out --no-output --exit-on-error --no-externals %t1.bc
 
 #include <cassert>
 
diff --git a/test/CXX/StaticConstructor.cpp b/test/CXX/StaticConstructor.cpp
index 4974d59b..56fcb97b 100644
--- a/test/CXX/StaticConstructor.cpp
+++ b/test/CXX/StaticConstructor.cpp
@@ -1,5 +1,6 @@
 // RUN: %llvmgxx %s -emit-llvm -O0 -c -o %t1.bc
-// RUN: %klee --libc=klee --no-output --exit-on-error %t1.bc
+// RUN: rm -rf %t.klee-out
+// RUN: %klee --output-dir=%t.klee-out --libc=klee --no-output --exit-on-error %t1.bc
 
 #include <cassert>
 
diff --git a/test/CXX/StaticDestructor.cpp b/test/CXX/StaticDestructor.cpp
index 60390c2d..6e6f033d 100644
--- a/test/CXX/StaticDestructor.cpp
+++ b/test/CXX/StaticDestructor.cpp
@@ -1,8 +1,9 @@
 // don't optimize this, llvm likes to turn the *p into unreachable
 
 // RUN: %llvmgxx %s -emit-llvm -g -O0 -c -o %t1.bc
-// RUN: %klee --optimize=false --libc=uclibc --no-output %t1.bc 2> %t1.log
-// RUN: grep ":16: memory error" %t1.log
+// RUN: rm -rf %t.klee-out
+// RUN: %klee --output-dir=%t.klee-out --optimize=false --libc=uclibc --no-output %t1.bc 2> %t1.log
+// RUN: grep ":17: memory error" %t1.log
 
 #include <cassert>
 
diff --git a/test/CXX/Trivial.cpp b/test/CXX/Trivial.cpp
index 6c05459d..2b8ceed3 100644
--- a/test/CXX/Trivial.cpp
+++ b/test/CXX/Trivial.cpp
@@ -1,5 +1,6 @@
 // RUN: %llvmgxx %s -emit-llvm -O0 -c -o %t1.bc
-// RUN: %klee --no-output --exit-on-error %t1.bc
+// RUN: rm -rf %t.klee-out
+// RUN: %klee --output-dir=%t.klee-out --no-output --exit-on-error %t1.bc
 
 #include <cassert>
 
diff --git a/test/Coverage/ReadArgs.c b/test/Coverage/ReadArgs.c
index ddfb1747..1001dac1 100644
--- a/test/Coverage/ReadArgs.c
+++ b/test/Coverage/ReadArgs.c
@@ -1,8 +1,8 @@
 // RUN: %llvmgcc %s -emit-llvm -O0 -c -o %t1.bc
-// RUN: rm -rf %T/xxx
-// RUN: echo " --output-dir=%T/xxx " > %t1.args
+// RUN: rm -rf %t.klee-out
+// RUN: echo " --output-dir=%t.klee-out " > %t1.args
 // RUN: %klee --read-args %t1.args %t1.bc
-// RUN: test -d %T/xxx
+// RUN: test -d %t.klee-out
 
 int main() {
   return 0;
diff --git a/test/Dogfood/ImmutableSet.cpp b/test/Dogfood/ImmutableSet.cpp
index 95320a82..e4264b9b 100644
--- a/test/Dogfood/ImmutableSet.cpp
+++ b/test/Dogfood/ImmutableSet.cpp
@@ -1,5 +1,6 @@
 // RUN: %llvmgxx -I../../../include -g -DMAX_ELEMENTS=4 -fno-exceptions -emit-llvm -c -o %t1.bc %s
-// RUN: %klee --libc=klee --max-forks=200 --no-output --exit-on-error --optimize --disable-inlining --search=nurs:depth --use-cex-cache %t1.bc
+// RUN: rm -rf %t.klee-out
+// RUN: %klee --output-dir=%t.klee-out --libc=klee --max-forks=200 --no-output --exit-on-error --optimize --disable-inlining --search=nurs:depth --use-cex-cache %t1.bc
 
 #include "klee/klee.h"
 #include "klee/Internal/ADT/ImmutableSet.h"
diff --git a/test/Feature/Alias.c b/test/Feature/Alias.c
index 9300e2c7..381bcc2a 100644
--- a/test/Feature/Alias.c
+++ b/test/Feature/Alias.c
@@ -1,5 +1,6 @@
 // RUN: %llvmgcc %s -emit-llvm -g -c -o %t1.bc
-// RUN: %klee --exit-on-error %t1.bc
+// RUN: rm -rf %t.klee-out
+// RUN: %klee --output-dir=%t.klee-out --exit-on-error %t1.bc
 
 // Darwin does not have strong aliases.
 // XFAIL: darwin
diff --git a/test/Feature/AliasFunction.c b/test/Feature/AliasFunction.c
index 176b152e..019ebe67 100644
--- a/test/Feature/AliasFunction.c
+++ b/test/Feature/AliasFunction.c
@@ -1,5 +1,6 @@
 // RUN: %llvmgcc %s -emit-llvm -O0 -c -o %t1.bc
-// RUN: %klee %t1.bc > %t1.log
+// RUN: rm -rf %t.klee-out
+// RUN: %klee --output-dir=%t.klee-out %t1.bc > %t1.log
 // RUN: grep -c foo %t1.log | grep 5
 // RUN: grep -c bar %t1.log | grep 4
 
diff --git a/test/Feature/AliasFunctionExit.c b/test/Feature/AliasFunctionExit.c
index acfa4350..09ca8f46 100644
--- a/test/Feature/AliasFunctionExit.c
+++ b/test/Feature/AliasFunctionExit.c
@@ -1,5 +1,6 @@
 // RUN: %llvmgcc %s -emit-llvm -O0 -c -o %t1.bc
-// RUN: %klee %t1.bc > %t1.log
+// RUN: rm -rf %t.klee-out
+// RUN: %klee --output-dir=%t.klee-out %t1.bc > %t1.log
 // RUN: grep -c START %t1.log | grep 1
 // RUN: grep -c END %t1.log | grep 2
 
diff --git a/test/Feature/AsmAddresses.c b/test/Feature/AsmAddresses.c
index d0b89ef1..cfe566af 100644
--- a/test/Feature/AsmAddresses.c
+++ b/test/Feature/AsmAddresses.c
@@ -1,7 +1,10 @@
 // RUN: %llvmgcc -emit-llvm -g -c -o %t.bc %s
-// RUN: %klee --exit-on-error --use-asm-addresses %t.bc
+// RUN: rm -rf %t.klee-out
+// RUN: %klee --output-dir=%t.klee-out --exit-on-error --use-asm-addresses %t.bc
+
 // RUN: %llvmgcc -emit-llvm -DOVERLAP -g -c -o %t.bc %s
-// RUN: not %klee --exit-on-error --use-asm-addresses %t.bc
+// RUN: rm -rf %t.klee-out
+// RUN: not %klee --output-dir=%t.klee-out --exit-on-error --use-asm-addresses %t.bc
 
 #include <assert.h>
 
diff --git a/test/Feature/BitcastAlias.ll b/test/Feature/BitcastAlias.ll
index 711ed7ad..e0e3653f 100644
--- a/test/Feature/BitcastAlias.ll
+++ b/test/Feature/BitcastAlias.ll
@@ -1,5 +1,6 @@
 ; RUN: llvm-as %s -f -o %t1.bc
-; RUN: %klee -disable-opt %t1.bc > %t2
+; RUN: rm -rf %t.klee-out
+; RUN: %klee --output-dir=%t.klee-out -disable-opt %t1.bc > %t2
 ; RUN: grep PASS %t2
 
 target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128-n8:16:32:64"
diff --git a/test/Feature/ByteSwap.c b/test/Feature/ByteSwap.c
index f85ac3b1..b6500a13 100644
--- a/test/Feature/ByteSwap.c
+++ b/test/Feature/ByteSwap.c
@@ -1,5 +1,6 @@
 // RUN: %llvmgcc %s -emit-llvm -O0 -c -o %t1.bc
-// RUN: %klee --libc=klee --exit-on-error %t1.bc
+// RUN: rm -rf %t.klee-out
+// RUN: %klee --output-dir=%t.klee-out --libc=klee --exit-on-error %t1.bc
 
 #include <arpa/inet.h>
 #include <assert.h>
diff --git a/test/Feature/CallToUndefinedExternal.cpp b/test/Feature/CallToUndefinedExternal.cpp
index 26e8fc55..b300d4e4 100644
--- a/test/Feature/CallToUndefinedExternal.cpp
+++ b/test/Feature/CallToUndefinedExternal.cpp
@@ -1,6 +1,7 @@
 // RUN: %llvmgxx %s -emit-llvm -g -c -o %t1.bc
-// RUN: %klee %t1.bc 2>&1 | FileCheck %s
-// RUN: test -f %T/klee-last/test000001.external.err
+// RUN: rm -rf %t.klee-out
+// RUN: %klee --output-dir=%t.klee-out %t1.bc 2>&1 | FileCheck %s
+// RUN: test -f %t.klee-out/test000001.external.err
 
 extern "C" void poof(void);
 
diff --git a/test/Feature/CheckForImpliedValue.c.failing b/test/Feature/CheckForImpliedValue.c.failing
index 7a088354..bb643647 100644
--- a/test/Feature/CheckForImpliedValue.c.failing
+++ b/test/Feature/CheckForImpliedValue.c.failing
@@ -1,6 +1,7 @@
 // RUN: %llvmgcc %s -emit-llvm -O0 -c -o %t1.bc
 // RUN: rm -f %t1.log
-// RUN: %klee --log-file %t1.log --debug-check-for-implied-values %t1.bc
+// RUN: rm -rf %t.klee-out
+// RUN: %klee --output-dir=%t.klee-out --log-file %t1.log --debug-check-for-implied-values %t1.bc
 // RUN: grep "= 0 (ok)" %t1.log
 // RUN: grep "= 2 (missed)" %t1.log
 
diff --git a/test/Feature/CheckMemoryAccess.c b/test/Feature/CheckMemoryAccess.c
index 30590f88..5347ac3d 100644
--- a/test/Feature/CheckMemoryAccess.c
+++ b/test/Feature/CheckMemoryAccess.c
@@ -1,5 +1,6 @@
 // RUN: %llvmgcc -emit-llvm -g -c %s -o %t.bc
-// RUN: %klee %t.bc > %t.log
+// RUN: rm -rf %t.klee-out
+// RUN: %klee --output-dir=%t.klee-out %t.bc > %t.log
 // RUN: grep -q "good" %t.log
 // RUN: not grep -q "bad" %t.log
 
diff --git a/test/Feature/ConstantStruct.ll b/test/Feature/ConstantStruct.ll
index cfd7104e..4fe6b5d0 100644
--- a/test/Feature/ConstantStruct.ll
+++ b/test/Feature/ConstantStruct.ll
@@ -1,5 +1,6 @@
 ; RUN: llvm-as %s -f -o %t1.bc
-; RUN: %klee -disable-opt %t1.bc > %t2
+; RUN: rm -rf %t.klee-out
+; RUN: %klee --output-dir=%t.klee-out -disable-opt %t1.bc > %t2
 ; RUN: grep PASS %t2
 
 target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128-n8:16:32:64"
diff --git a/test/Feature/CopyOnWrite.c b/test/Feature/CopyOnWrite.c
index ce77c802..926e0a48 100644
--- a/test/Feature/CopyOnWrite.c
+++ b/test/Feature/CopyOnWrite.c
@@ -1,5 +1,6 @@
 // RUN: %llvmgcc %s -emit-llvm -g -c -o %t1.bc
-// RUN: %klee --search=random-state --exit-on-error %t1.bc
+// RUN: rm -rf %t.klee-out
+// RUN: %klee --output-dir=%t.klee-out --search=random-state --exit-on-error %t1.bc
 
 #include <assert.h>
 
diff --git a/test/Feature/DanglingConcreteReadExpr.c b/test/Feature/DanglingConcreteReadExpr.c
index 204187a2..8e15b07d 100644
--- a/test/Feature/DanglingConcreteReadExpr.c
+++ b/test/Feature/DanglingConcreteReadExpr.c
@@ -1,6 +1,7 @@
 // RUN: %llvmgcc %s -emit-llvm -O0 -c -o %t1.bc
-// RUN: %klee %t1.bc
-// RUN: grep "total queries = 2" %T/klee-last/info
+// RUN: rm -rf %t.klee-out
+// RUN: %klee --output-dir=%t.klee-out %t1.bc
+// RUN: grep "total queries = 2" %t.klee-out/info
 
 #include <assert.h>
 
diff --git a/test/Feature/DefineFixedObject.c b/test/Feature/DefineFixedObject.c
index 9f71f89b..2e601553 100644
--- a/test/Feature/DefineFixedObject.c
+++ b/test/Feature/DefineFixedObject.c
@@ -1,5 +1,6 @@
 // RUN: %llvmgcc -emit-llvm -c -o %t1.bc %s
-// RUN: %klee --exit-on-error %t1.bc
+// RUN: rm -rf %t.klee-out
+// RUN: %klee --output-dir=%t.klee-out --exit-on-error %t1.bc
 
 #include <stdio.h>
 
diff --git a/test/Feature/DoubleFree.c b/test/Feature/DoubleFree.c
index d97e0c08..b24de17d 100644
--- a/test/Feature/DoubleFree.c
+++ b/test/Feature/DoubleFree.c
@@ -1,6 +1,7 @@
 // RUN: %llvmgcc %s -emit-llvm -O0 -c -o %t1.bc
-// RUN: %klee %t1.bc 2>&1 | FileCheck %s
-// RUN: test -f %T/klee-last/test000001.ptr.err
+// RUN: rm -rf %t.klee-out
+// RUN: %klee --output-dir=%t.klee-out %t1.bc 2>&1 | FileCheck %s
+// RUN: test -f %t.klee-out/test000001.ptr.err
 
 int main() {
   int *x = malloc(4);
diff --git a/test/Feature/DumpStatesOnHalt.c b/test/Feature/DumpStatesOnHalt.c
index 993fdb6a..bc302456 100644
--- a/test/Feature/DumpStatesOnHalt.c
+++ b/test/Feature/DumpStatesOnHalt.c
@@ -1,6 +1,7 @@
 // RUN: %llvmgcc %s -g -emit-llvm -O0 -c -o %t1.bc
-// RUN: %klee --stop-after-n-instructions=1 --dump-states-on-halt=true %t1.bc 2>&1 | FileCheck %s
-// RUN: test -f %T/klee-last/test000001.ktest
+// RUN: rm -rf %t.klee-out
+// RUN: %klee --output-dir=%t.klee-out --stop-after-n-instructions=1 --dump-states-on-halt=true %t1.bc 2>&1 | FileCheck %s
+// RUN: test -f %t.klee-out/test000001.ktest
 
 int main(int argc, char** argv) {
   int x = 1;
diff --git a/test/Feature/Envp.c b/test/Feature/Envp.c
index f1f62a72..ff4e2098 100644
--- a/test/Feature/Envp.c
+++ b/test/Feature/Envp.c
@@ -1,5 +1,6 @@
 // RUN: %llvmgcc %s -emit-llvm -g -c -o %t1.bc
-// RUN: %klee --exit-on-error %t1.bc
+// RUN: rm -rf %t.klee-out
+// RUN: %klee --output-dir=%t.klee-out --exit-on-error %t1.bc
 
 #include <assert.h>
 
diff --git a/test/Feature/ExprLogging.c b/test/Feature/ExprLogging.c
index abab8031..bba0570e 100644
--- a/test/Feature/ExprLogging.c
+++ b/test/Feature/ExprLogging.c
@@ -1,14 +1,15 @@
 // RUN: %llvmgcc %s -emit-llvm -g -O0 -c -o %t1.bc
 // We disable the cex-cache to eliminate nondeterminism across different solvers, in particular when counting the number of queries in the last two commands
-// RUN: %klee --use-cex-cache=false --use-query-log=all:pc,all:smt2,solver:pc,solver:smt2 --write-pcs --write-cvcs --write-smt2s %t1.bc 2> %t2.log
-// RUN: %kleaver -print-ast %T/klee-last/all-queries.pc > %t3.log
+// RUN: rm -rf %t.klee-out
+// RUN: %klee --output-dir=%t.klee-out --use-cex-cache=false --use-query-log=all:pc,all:smt2,solver:pc,solver:smt2 --write-pcs --write-cvcs --write-smt2s %t1.bc 2> %t2.log
+// RUN: %kleaver -print-ast %t.klee-out/all-queries.pc > %t3.log
 // RUN: %kleaver -print-ast %t3.log > %t4.log
 // RUN: diff %t3.log %t4.log
-// RUN: %kleaver -print-ast %T/klee-last/solver-queries.pc > %t3.log
+// RUN: %kleaver -print-ast %t.klee-out/solver-queries.pc > %t3.log
 // RUN: %kleaver -print-ast %t3.log > %t4.log
 // RUN: diff %t3.log %t4.log
-// RUN: grep "^; Query" %T/klee-last/all-queries.smt2 | wc -l | grep -q 17
-// RUN: grep "^; Query" %T/klee-last/solver-queries.smt2 | wc -l | grep -q 17
+// RUN: grep "^; Query" %t.klee-out/all-queries.smt2 | wc -l | grep -q 17
+// RUN: grep "^; Query" %t.klee-out/solver-queries.smt2 | wc -l | grep -q 17
 
 #include <assert.h>
 
diff --git a/test/Feature/ExternalWeakLinkage.c b/test/Feature/ExternalWeakLinkage.c
index c2008136..fd70884a 100644
--- a/test/Feature/ExternalWeakLinkage.c
+++ b/test/Feature/ExternalWeakLinkage.c
@@ -1,5 +1,6 @@
 // RUN: %llvmgcc %s -emit-llvm -g -c -o %t1.bc
-// RUN: %klee --exit-on-error %t1.bc
+// RUN: rm -rf %t.klee-out
+// RUN: %klee --output-dir=%t.klee-out --exit-on-error %t1.bc
 
 #include <assert.h>
 
diff --git a/test/Feature/Float.c b/test/Feature/Float.c
index f7e4dde0..dce082c6 100644
--- a/test/Feature/Float.c
+++ b/test/Feature/Float.c
@@ -1,5 +1,6 @@
 // RUN: %llvmgcc -emit-llvm -g -c %s -o %t.bc
-// RUN: %klee %t.bc > %t.log
+// RUN: rm -rf %t.klee-out
+// RUN: %klee --output-dir=%t.klee-out %t.bc > %t.log
 // RUN: grep "3.30* -1.10* 2.420*" %t.log
 
 #include <stdio.h>
diff --git a/test/Feature/FloatingPt.c b/test/Feature/FloatingPt.c
index bde9e19b..be087935 100644
--- a/test/Feature/FloatingPt.c
+++ b/test/Feature/FloatingPt.c
@@ -1,5 +1,6 @@
 // RUN: %llvmgcc %s -emit-llvm -O0 -c -o %t1.bc
-// RUN: %klee --exit-on-error %t1.bc
+// RUN: rm -rf %t.klee-out
+// RUN: %klee --output-dir=%t.klee-out --exit-on-error %t1.bc
 
 #include <assert.h>
 
diff --git a/test/Feature/FunctionPointer.c b/test/Feature/FunctionPointer.c
index e1ae1e37..ac28ca00 100644
--- a/test/Feature/FunctionPointer.c
+++ b/test/Feature/FunctionPointer.c
@@ -1,5 +1,6 @@
 // RUN: %llvmgcc %s -emit-llvm -g -c -o %t1.bc
-// RUN: %klee --no-output --exit-on-error %t1.bc
+// RUN: rm -rf %t.klee-out
+// RUN: %klee --output-dir=%t.klee-out --no-output --exit-on-error %t1.bc
 
 #include <stdio.h>
 
diff --git a/test/Feature/GetElementPtr.ll b/test/Feature/GetElementPtr.ll
index 7f10c0a2..da94441c 100644
--- a/test/Feature/GetElementPtr.ll
+++ b/test/Feature/GetElementPtr.ll
@@ -1,5 +1,6 @@
 ; RUN: llvm-as %s -f -o %t1.bc
-; RUN: %klee -disable-opt %t1.bc > %t2
+; RUN: rm -rf %t.klee-out
+; RUN: %klee --output-dir=%t.klee-out -disable-opt %t1.bc > %t2
 ; RUN: grep PASS %t2
 
 target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128-n8:16:32:64"
diff --git a/test/Feature/GetValue.c b/test/Feature/GetValue.c
index 5023c51c..828c8934 100644
--- a/test/Feature/GetValue.c
+++ b/test/Feature/GetValue.c
@@ -1,5 +1,6 @@
 // RUN: %llvmgcc -emit-llvm -c -o %t1.bc %s
-// RUN: %klee --exit-on-error %t1.bc
+// RUN: rm -rf %t.klee-out
+// RUN: %klee --output-dir=%t.klee-out --exit-on-error %t1.bc
 
 #include <stdio.h>
 #include <assert.h>
diff --git a/test/Feature/ImpliedValue.c.failing b/test/Feature/ImpliedValue.c.failing
index 2f169970..469c8f28 100644
--- a/test/Feature/ImpliedValue.c.failing
+++ b/test/Feature/ImpliedValue.c.failing
@@ -2,8 +2,9 @@
 // RUN: %llvmgcc %s -emit-llvm -O2 -c -o %t1.bc
 // RUN: llvm-as -f ../_utils._ll -o %t2.bc
 // RUN: llvm-ld -disable-opt -link-as-library %t1.bc %t2.bc -o %t3.bc
-// RUN: %klee --log-file %t4.log --debug-check-for-implied-values %t3.bc > %t4.out 2> %t4.err
-// RUN: ls klee-last | not grep .err
+// RUN: rm -rf %t.klee-out
+// RUN: %klee --output-dir=%t.klee-out --log-file %t4.log --debug-check-for-implied-values %t3.bc > %t4.out 2> %t4.err
+// RUN: ls %t.klee-out | not grep .err
 // RUN: not grep "(missed)" %t4.log
 
 #include <assert.h>
diff --git a/test/Feature/InAndOutOfBounds.c b/test/Feature/InAndOutOfBounds.c
index 729d6b78..5a3dfa44 100644
--- a/test/Feature/InAndOutOfBounds.c
+++ b/test/Feature/InAndOutOfBounds.c
@@ -1,8 +1,9 @@
 // RUN: %llvmgcc %s -g -emit-llvm -O0 -c -o %t1.bc
-// RUN: %klee %t1.bc 2>&1 | FileCheck %s
-// RUN: test -f %T/klee-last/test000001.ptr.err -o -f %T/klee-last/test000002.ptr.err
-// RUN: not test -f %T/klee-last/test000001.ptr.err -a -f %T/klee-last/test000002.ptr.err
-// RUN: not test -f %T/klee-last/test000003.ktest
+// RUN: rm -rf %t.klee-out
+// RUN: %klee --output-dir=%t.klee-out %t1.bc 2>&1 | FileCheck %s
+// RUN: test -f %t.klee-out/test000001.ptr.err -o -f %t.klee-out/test000002.ptr.err
+// RUN: not test -f %t.klee-out/test000001.ptr.err -a -f %t.klee-out/test000002.ptr.err
+// RUN: not test -f %t.klee-out/test000003.ktest
 
 unsigned klee_urange(unsigned start, unsigned end) {
   unsigned x;
@@ -14,7 +15,7 @@ unsigned klee_urange(unsigned start, unsigned end) {
 int main() {
   int *x = malloc(sizeof(int));
   // FIXME: Use newer FileCheck syntax to support relative line numbers
-  // CHECK: InAndOutOfBounds.c:18: memory error: out of bound pointer
+  // CHECK: InAndOutOfBounds.c:19: memory error: out of bound pointer
   x[klee_urange(0,2)] = 1;
   free(x);
   return 0;
diff --git a/test/Feature/IndirectCallToBuiltin.c b/test/Feature/IndirectCallToBuiltin.c
index 591a5601..8c78dba5 100644
--- a/test/Feature/IndirectCallToBuiltin.c
+++ b/test/Feature/IndirectCallToBuiltin.c
@@ -1,5 +1,6 @@
 // RUN: %llvmgcc %s -emit-llvm -g -c -o %t1.bc
-// RUN: %klee %t1.bc
+// RUN: rm -rf %t.klee-out
+// RUN: %klee --output-dir=%t.klee-out %t1.bc
 
 #include <stdlib.h>
 #include <stdio.h>
diff --git a/test/Feature/IndirectCallToExternal.c b/test/Feature/IndirectCallToExternal.c
index 4603213b..58eb2575 100644
--- a/test/Feature/IndirectCallToExternal.c
+++ b/test/Feature/IndirectCallToExternal.c
@@ -1,5 +1,6 @@
 // RUN: %llvmgcc %s -emit-llvm -g -c -o %t1.bc
-// RUN: %klee %t1.bc
+// RUN: rm -rf %t.klee-out
+// RUN: %klee --output-dir=%t.klee-out %t1.bc
 
 #include <stdlib.h>
 #include <stdio.h>
diff --git a/test/Feature/InsertExtractValue.ll b/test/Feature/InsertExtractValue.ll
index fbce335b..83e8f851 100644
--- a/test/Feature/InsertExtractValue.ll
+++ b/test/Feature/InsertExtractValue.ll
@@ -1,5 +1,6 @@
 ; RUN: llvm-as %s -f -o %t1.bc
-; RUN: %klee -disable-opt %t1.bc > %t2
+; RUN: rm -rf %t.klee-out
+; RUN: %klee --output-dir=%t.klee-out -disable-opt %t1.bc > %t2
 ; RUN: grep PASS %t2
 
 target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128-n8:16:32:64"
diff --git a/test/Feature/IntrinsicTrap.ll b/test/Feature/IntrinsicTrap.ll
index 13b93e4d..9caf4a62 100644
--- a/test/Feature/IntrinsicTrap.ll
+++ b/test/Feature/IntrinsicTrap.ll
@@ -1,6 +1,7 @@
 ; RUN: llvm-as %s -f -o %t1.bc
-; RUN: %klee -disable-opt %t1.bc
-; RUN: FileCheck %s --input-file=%T/klee-last/assembly.ll
+; RUN: rm -rf %t.klee-out
+; RUN: %klee --output-dir=%t.klee-out -disable-opt %t1.bc
+; RUN: FileCheck %s --input-file=%t.klee-out/assembly.ll
 
 target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128-f128:128:128-n8:16:32:64"
 target triple = "x86_64-unknown-linux-gnu"
diff --git a/test/Feature/InvalidBitfieldAccess.c.failing b/test/Feature/InvalidBitfieldAccess.c.failing
index ae8bfe5e..0e4ec594 100644
--- a/test/Feature/InvalidBitfieldAccess.c.failing
+++ b/test/Feature/InvalidBitfieldAccess.c.failing
@@ -1,5 +1,6 @@
 // RUN: %llvmgcc -c -o %t1.bc %s
-// RUN: %klee --exit-on-error %t1.bc
+// RUN: rm -rf %t.klee-out
+// RUN: %klee --output-dir=%t.klee-out --exit-on-error %t1.bc
 
 // This is a bug in llvm-gcc4.0 but seems to be fixed in llvm-gcc4.2,
 // its included here mostly as a reminder. 
diff --git a/test/Feature/IsSymbolic.c b/test/Feature/IsSymbolic.c
index 4a86368a..cd7f3dba 100644
--- a/test/Feature/IsSymbolic.c
+++ b/test/Feature/IsSymbolic.c
@@ -1,5 +1,6 @@
 // RUN: %llvmgcc %s -emit-llvm -O0 -c -o %t1.bc
-// RUN: %klee %t1.bc
+// RUN: rm -rf %t.klee-out
+// RUN: %klee --output-dir=%t.klee-out %t1.bc
 
 #include <assert.h>
 
diff --git a/test/Feature/KleeReportError.c b/test/Feature/KleeReportError.c
index 37c07ed1..50aaf97d 100644
--- a/test/Feature/KleeReportError.c
+++ b/test/Feature/KleeReportError.c
@@ -1,6 +1,7 @@
 // RUN: %llvmgcc %s -g -emit-llvm -O0 -c -o %t2.bc
-// RUN: %klee --emit-all-errors %t2.bc 2>&1 | FileCheck %s
-// RUN: ls %T/klee-last/ | grep .my.err | wc -l | grep 2
+// RUN: rm -rf %t.klee-out
+// RUN: %klee --output-dir=%t.klee-out --emit-all-errors %t2.bc 2>&1 | FileCheck %s
+// RUN: ls %t.klee-out/ | grep .my.err | wc -l | grep 2
 #include <stdio.h>
 #include <assert.h>
 
@@ -16,8 +17,8 @@ int main(int argc, char** argv) {
 
   if (y) {
     fprintf(stderr, "My error\n");
-    // CHECK: KleeReportError.c:22: My error
-    // CHECK: KleeReportError.c:22: My error
+    // CHECK: KleeReportError.c:23: My error
+    // CHECK: KleeReportError.c:23: My error
     // FIXME: Use FileCheck's relative line number syntax
     klee_report_error(__FILE__, __LINE__, "My error", "my.err");
   }
diff --git a/test/Feature/LargeReturnTypes.cpp b/test/Feature/LargeReturnTypes.cpp
index 274da05e..937b0758 100644
--- a/test/Feature/LargeReturnTypes.cpp
+++ b/test/Feature/LargeReturnTypes.cpp
@@ -1,5 +1,6 @@
 // RUN: %llvmgxx -g -fno-exceptions -emit-llvm -O0 -c -o %t.bc %s
-// RUN: %klee --libc=klee --no-output --exit-on-error %t.bc > %t.log
+// RUN: rm -rf %t.klee-out
+// RUN: %klee --output-dir=%t.klee-out --libc=klee --no-output --exit-on-error %t.bc > %t.log
 
 /* Tests the ability to call external functions which return large values
  * (i.e. structs).  In this test case, fstream::ftellg() returns a
diff --git a/test/Feature/LongDouble.cpp b/test/Feature/LongDouble.cpp
index 6e6baf6a..08924293 100644
--- a/test/Feature/LongDouble.cpp
+++ b/test/Feature/LongDouble.cpp
@@ -1,5 +1,6 @@
 // RUN: %llvmgxx -I../../../include -g -fno-exceptions -emit-llvm -O0 -c -o %t.bc %s
-// RUN: %klee --libc=klee --no-output --exit-on-error %t.bc > %t.log
+// RUN: rm -rf %t.klee-out
+// RUN: %klee --output-dir=%t.klee-out --libc=klee --no-output --exit-on-error %t.bc > %t.log
 // RUN: grep -q powl\(-11\\.0,0\)=1\\.0\\+ %t.log
 // RUN: grep -q powl\(-11\\.0,1\)=-11\\.0\\+ %t.log
 // RUN: grep -q powl\(-11\\.0,2\)=121\\.0\\+ %t.log
diff --git a/test/Feature/LongDoubleSupport.c b/test/Feature/LongDoubleSupport.c
index 185a5485..4ea9daee 100644
--- a/test/Feature/LongDoubleSupport.c
+++ b/test/Feature/LongDoubleSupport.c
@@ -1,5 +1,6 @@
 // RUN: %llvmgcc %s -emit-llvm -O0 -c -o %t1.bc
-// RUN: %klee --optimize=0 --exit-on-error %t1.bc > %t2.out
+// RUN: rm -rf %t.klee-out
+// RUN: %klee --output-dir=%t.klee-out --optimize=0 --exit-on-error %t1.bc > %t2.out
 
 #include <stdio.h>
 #include <float.h>
diff --git a/test/Feature/LowerSwitch.c b/test/Feature/LowerSwitch.c
index 49cad076..1b280e72 100644
--- a/test/Feature/LowerSwitch.c
+++ b/test/Feature/LowerSwitch.c
@@ -1,8 +1,11 @@
 // RUN: %llvmgcc %s -emit-llvm -g -c -o %t.bc
-// RUN: %klee --exit-on-error --allow-external-sym-calls --switch-type=internal %t.bc
-// RUN: not test -f %T/klee-last/test000010.ktest
-// RUN: %klee --exit-on-error --allow-external-sym-calls --switch-type=simple %t.bc
-// RUN: test -f %T/klee-last/test000010.ktest
+// RUN: rm -rf %t.klee-out
+// RUN: %klee --output-dir=%t.klee-out --exit-on-error --allow-external-sym-calls --switch-type=internal %t.bc
+// RUN: not test -f %t.klee-out/test000010.ktest
+
+// RUN: rm -rf %t.klee-out
+// RUN: %klee --output-dir=%t.klee-out --exit-on-error --allow-external-sym-calls --switch-type=simple %t.bc
+// RUN: test -f %t.klee-out/test000010.ktest
 
 #include <stdio.h>
 
diff --git a/test/Feature/MakeConcreteSymbolic.c b/test/Feature/MakeConcreteSymbolic.c
index bfbb807d..dad618b3 100644
--- a/test/Feature/MakeConcreteSymbolic.c
+++ b/test/Feature/MakeConcreteSymbolic.c
@@ -1,8 +1,11 @@
 // RUN: %llvmgcc %s -emit-llvm -g -c -o %t1.bc
-// RUN: %klee --exit-on-error %t1.bc
-// RUN: grep "done: total queries = 0" %T/klee-last/info
-// RUN: %klee --make-concrete-symbolic=1 --exit-on-error %t1.bc
-// RUN: grep "done: total queries = 2" %T/klee-last/info
+// RUN: rm -rf %t.klee-out
+// RUN: %klee --output-dir=%t.klee-out --exit-on-error %t1.bc
+// RUN: grep "done: total queries = 0" %t.klee-out/info
+
+// RUN: rm -rf %t.klee-out
+// RUN: %klee --output-dir=%t.klee-out --make-concrete-symbolic=1 --exit-on-error %t1.bc
+// RUN: grep "done: total queries = 2" %t.klee-out/info
 
 
 #include <assert.h>
diff --git a/test/Feature/MakeSymbolicName.c b/test/Feature/MakeSymbolicName.c
index a31b4a9b..fef731ab 100644
--- a/test/Feature/MakeSymbolicName.c
+++ b/test/Feature/MakeSymbolicName.c
@@ -1,5 +1,6 @@
 // RUN: %llvmgcc %s -emit-llvm -g -c -o %t1.bc
-// RUN: %klee --search=random-state --exit-on-error %t1.bc
+// RUN: rm -rf %t.klee-out
+// RUN: %klee --output-dir=%t.klee-out --search=random-state --exit-on-error %t1.bc
 
 #include <assert.h>
 
diff --git a/test/Feature/MemoryLimit.c b/test/Feature/MemoryLimit.c
index a3c1250e..8837e2e5 100644
--- a/test/Feature/MemoryLimit.c
+++ b/test/Feature/MemoryLimit.c
@@ -1,7 +1,9 @@
 // RUN: %llvmgcc -emit-llvm -DLITTLE_ALLOC -g -c %s -o %t.little.bc
 // RUN: %llvmgcc -emit-llvm -g -c %s -o %t.big.bc
-// RUN: %klee --max-memory=20 %t.little.bc > %t.little.log
-// RUN: %klee --max-memory=20 %t.big.bc > %t.big.log
+// RUN: rm -rf %t.klee-out
+// RUN: %klee --output-dir=%t.klee-out --max-memory=20 %t.little.bc > %t.little.log
+// RUN: rm -rf %t.klee-out
+// RUN: %klee --output-dir=%t.klee-out --max-memory=20 %t.big.bc > %t.big.log
 // RUN: not grep -q "MALLOC FAILED" %t.little.log
 // RUN: not grep -q "MALLOC FAILED" %t.big.log
 // RUN: not grep -q "DONE" %t.little.log
diff --git a/test/Feature/MultipleFreeResolution.c b/test/Feature/MultipleFreeResolution.c
index cd8a383b..3216de95 100644
--- a/test/Feature/MultipleFreeResolution.c
+++ b/test/Feature/MultipleFreeResolution.c
@@ -1,7 +1,8 @@
 // RUN: %llvmgcc %s -g -emit-llvm -O0 -c -o %t1.bc
-// RUN: %klee --emit-all-errors %t1.bc 2>&1 | FileCheck %s
-// RUN: ls %T/klee-last/ | grep .ktest | wc -l | grep 4
-// RUN: ls %T/klee-last/ | grep .err | wc -l | grep 3
+// RUN: rm -rf %t.klee-out
+// RUN: %klee --output-dir=%t.klee-out --emit-all-errors %t1.bc 2>&1 | FileCheck %s
+// RUN: ls %t.klee-out/ | grep .ktest | wc -l | grep 4
+// RUN: ls %t.klee-out/ | grep .err | wc -l | grep 3
 
 #include <stdlib.h>
 #include <stdio.h>
@@ -31,9 +32,9 @@ int main() {
 
   free(buf[s]);
 
-  // CHECK: MultipleFreeResolution.c:39: memory error: out of bound pointer
-  // CHECK: MultipleFreeResolution.c:39: memory error: out of bound pointer
-  // CHECK: MultipleFreeResolution.c:39: memory error: out of bound pointer
+  // CHECK: MultipleFreeResolution.c:40: memory error: out of bound pointer
+  // CHECK: MultipleFreeResolution.c:40: memory error: out of bound pointer
+  // CHECK: MultipleFreeResolution.c:40: memory error: out of bound pointer
   // FIXME: Use FileCheck's relative line numbers
   for (i=0; i<3; i++) {
     printf("*buf[%d] = %d\n", i, *buf[i]);
diff --git a/test/Feature/MultipleReadResolution.c b/test/Feature/MultipleReadResolution.c
index 9297cf8d..af42c012 100644
--- a/test/Feature/MultipleReadResolution.c
+++ b/test/Feature/MultipleReadResolution.c
@@ -3,7 +3,8 @@
 // RUN: echo "x" >> %t1.res
 // RUN: echo "x" >> %t1.res
 // RUN: %llvmgcc %s -emit-llvm -O0 -c -o %t1.bc
-// RUN: %klee %t1.bc > %t1.log
+// RUN: rm -rf %t.klee-out
+// RUN: %klee --output-dir=%t.klee-out %t1.bc > %t1.log
 // RUN: diff %t1.res %t1.log
 
 #include <stdio.h>
diff --git a/test/Feature/MultipleReallocResolution.c b/test/Feature/MultipleReallocResolution.c
index 1f77485f..6530185d 100644
--- a/test/Feature/MultipleReallocResolution.c
+++ b/test/Feature/MultipleReallocResolution.c
@@ -1,7 +1,8 @@
 // RUN: %llvmgcc %s -emit-llvm -O0 -c -o %t1.bc
-// RUN: %klee %t1.bc
-// RUN: ls %T/klee-last/ | grep .err | wc -l | grep 2
-// RUN: ls %T/klee-last/ | grep .ptr.err | wc -l | grep 2
+// RUN: rm -rf %t.klee-out
+// RUN: %klee --output-dir=%t.klee-out %t1.bc
+// RUN: ls %t.klee-out/ | grep .err | wc -l | grep 2
+// RUN: ls %t.klee-out/ | grep .ptr.err | wc -l | grep 2
 
 #include <assert.h>
 #include <stdlib.h>
diff --git a/test/Feature/MultipleWriteResolution.c b/test/Feature/MultipleWriteResolution.c
index f07b9710..eb4b1694 100644
--- a/test/Feature/MultipleWriteResolution.c
+++ b/test/Feature/MultipleWriteResolution.c
@@ -3,7 +3,8 @@
 // RUN: echo "x" >> %t1.res
 // RUN: echo "x" >> %t1.res
 // RUN: %llvmgcc %s -emit-llvm -O0 -c -o %t1.bc
-// RUN: %klee %t1.bc > %t1.log
+// RUN: rm -rf %t.klee-out
+// RUN: %klee --output-dir=%t.klee-out %t1.bc > %t1.log
 // RUN: diff %t1.res %t1.log
 
 #include <stdio.h>
diff --git a/test/Feature/NamedSeedMatching.c b/test/Feature/NamedSeedMatching.c
index 16da3117..6599d269 100644
--- a/test/Feature/NamedSeedMatching.c
+++ b/test/Feature/NamedSeedMatching.c
@@ -1,9 +1,11 @@
 // RUN: %llvmgcc -emit-llvm -c -g %s -o %t.bc
-// RUN: rm -rf %t.out
-// RUN: %klee --output-dir=%t.out %t.bc "initial"
-// RUN: test -f %t.out/test000001.ktest
-// RUN: not test -f %t.out/test000002.ktest
-// RUN: %klee --only-replay-seeds --named-seed-matching --seed-out %t.out/test000001.ktest %t.bc > %t.log
+// RUN: rm -rf %t.klee-out
+// RUN: %klee --output-dir=%t.klee-out %t.bc "initial"
+// RUN: test -f %t.klee-out/test000001.ktest
+// RUN: not test -f %t.klee-out/test000002.ktest
+
+// RUN: rm -rf %t.klee-out-2
+// RUN: %klee --output-dir=%t.klee-out-2 --only-replay-seeds --named-seed-matching --seed-out %t.klee-out/test000001.ktest %t.bc > %t.log
 // RUN: grep -q "a==3" %t.log
 // RUN: grep -q "b==4" %t.log
 // RUN: grep -q "c==5" %t.log
diff --git a/test/Feature/OneFreeError.c b/test/Feature/OneFreeError.c
index e83b535a..4f5a8c8c 100644
--- a/test/Feature/OneFreeError.c
+++ b/test/Feature/OneFreeError.c
@@ -1,11 +1,12 @@
 // RUN: %llvmgcc %s -g -emit-llvm -O0 -c -o %t1.bc
-// RUN: %klee %t1.bc 2>&1 | FileCheck %s
-// RUN: test -f %T/klee-last/test000001.ptr.err
+// RUN: rm -rf %t.klee-out
+// RUN: %klee --output-dir=%t.klee-out %t1.bc 2>&1 | FileCheck %s
+// RUN: test -f %t.klee-out/test000001.ptr.err
 
 int main() {
   int *x = malloc(4);
   free(x);
-  // CHECK: OneFreeError.c:10: memory error: out of bound pointer
+  // CHECK: OneFreeError.c:11: memory error: out of bound pointer
   // FIXME: Use FileCheck's relative line numbers
   x[0] = 1;
   return 0;
diff --git a/test/Feature/OneOutOfBounds.c b/test/Feature/OneOutOfBounds.c
index 72d36b70..85fb2a79 100644
--- a/test/Feature/OneOutOfBounds.c
+++ b/test/Feature/OneOutOfBounds.c
@@ -1,10 +1,11 @@
 // RUN: %llvmgcc %s -g -emit-llvm -O0 -c -o %t1.bc
-// RUN: %klee %t1.bc 2>&1 | FileCheck %s
-// RUN: test -f %T/klee-last/test000001.ptr.err
+// RUN: rm -rf %t.klee-out
+// RUN: %klee --output-dir=%t.klee-out %t1.bc 2>&1 | FileCheck %s
+// RUN: test -f %t.klee-out/test000001.ptr.err
 
 int main() {
   int *x = malloc(sizeof(int));
-  // CHECK: OneOutOfBounds.c:9: memory error: out of bound pointer
+  // CHECK: OneOutOfBounds.c:10: memory error: out of bound pointer
   // FIXME: Use FileCheck's relative line numbers
   x[1] = 1;
   free(x);
diff --git a/test/Feature/Optimize.c b/test/Feature/Optimize.c
index 4789d089..9aa963ef 100644
--- a/test/Feature/Optimize.c
+++ b/test/Feature/Optimize.c
@@ -1,6 +1,7 @@
 // RUN: %llvmgcc %s -emit-llvm -O0 -c -o %t2.bc
 // RUN: rm -f %t2.log
-// RUN: %klee --stop-after-n-instructions=100 --optimize %t2.bc > %t3.log
+// RUN: rm -rf %t.klee-out
+// RUN: %klee --output-dir=%t.klee-out --stop-after-n-instructions=100 --optimize %t2.bc > %t3.log
 // RUN: echo "good" > %t3.good
 // RUN: diff %t3.log %t3.good
 
diff --git a/test/Feature/Overflow.ll b/test/Feature/Overflow.ll
index 90ace60b..35dfbd10 100644
--- a/test/Feature/Overflow.ll
+++ b/test/Feature/Overflow.ll
@@ -1,5 +1,6 @@
 ; RUN: llvm-as %s -f -o %t1.bc
-; RUN: %klee -disable-opt %t1.bc > %t2
+; RUN: rm -rf %t.klee-out
+; RUN: %klee --output-dir=%t.klee-out -disable-opt %t1.bc > %t2
 ; RUN: grep PASS %t2
 
 target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128-n8:16:32:64"
diff --git a/test/Feature/OverflowMul.ll b/test/Feature/OverflowMul.ll
index 7ab67502..7026aa74 100644
--- a/test/Feature/OverflowMul.ll
+++ b/test/Feature/OverflowMul.ll
@@ -1,5 +1,6 @@
 ; RUN: llvm-as %s -f -o %t1.bc
-; RUN: %klee -disable-opt %t1.bc > %t2
+; RUN: rm -rf %t.klee-out
+; RUN: %klee --output-dir=%t.klee-out -disable-opt %t1.bc > %t2
 ; RUN: grep PASS %t2
 
 target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128-n8:16:32:64"
diff --git a/test/Feature/OverlappedError.c b/test/Feature/OverlappedError.c
index 886c7ec8..a1b31f57 100644
--- a/test/Feature/OverlappedError.c
+++ b/test/Feature/OverlappedError.c
@@ -1,7 +1,8 @@
 // RUN: %llvmgcc %s -g -emit-llvm -O0 -c -o %t1.bc
-// RUN: %klee %t1.bc
-// RUN: ls %T/klee-last/ | grep .ktest | wc -l | grep 4
-// RUN: ls %T/klee-last/ | grep .ptr.err | wc -l | grep 2
+// RUN: rm -rf %t.klee-out
+// RUN: %klee --output-dir=%t.klee-out %t1.bc
+// RUN: ls %t.klee-out/ | grep .ktest | wc -l | grep 4
+// RUN: ls %t.klee-out/ | grep .ptr.err | wc -l | grep 2
 
 #include <stdlib.h>
 
diff --git a/test/Feature/OvershiftCheck.c b/test/Feature/OvershiftCheck.c
index bb967166..09cbf8ba 100644
--- a/test/Feature/OvershiftCheck.c
+++ b/test/Feature/OvershiftCheck.c
@@ -1,8 +1,9 @@
 // RUN: %llvmgcc %s -emit-llvm -g -O0 -c -o %t.bc
-// RUN: %klee -check-overshift %t.bc 2> %t.log
+// RUN: rm -rf %t.klee-out
+// RUN: %klee --output-dir=%t.klee-out -check-overshift %t.bc 2> %t.log
 // RUN: grep -c "overshift error" %t.log
-// RUN: grep -c "OvershiftCheck.c:19: overshift error" %t.log
-// RUN: grep -c "OvershiftCheck.c:23: overshift error" %t.log
+// RUN: grep -c "OvershiftCheck.c:20: overshift error" %t.log
+// RUN: grep -c "OvershiftCheck.c:24: overshift error" %t.log
 
 /* This test checks that two consecutive potential overshifts
  * are reported as errors.
diff --git a/test/Feature/PreferCex.c b/test/Feature/PreferCex.c
index 6cdb8446..d562f968 100644
--- a/test/Feature/PreferCex.c
+++ b/test/Feature/PreferCex.c
@@ -1,6 +1,7 @@
 // RUN: %llvmgcc %s -emit-llvm -O0 -c -o %t1.bc
-// RUN: %klee --exit-on-error %t1.bc
-// RUN: ktest-tool %T/klee-last/test000001.ktest | FileCheck %s
+// RUN: rm -rf %t.klee-out
+// RUN: %klee --output-dir=%t.klee-out --exit-on-error %t1.bc
+// RUN: ktest-tool %t.klee-out/test000001.ktest | FileCheck %s
 
 #include <assert.h>
 #include <stdlib.h>
diff --git a/test/Feature/RaiseAsm.c b/test/Feature/RaiseAsm.c
index 5b8acab4..6a4b7b3c 100644
--- a/test/Feature/RaiseAsm.c
+++ b/test/Feature/RaiseAsm.c
@@ -1,5 +1,6 @@
 // RUN: %llvmgcc %s -emit-llvm -O0 -c -o %t1.bc
-// RUN: %klee --exit-on-error %t1.bc
+// RUN: rm -rf %t.klee-out
+// RUN: %klee --output-dir=%t.klee-out --exit-on-error %t1.bc
 
 #include <assert.h>
 
diff --git a/test/Feature/Realloc.c b/test/Feature/Realloc.c
index 62aa170b..76016fb7 100644
--- a/test/Feature/Realloc.c
+++ b/test/Feature/Realloc.c
@@ -1,5 +1,6 @@
 // RUN: %llvmgcc %s -emit-llvm -O0 -c -o %t1.bc
-// RUN: %klee --exit-on-error %t1.bc 2>&1 | FileCheck %s
+// RUN: rm -rf %t.klee-out
+// RUN: %klee --output-dir=%t.klee-out --exit-on-error %t1.bc 2>&1 | FileCheck %s
 
 #include <assert.h>
 #include <stdlib.h>
diff --git a/test/Feature/ReplayPath.c b/test/Feature/ReplayPath.c
index ccf59657..c367c3d9 100644
--- a/test/Feature/ReplayPath.c
+++ b/test/Feature/ReplayPath.c
@@ -1,7 +1,10 @@
 // RUN: %llvmgcc %s -emit-llvm -O0 -DCOND_EXIT -c -o %t1.bc
-// RUN: klee --write-paths %t1.bc > %t3.good
+// RUN: rm -rf %t.klee-out
+// RUN: %klee --output-dir=%t.klee-out --write-paths %t1.bc > %t3.good
+
 // RUN: %llvmgcc %s -emit-llvm -O0 -c -o %t2.bc
-// RUN: %klee --replay-path %T/klee-last/test000001.path %t2.bc > %t3.log
+// RUN: rm -rf %t.klee-out-2
+// RUN: %klee --output-dir=%t.klee-out-2 --replay-path %t.klee-out/test000001.path %t2.bc > %t3.log
 // RUN: diff %t3.log %t3.good
 
 #include <unistd.h>
diff --git a/test/Feature/Searchers.c b/test/Feature/Searchers.c
index b120d354..284020eb 100644
--- a/test/Feature/Searchers.c
+++ b/test/Feature/Searchers.c
@@ -1,22 +1,40 @@
 // RUN: %llvmgcc %s -emit-llvm -O0 -c -o %t2.bc
-// RUN: %klee %t2.bc
-// RUN: %klee --search=random-state %t2.bc
-// RUN: %klee --search=nurs:depth %t2.bc
-// RUN: %klee --search=nurs:qc %t2.bc
-// RUN: %klee --use-batching-search %t2.bc
-// RUN: %klee --use-batching-search --search=random-state %t2.bc
-// RUN: %klee --use-batching-search --search=nurs:depth %t2.bc
-// RUN: %klee --use-batching-search --search=nurs:qc %t2.bc
-// RUN: %klee --search=random-path --search=nurs:qc %t2.bc
-// RUN: %klee --use-merge --search=dfs --debug-log-merge --debug-log-state-merge %t2.bc
-// RUN: %klee --use-merge --use-batching-search --search=dfs %t2.bc
-// RUN: %klee --use-merge --use-batching-search --search=random-state %t2.bc
-// RUN: %klee --use-merge --use-batching-search --search=nurs:depth %t2.bc
-// RUN: %klee --use-merge --use-batching-search --search=nurs:qc %t2.bc
-// RUN: %klee --use-iterative-deepening-time-search --use-batching-search %t2.bc
-// RUN: %klee --use-iterative-deepening-time-search --use-batching-search --search=random-state %t2.bc
-// RUN: %klee --use-iterative-deepening-time-search --use-batching-search --search=nurs:depth %t2.bc
-// RUN: %klee --use-iterative-deepening-time-search --use-batching-search --search=nurs:qc %t2.bc
+// RUN: rm -rf %t.klee-out
+// RUN: %klee --output-dir=%t.klee-out %t2.bc
+// RUN: rm -rf %t.klee-out
+// RUN: %klee --output-dir=%t.klee-out --search=random-state %t2.bc
+// RUN: rm -rf %t.klee-out
+// RUN: %klee --output-dir=%t.klee-out --search=nurs:depth %t2.bc
+// RUN: rm -rf %t.klee-out
+// RUN: %klee --output-dir=%t.klee-out --search=nurs:qc %t2.bc
+// RUN: rm -rf %t.klee-out
+// RUN: %klee --output-dir=%t.klee-out --use-batching-search %t2.bc
+// RUN: rm -rf %t.klee-out
+// RUN: %klee --output-dir=%t.klee-out --use-batching-search --search=random-state %t2.bc
+// RUN: rm -rf %t.klee-out
+// RUN: %klee --output-dir=%t.klee-out --use-batching-search --search=nurs:depth %t2.bc
+// RUN: rm -rf %t.klee-out
+// RUN: %klee --output-dir=%t.klee-out --use-batching-search --search=nurs:qc %t2.bc
+// RUN: rm -rf %t.klee-out
+// RUN: %klee --output-dir=%t.klee-out --search=random-path --search=nurs:qc %t2.bc
+// RUN: rm -rf %t.klee-out
+// RUN: %klee --output-dir=%t.klee-out --use-merge --search=dfs --debug-log-merge --debug-log-state-merge %t2.bc
+// RUN: rm -rf %t.klee-out
+// RUN: %klee --output-dir=%t.klee-out --use-merge --use-batching-search --search=dfs %t2.bc
+// RUN: rm -rf %t.klee-out
+// RUN: %klee --output-dir=%t.klee-out --use-merge --use-batching-search --search=random-state %t2.bc
+// RUN: rm -rf %t.klee-out
+// RUN: %klee --output-dir=%t.klee-out --use-merge --use-batching-search --search=nurs:depth %t2.bc
+// RUN: rm -rf %t.klee-out
+// RUN: %klee --output-dir=%t.klee-out --use-merge --use-batching-search --search=nurs:qc %t2.bc
+// RUN: rm -rf %t.klee-out
+// RUN: %klee --output-dir=%t.klee-out --use-iterative-deepening-time-search --use-batching-search %t2.bc
+// RUN: rm -rf %t.klee-out
+// RUN: %klee --output-dir=%t.klee-out --use-iterative-deepening-time-search --use-batching-search --search=random-state %t2.bc
+// RUN: rm -rf %t.klee-out
+// RUN: %klee --output-dir=%t.klee-out --use-iterative-deepening-time-search --use-batching-search --search=nurs:depth %t2.bc
+// RUN: rm -rf %t.klee-out
+// RUN: %klee --output-dir=%t.klee-out --use-iterative-deepening-time-search --use-batching-search --search=nurs:qc %t2.bc
 
 
 /* this test is basically just for coverage and doesn't really do any
diff --git a/test/Feature/SetForking.c b/test/Feature/SetForking.c
index cbae33c0..60799a0d 100644
--- a/test/Feature/SetForking.c
+++ b/test/Feature/SetForking.c
@@ -1,5 +1,6 @@
 // RUN: %llvmgcc -emit-llvm -g -c %s -o %t.bc
-// RUN: %klee %t.bc > %t.log
+// RUN: rm -rf %t.klee-out
+// RUN: %klee --output-dir=%t.klee-out %t.bc > %t.log
 // RUN: sort %t.log | uniq -c > %t.uniq.log
 // RUN: grep "1 A" %t.uniq.log
 // RUN: grep "1 B" %t.uniq.log
diff --git a/test/Feature/SolverTimeout.c b/test/Feature/SolverTimeout.c
index 34405c1f..2ef6d413 100644
--- a/test/Feature/SolverTimeout.c
+++ b/test/Feature/SolverTimeout.c
@@ -1,5 +1,6 @@
 // RUN: %llvmgcc %s -emit-llvm -O0 -c -o %t1.bc
-// RUN: %klee --max-solver-time=1 %t1.bc
+// RUN: rm -rf %t.klee-out
+// RUN: %klee --output-dir=%t.klee-out --max-solver-time=1 %t1.bc
 #include <stdio.h>
 
 int main() {
diff --git a/test/Feature/Vararg.c b/test/Feature/Vararg.c
index 31eee235..398ba6f8 100644
--- a/test/Feature/Vararg.c
+++ b/test/Feature/Vararg.c
@@ -1,7 +1,8 @@
 // RUN: %llvmgcc %s -emit-llvm -O0 -c -o %t1.bc
-// RUN: %klee %t1.bc > %t2.out
+// RUN: rm -rf %t.klee-out
+// RUN: %klee --output-dir=%t.klee-out %t1.bc > %t2.out
 // RUN: grep "types: (52, 37, 2.00, (9,12,15))" %t2.out
-// RUN: test -f %T/klee-last/test000001.ptr.err
+// RUN: test -f %t.klee-out/test000001.ptr.err
 
 #include <stdarg.h>
 #include <assert.h>
diff --git a/test/Feature/WithLibc.c b/test/Feature/WithLibc.c
index 5e84eb4a..cefef577 100644
--- a/test/Feature/WithLibc.c
+++ b/test/Feature/WithLibc.c
@@ -1,5 +1,6 @@
 // RUN: %llvmgcc %s -emit-llvm -O0 -c -o %t2.bc
-// RUN: %klee --libc=klee %t2.bc > %t3.log
+// RUN: rm -rf %t.klee-out
+// RUN: %klee --output-dir=%t.klee-out --libc=klee %t2.bc > %t3.log
 // RUN: echo "good" > %t3.good
 // RUN: diff %t3.log %t3.good
 
diff --git a/test/Feature/WriteCov.c b/test/Feature/WriteCov.c
index 45e7bc43..3ecce3fc 100644
--- a/test/Feature/WriteCov.c
+++ b/test/Feature/WriteCov.c
@@ -1,20 +1,21 @@
 // RUN: %llvmgcc %s -emit-llvm -g -c -o %t2.bc
-// RUN: %klee --exit-on-error --write-cov %t2.bc
-// RUN: grep -c WriteCov.c:15  %T/klee-last/test000001.cov %T/klee-last/test000002.cov  >%t3.txt
-// RUN: grep -c WriteCov.c:17  %T/klee-last/test000001.cov %T/klee-last/test000002.cov >>%t3.txt
-// RUN: grep klee-last/test000001.cov:0 %t3.txt
-// RUN: grep klee-last/test000001.cov:1 %t3.txt
-// RUN: grep klee-last/test000002.cov:0 %t3.txt
-// RUN: grep klee-last/test000002.cov:1 %t3.txt
+// RUN: rm -rf %t.klee-out
+// RUN: %klee --output-dir=%t.klee-out --exit-on-error --write-cov %t2.bc
+// RUN: grep -c WriteCov.c:16  %t.klee-out/test000001.cov %t.klee-out/test000002.cov  >%t3.txt
+// RUN: grep -c WriteCov.c:18  %t.klee-out/test000001.cov %t.klee-out/test000002.cov >>%t3.txt
+// RUN: grep %t.klee-out/test000001.cov:0 %t3.txt
+// RUN: grep %t.klee-out/test000001.cov:1 %t3.txt
+// RUN: grep %t.klee-out/test000002.cov:0 %t3.txt
+// RUN: grep %t.klee-out/test000002.cov:1 %t3.txt
 
 #include <assert.h>
 #include <stdio.h>
 
 int main() {
   if (klee_range(0,2, "range")) {
-    assert(__LINE__ == 15); printf("__LINE__ = %d\n", __LINE__);
+    assert(__LINE__ == 16); printf("__LINE__ = %d\n", __LINE__);
   } else {
-    assert(__LINE__ == 17); printf("__LINE__ = %d\n", __LINE__);
+    assert(__LINE__ == 18); printf("__LINE__ = %d\n", __LINE__);
   }
   return 0;
 }
diff --git a/test/Feature/arithmetic-right-overshift-sym-conc.c b/test/Feature/arithmetic-right-overshift-sym-conc.c
index 81995b2b..a771bc75 100644
--- a/test/Feature/arithmetic-right-overshift-sym-conc.c
+++ b/test/Feature/arithmetic-right-overshift-sym-conc.c
@@ -1,7 +1,8 @@
 // RUN: %llvmgcc %s -emit-llvm -g -O0 -c -o %t.bc
-// RUN: %klee -use-cex-cache=1 -check-overshift=0 %t.bc
-// RUN: not grep "ASSERTION FAIL" %T/klee-last/messages.txt
-// RUN: grep "KLEE: done: explored paths = 1" %T/klee-last/info
+// RUN: rm -rf %t.klee-out
+// RUN: %klee --output-dir=%t.klee-out -use-cex-cache=1 -check-overshift=0 %t.bc
+// RUN: not grep "ASSERTION FAIL" %t.klee-out/messages.txt
+// RUN: grep "KLEE: done: explored paths = 1" %t.klee-out/info
 #include <stdio.h>
 #include <assert.h>
 
diff --git a/test/Feature/consecutive_divide_by_zero.c b/test/Feature/consecutive_divide_by_zero.c
index c1185870..31124ea4 100644
--- a/test/Feature/consecutive_divide_by_zero.c
+++ b/test/Feature/consecutive_divide_by_zero.c
@@ -1,9 +1,10 @@
 // RUN: %llvmgcc -emit-llvm -c -g -O0 %s -o %t.bc
-// RUN: %klee -check-div-zero -emit-all-errors=0 %t.bc 2> %t.log
+// RUN: rm -rf %t.klee-out
+// RUN: %klee --output-dir=%t.klee-out -check-div-zero -emit-all-errors=0 %t.bc 2> %t.log
 // RUN: grep "completed paths = 3" %t.log
 // RUN: grep "generated tests = 3" %t.log
-// RUN: grep "consecutive_divide_by_zero.c:24: divide by zero" %t.log
-// RUN: grep "consecutive_divide_by_zero.c:27: divide by zero" %t.log
+// RUN: grep "consecutive_divide_by_zero.c:25: divide by zero" %t.log
+// RUN: grep "consecutive_divide_by_zero.c:28: divide by zero" %t.log
 
 /* This test case captures a bug where two distinct division
 *  by zero errors are treated as the same error and so
diff --git a/test/Feature/const_array_opt1.c b/test/Feature/const_array_opt1.c
index 09ed07fd..ac43bdf7 100644
--- a/test/Feature/const_array_opt1.c
+++ b/test/Feature/const_array_opt1.c
@@ -1,5 +1,6 @@
 // RUN: %llvmgcc %s -emit-llvm -O0 -c -o %t.bc
-// RUN: %klee --const-array-opt --max-time=10 --only-output-states-covering-new %t.bc >%t.log
+// RUN: rm -rf %t.klee-out
+// RUN: %klee --output-dir=%t.klee-out --const-array-opt --max-time=10 --only-output-states-covering-new %t.bc >%t.log
 // grep -q "Finished successfully!\n"
 
 /* This is testing the const array optimization.  On my 2.3GHz machine
diff --git a/test/Feature/left-overshift-sym-conc.c b/test/Feature/left-overshift-sym-conc.c
index e962fa28..8859c46c 100644
--- a/test/Feature/left-overshift-sym-conc.c
+++ b/test/Feature/left-overshift-sym-conc.c
@@ -1,7 +1,8 @@
 // RUN: %llvmgcc %s -emit-llvm -g -O0 -c -o %t.bc
-// RUN: %klee -use-cex-cache=1 -check-overshift=0 %t.bc
-// RUN: not grep "ASSERTION FAIL" %T/klee-last/messages.txt
-// RUN: grep "KLEE: done: explored paths = 1" %T/klee-last/info
+// RUN: rm -rf %t.klee-out
+// RUN: %klee --output-dir=%t.klee-out -use-cex-cache=1 -check-overshift=0 %t.bc
+// RUN: not grep "ASSERTION FAIL" %t.klee-out/messages.txt
+// RUN: grep "KLEE: done: explored paths = 1" %t.klee-out/info
 #include <stdio.h>
 #include <assert.h>
 
diff --git a/test/Feature/logical-right-overshift-sym-conc.c b/test/Feature/logical-right-overshift-sym-conc.c
index 00281ec4..950b5992 100644
--- a/test/Feature/logical-right-overshift-sym-conc.c
+++ b/test/Feature/logical-right-overshift-sym-conc.c
@@ -1,7 +1,8 @@
 // RUN: %llvmgcc %s -emit-llvm -g -O0 -c -o %t.bc
-// RUN: %klee -use-cex-cache=1 -check-overshift=0 %t.bc
-// RUN: not grep "ASSERTION FAIL" %T/klee-last/messages.txt
-// RUN: grep "KLEE: done: explored paths = 1" %T/klee-last/info
+// RUN: rm -rf %t.klee-out
+// RUN: %klee --output-dir=%t.klee-out -use-cex-cache=1 -check-overshift=0 %t.bc
+// RUN: not grep "ASSERTION FAIL" %t.klee-out/messages.txt
+// RUN: grep "KLEE: done: explored paths = 1" %t.klee-out/info
 #include <stdio.h>
 #include <assert.h>
 
diff --git a/test/Makefile b/test/Makefile
index 61a91800..bfdeb16d 100644
--- a/test/Makefile
+++ b/test/Makefile
@@ -49,6 +49,11 @@ LIT_ALL_TESTSUITES := $(LIT_TESTSUITE)
 check-local:: lit.site.cfg
 	$(Verb) ( $(ULIMIT) \
 	          $(PYTHON) $(LLVM_SRC_ROOT)/utils/lit/lit.py $(LIT_ARGS) $(LIT_TESTSUITE) )
+	@klee_last_path=$$(find . -name klee-last | head -1); \
+	 if [ ! -z "$$klee_last_path" ]; then \
+	  echo "error: one of the tests failed to use --output-dir, found: $$klee_last_path"; \
+	  exit 1; \
+	fi
 
 check-local-all:: lit.site.cfg
 	$(Verb) ( $(ULIMIT) \
diff --git a/test/Programs/pcregrep.c b/test/Programs/pcregrep.c
index 81b57dfc..fb99ef87 100644
--- a/test/Programs/pcregrep.c
+++ b/test/Programs/pcregrep.c
@@ -1,5 +1,6 @@
 // RUN: %llvmgcc -m32 %s -emit-llvm -O0 -c -o %t1.bc
-// RUN: %klee --libc=klee --exit-on-error %t1.bc 2 2
+// RUN: rm -rf %t.klee-out
+// RUN: %klee --output-dir=%t.klee-out --libc=klee --exit-on-error %t1.bc 2 2
 // XFAIL: x86_64
 
 /* Provide Declarations */
diff --git a/test/Runtime/POSIX/DirConsistency.c b/test/Runtime/POSIX/DirConsistency.c
index 24bb8a6e..879dd75f 100644
--- a/test/Runtime/POSIX/DirConsistency.c
+++ b/test/Runtime/POSIX/DirConsistency.c
@@ -1,7 +1,9 @@
 // RUN: %llvmgcc %s -emit-llvm -O0 -c -o %t.bc
-// RUN: %klee --run-in=/tmp --search=random-state --libc=uclibc --posix-runtime --exit-on-error %t.bc --sym-files 1 1 > %t1.log
+// RUN: rm -rf %t.klee-out
+// RUN: %klee --output-dir=%t.klee-out --run-in=/tmp --search=random-state --libc=uclibc --posix-runtime --exit-on-error %t.bc --sym-files 1 1 > %t1.log
 // RUN: %llvmgcc -D_FILE_OFFSET_BITS=64 %s -emit-llvm -O0 -c -o %t.bc
-// RUN: %klee --run-in=/tmp --search=random-state --libc=uclibc --posix-runtime --exit-on-error %t.bc --sym-files 1 1 > %t2.log
+// RUN: rm -rf %t.klee-out
+// RUN: %klee --output-dir=%t.klee-out --run-in=/tmp --search=random-state --libc=uclibc --posix-runtime --exit-on-error %t.bc --sym-files 1 1 > %t2.log
 // RUN: sort %t1.log %t2.log | uniq -c > %t3.log
 // RUN: grep -q "4 COUNT" %t3.log
 
diff --git a/test/Runtime/POSIX/DirSeek.c b/test/Runtime/POSIX/DirSeek.c
index 81336a68..1b2c25e8 100644
--- a/test/Runtime/POSIX/DirSeek.c
+++ b/test/Runtime/POSIX/DirSeek.c
@@ -1,7 +1,10 @@
 // RUN: %llvmgcc %s -emit-llvm -O0 -c -o %t2.bc
-// RUN: %klee --run-in=/tmp --libc=uclibc --posix-runtime --exit-on-error %t2.bc --sym-files 2 2
-// RUN: %klee --run-in=/tmp --libc=uclibc --posix-runtime --exit-on-error %t2.bc --sym-files 1 2
-// RUN: %klee --run-in=/tmp --libc=uclibc --posix-runtime --exit-on-error %t2.bc --sym-files 0 2
+// RUN: rm -rf %t.klee-out
+// RUN: %klee --output-dir=%t.klee-out --run-in=/tmp --libc=uclibc --posix-runtime --exit-on-error %t2.bc --sym-files 2 2
+// RUN: rm -rf %t.klee-out
+// RUN: %klee --output-dir=%t.klee-out --run-in=/tmp --libc=uclibc --posix-runtime --exit-on-error %t2.bc --sym-files 1 2
+// RUN: rm -rf %t.klee-out
+// RUN: %klee --output-dir=%t.klee-out --run-in=/tmp --libc=uclibc --posix-runtime --exit-on-error %t2.bc --sym-files 0 2
 
 // For this test really to work as intended it needs to be run in a
 // directory large enough to cause uclibc to do multiple getdents
diff --git a/test/Runtime/POSIX/FDNumbers.c b/test/Runtime/POSIX/FDNumbers.c
index 3228c8a9..c012174c 100644
--- a/test/Runtime/POSIX/FDNumbers.c
+++ b/test/Runtime/POSIX/FDNumbers.c
@@ -1,5 +1,6 @@
 // RUN: %llvmgcc %s -emit-llvm -O0 -c -o %t2.bc
-// RUN: %klee --posix-runtime --exit-on-error %t2.bc --sym-files 1 10
+// RUN: rm -rf %t.klee-out
+// RUN: %klee --output-dir=%t.klee-out --posix-runtime --exit-on-error %t2.bc --sym-files 1 10
 
 #include <assert.h>
 #include <fcntl.h>
diff --git a/test/Runtime/POSIX/FD_Fail.c b/test/Runtime/POSIX/FD_Fail.c
index a4bf2fc2..186ada51 100644
--- a/test/Runtime/POSIX/FD_Fail.c
+++ b/test/Runtime/POSIX/FD_Fail.c
@@ -1,5 +1,6 @@
 // RUN: %llvmgcc %s -emit-llvm -O0 -c -o %t1.bc
-// RUN: %klee --libc=uclibc --posix-runtime %t1.bc --sym-files 0 0 --max-fail 1 > %t.log
+// RUN: rm -rf %t.klee-out
+// RUN: %klee --output-dir=%t.klee-out --libc=uclibc --posix-runtime %t1.bc --sym-files 0 0 --max-fail 1 > %t.log
 // RUN: grep -q "fread(): ok" %t.log
 // RUN: grep -q "fread(): fail" %t.log
 // RUN: grep -q "fclose(): ok" %t.log
diff --git a/test/Runtime/POSIX/FD_Fail2.c b/test/Runtime/POSIX/FD_Fail2.c
index 624329fc..74957597 100644
--- a/test/Runtime/POSIX/FD_Fail2.c
+++ b/test/Runtime/POSIX/FD_Fail2.c
@@ -1,12 +1,13 @@
 // RUN: %llvmgcc %s -emit-llvm -O0 -c -o %t1.bc
-// RUN: %klee --libc=uclibc --posix-runtime --search=dfs %t1.bc --sym-files 1 10 --max-fail 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
-// RUN: test -f %T/klee-last/test000004.ktest
-// RUN: test -f %T/klee-last/test000005.ktest
-// RUN: test -f %T/klee-last/test000006.ktest
-// RUN: test -f %T/klee-last/test000007.ktest
+// RUN: rm -rf %t.klee-out
+// RUN: %klee --output-dir=%t.klee-out --libc=uclibc --posix-runtime --search=dfs %t1.bc --sym-files 1 10 --max-fail 1
+// RUN: test -f %t.klee-out/test000001.ktest
+// RUN: test -f %t.klee-out/test000002.ktest
+// RUN: test -f %t.klee-out/test000003.ktest
+// RUN: test -f %t.klee-out/test000004.ktest
+// RUN: test -f %t.klee-out/test000005.ktest
+// RUN: test -f %t.klee-out/test000006.ktest
+// RUN: test -f %t.klee-out/test000007.ktest
 
 #include <stdio.h>
 #include <assert.h>
diff --git a/test/Runtime/POSIX/Fcntl.c b/test/Runtime/POSIX/Fcntl.c
index 1b37e711..13f6de78 100644
--- a/test/Runtime/POSIX/Fcntl.c
+++ b/test/Runtime/POSIX/Fcntl.c
@@ -1,5 +1,6 @@
 // RUN: %llvmgcc %s -emit-llvm -O0 -c -o %t2.bc
-// RUN: %klee --posix-runtime --exit-on-error %t2.bc --sym-files 1 10
+// RUN: rm -rf %t.klee-out
+// RUN: %klee --output-dir=%t.klee-out --posix-runtime --exit-on-error %t2.bc --sym-files 1 10
 
 #include <assert.h>
 #include <fcntl.h>
diff --git a/test/Runtime/POSIX/FilePerm.c b/test/Runtime/POSIX/FilePerm.c
index 1346c09a..c66e35de 100644
--- a/test/Runtime/POSIX/FilePerm.c
+++ b/test/Runtime/POSIX/FilePerm.c
@@ -1,8 +1,9 @@
 // RUN: %llvmgcc %s -emit-llvm -O0 -c -o %t.bc
-// RUN: %klee --posix-runtime %t.bc --sym-files 1 10 --sym-stdout 2>%t.log 
-// RUN: test -f %T/klee-last/test000001.ktest
-// RUN: test -f %T/klee-last/test000002.ktest
-// RUN: test -f %T/klee-last/test000003.ktest
+// RUN: rm -rf %t.klee-out
+// RUN: %klee --output-dir=%t.klee-out --posix-runtime %t.bc --sym-files 1 10 --sym-stdout 2>%t.log 
+// RUN: test -f %t.klee-out/test000001.ktest
+// RUN: test -f %t.klee-out/test000002.ktest
+// RUN: test -f %t.klee-out/test000003.ktest
 
 #include <stdio.h>       
 #include <sys/types.h>
diff --git a/test/Runtime/POSIX/FreeArgv.c b/test/Runtime/POSIX/FreeArgv.c
index 4d2e5b75..8f812b5d 100644
--- a/test/Runtime/POSIX/FreeArgv.c
+++ b/test/Runtime/POSIX/FreeArgv.c
@@ -1,8 +1,9 @@
 // RUN: %llvmgcc %s -g -emit-llvm -O0 -c -o %t.bc
-// RUN: %klee --posix-runtime %t.bc --sym-args 1 1 1 2>&1 | FileCheck %s
-// RUN: test -f %T/klee-last/test000001.free.err
-// RUN: test -f %T/klee-last/test000002.free.err
-// RUN: test -f %T/klee-last/test000003.free.err
+// RUN: rm -rf %t.klee-out
+// RUN: %klee --output-dir=%t.klee-out --posix-runtime %t.bc --sym-args 1 1 1 2>&1 | FileCheck %s
+// RUN: test -f %t.klee-out/test000001.free.err
+// RUN: test -f %t.klee-out/test000002.free.err
+// RUN: test -f %t.klee-out/test000003.free.err
 
 int main(int argc, char **argv) {
   // FIXME: Use FileCheck's CHECK-DAG to check source locations
diff --git a/test/Runtime/POSIX/Futimesat.c b/test/Runtime/POSIX/Futimesat.c
index 6ae0ca7c..011fe56f 100644
--- a/test/Runtime/POSIX/Futimesat.c
+++ b/test/Runtime/POSIX/Futimesat.c
@@ -1,6 +1,7 @@
 // RUN: %llvmgcc %s -emit-llvm -O0 -g -c -o %t2.bc
 // RUN: touch /tmp/futimesat-dummy
-// RUN: %klee --posix-runtime --exit-on-error %t2.bc --sym-files 1 10
+// RUN: rm -rf %t.klee-out
+// RUN: %klee --output-dir=%t.klee-out --posix-runtime --exit-on-error %t2.bc --sym-files 1 10
 // RUN: rm /tmp/futimesat-dummy
 
 #include <assert.h>
diff --git a/test/Runtime/POSIX/Getenv.c b/test/Runtime/POSIX/Getenv.c
index 9d5672f7..eb3a611a 100644
--- a/test/Runtime/POSIX/Getenv.c
+++ b/test/Runtime/POSIX/Getenv.c
@@ -1,5 +1,6 @@
 // RUN: %llvmgcc %s -emit-llvm -O0 -c -o %t2.bc
-// RUN: %klee --libc=klee --posix-runtime --exit-on-error %t2.bc --sym-files 1 10
+// RUN: rm -rf %t.klee-out
+// RUN: %klee --output-dir=%t.klee-out --libc=klee --posix-runtime --exit-on-error %t2.bc --sym-files 1 10
 
 #include <assert.h>
 
diff --git a/test/Runtime/POSIX/Ioctl.c b/test/Runtime/POSIX/Ioctl.c
index 93ce4b5c..e8220276 100644
--- a/test/Runtime/POSIX/Ioctl.c
+++ b/test/Runtime/POSIX/Ioctl.c
@@ -1,5 +1,6 @@
 // RUN: %llvmgcc %s -emit-llvm -O0 -c -o %t.bc
-// RUN: %klee --posix-runtime --exit-on-error %t.bc --sym-files 0 4
+// RUN: rm -rf %t.klee-out
+// RUN: %klee --output-dir=%t.klee-out --posix-runtime --exit-on-error %t.bc --sym-files 0 4
 
 #include <assert.h>
 #include <fcntl.h>
diff --git a/test/Runtime/POSIX/Isatty.c b/test/Runtime/POSIX/Isatty.c
index 3054aadb..241c5cbb 100644
--- a/test/Runtime/POSIX/Isatty.c
+++ b/test/Runtime/POSIX/Isatty.c
@@ -1,9 +1,10 @@
 // RUN: %llvmgcc %s -emit-llvm -O0 -c -o %t.bc
-// 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
-// RUN: test -f %T/klee-last/test000004.ktest
+// RUN: rm -rf %t.klee-out
+// RUN: %klee --output-dir=%t.klee-out --libc=uclibc --posix-runtime %t.bc --sym-files 0 10 --sym-stdout > %t.log 2>&1
+// RUN: test -f %t.klee-out/test000001.ktest
+// RUN: test -f %t.klee-out/test000002.ktest
+// RUN: test -f %t.klee-out/test000003.ktest
+// RUN: test -f %t.klee-out/test000004.ktest
 // RUN: grep -q "stdin is a tty" %t.log
 // RUN: grep -q "stdin is NOT a tty" %t.log
 // RUN: grep -q "stdout is a tty" %t.log
diff --git a/test/Runtime/POSIX/Openat.c b/test/Runtime/POSIX/Openat.c
index 3c17f976..c46c1269 100644
--- a/test/Runtime/POSIX/Openat.c
+++ b/test/Runtime/POSIX/Openat.c
@@ -1,6 +1,7 @@
 // RUN: %llvmgcc %s -emit-llvm -O0 -c -o %t2.bc
-// RUN: %klee --posix-runtime --exit-on-error %t2.bc --sym-files 1 10
-// RUN: test -f %T/klee-last/test000001.ktest
+// RUN: rm -rf %t.klee-out
+// RUN: %klee --output-dir=%t.klee-out --posix-runtime --exit-on-error %t2.bc --sym-files 1 10
+// RUN: test -f %t.klee-out/test000001.ktest
 
 #include <assert.h>
 #include <fcntl.h>
diff --git a/test/Runtime/POSIX/PrgName.c b/test/Runtime/POSIX/PrgName.c
index 6bc682ca..d62fe0fa 100644
--- a/test/Runtime/POSIX/PrgName.c
+++ b/test/Runtime/POSIX/PrgName.c
@@ -1,7 +1,8 @@
 // RUN: %llvmgcc %s -emit-llvm -O0 -c -o %t2.bc
-// RUN: %klee --posix-runtime --exit-on-error %t2.bc --sym-arg 10 >%t.log
-// RUN: test -f %T/klee-last/test000001.ktest
-// RUN: test -f %T/klee-last/test000002.ktest
+// RUN: rm -rf %t.klee-out
+// RUN: %klee --output-dir=%t.klee-out --posix-runtime --exit-on-error %t2.bc --sym-arg 10 >%t.log
+// RUN: test -f %t.klee-out/test000001.ktest
+// RUN: test -f %t.klee-out/test000002.ktest
 // RUN: grep -q "No" %t.log
 // RUN: grep -qv "Yes" %t.log
 
diff --git a/test/Runtime/POSIX/Read1.c b/test/Runtime/POSIX/Read1.c
index 66831073..2b8cfa9d 100644
--- a/test/Runtime/POSIX/Read1.c
+++ b/test/Runtime/POSIX/Read1.c
@@ -1,5 +1,6 @@
 // RUN: %llvmgcc %s -emit-llvm -O0 -c -o %t.bc
-// RUN: %klee --exit-on-error --posix-runtime %t.bc --sym-files 1 8 >%t.log
+// RUN: rm -rf %t.klee-out
+// RUN: %klee --output-dir=%t.klee-out --exit-on-error --posix-runtime %t.bc --sym-files 1 8 >%t.log
 
 #include <unistd.h>
 #include <sys/types.h>
diff --git a/test/Runtime/POSIX/SELinux/SELinux.c b/test/Runtime/POSIX/SELinux/SELinux.c
index 65dd1a7f..21bebc4d 100644
--- a/test/Runtime/POSIX/SELinux/SELinux.c
+++ b/test/Runtime/POSIX/SELinux/SELinux.c
@@ -1,6 +1,7 @@
 /* Very basic test, as right now SELinux support is extremely basic */
 // RUN: %llvmgcc %s -emit-llvm -O0 -c -o %t1.bc
-// RUN: %klee --posix-runtime --exit-on-error %t1.bc --sym-arg 2 > %t.log
+// RUN: rm -rf %t.klee-out
+// RUN: %klee --output-dir=%t.klee-out --posix-runtime --exit-on-error %t1.bc --sym-arg 2 > %t.log
 // XFAIL: no-selinux
 
 #include <selinux/selinux.h>
diff --git a/test/Runtime/POSIX/SeedAndFail.c b/test/Runtime/POSIX/SeedAndFail.c
index d9bd7f8d..964ec500 100644
--- a/test/Runtime/POSIX/SeedAndFail.c
+++ b/test/Runtime/POSIX/SeedAndFail.c
@@ -1,8 +1,9 @@
 // RUN: %llvmgcc %s -emit-llvm -g -O0 -c -o %t.bc
-// RUN: rm -rf %T/tmp-123
-// RUN: %klee --libc=uclibc --output-dir=%T/tmp-123 --posix-runtime %t.bc --sym-files 1 10  2>%t.log
-// RUN: %klee --seed-out-dir=%T/tmp-123 --zero-seed-extension --libc=uclibc --posix-runtime %t.bc --sym-files 1 10 --max-fail 1
-// RUN: ls %T/klee-last | grep -c assert | grep 4
+// RUN: rm -rf %t.klee-out
+// RUN: %klee --output-dir=%t.klee-out --libc=uclibc --posix-runtime %t.bc --sym-files 1 10  2>%t.log
+// RUN: rm -rf %t.klee-out-2
+// RUN: %klee --output-dir=%t.klee-out-2 --seed-out-dir=%t.klee-out --zero-seed-extension --libc=uclibc --posix-runtime %t.bc --sym-files 1 10 --max-fail 1
+// RUN: ls %t.klee-out-2 | grep -c assert | grep 4
 
 #include <string.h>
 #include <assert.h>
diff --git a/test/Runtime/POSIX/Stdin.c b/test/Runtime/POSIX/Stdin.c
index b5402cf1..ebf16405 100644
--- a/test/Runtime/POSIX/Stdin.c
+++ b/test/Runtime/POSIX/Stdin.c
@@ -1,5 +1,6 @@
 // RUN: %llvmgcc %s -emit-llvm -O0 -c -o %t.bc
-// RUN: %klee --libc=uclibc --posix-runtime --exit-on-error %t.bc --sym-files 0 4 > %t.log
+// RUN: rm -rf %t.klee-out
+// RUN: %klee --output-dir=%t.klee-out --libc=uclibc --posix-runtime --exit-on-error %t.bc --sym-files 0 4 > %t.log
 // RUN: grep "mode:file" %t.log
 // RUN: grep "mode:dir" %t.log
 // RUN: grep "mode:chr" %t.log
diff --git a/test/Runtime/POSIX/Write1.c b/test/Runtime/POSIX/Write1.c
index 16132b82..d260f2c3 100644
--- a/test/Runtime/POSIX/Write1.c
+++ b/test/Runtime/POSIX/Write1.c
@@ -1,5 +1,6 @@
 // RUN: %llvmgcc %s -emit-llvm -O0 -c -o %t.bc
-// RUN: %klee --exit-on-error --libc=uclibc --posix-runtime %t.bc --sym-files 1 10 --sym-stdout 2>%t.log
+// RUN: rm -rf %t.klee-out
+// RUN: %klee --output-dir=%t.klee-out --exit-on-error --libc=uclibc --posix-runtime %t.bc --sym-files 1 10 --sym-stdout 2>%t.log
 
 #include <stdio.h>
 #include <assert.h>
diff --git a/test/Runtime/POSIX/Write2.c b/test/Runtime/POSIX/Write2.c
index 9801e70c..edb3e5b2 100644
--- a/test/Runtime/POSIX/Write2.c
+++ b/test/Runtime/POSIX/Write2.c
@@ -1,5 +1,6 @@
 // RUN: %llvmgcc %s -emit-llvm -O0 -c -o %t.bc
-// RUN: %klee --exit-on-error --libc=uclibc --posix-runtime %t.bc --sym-files 1 10 --sym-stdout 2>%t.log
+// RUN: rm -rf %t.klee-out
+// RUN: %klee --output-dir=%t.klee-out --exit-on-error --libc=uclibc --posix-runtime %t.bc --sym-files 1 10 --sym-stdout 2>%t.log
 
 #include <stdio.h>
 #include <assert.h>
diff --git a/test/Runtime/Uclibc/2007-10-08-optimization-calls-wrong-libc-functions.c b/test/Runtime/Uclibc/2007-10-08-optimization-calls-wrong-libc-functions.c
index 83e6a57a..71f6d07a 100644
--- a/test/Runtime/Uclibc/2007-10-08-optimization-calls-wrong-libc-functions.c
+++ b/test/Runtime/Uclibc/2007-10-08-optimization-calls-wrong-libc-functions.c
@@ -1,5 +1,6 @@
 // RUN: %llvmgcc %s -emit-llvm -O0 -c -o %t1.bc
-// RUN: %klee --exit-on-error --optimize --libc=uclibc %t1.bc
+// RUN: rm -rf %t.klee-out
+// RUN: %klee --output-dir=%t.klee-out --exit-on-error --optimize --libc=uclibc %t1.bc
 
 #include <string.h>
 #include <assert.h>
diff --git a/test/Runtime/Uclibc/2008-03-04-libc-atexit-uses-dso-handle.c b/test/Runtime/Uclibc/2008-03-04-libc-atexit-uses-dso-handle.c
index 686bec19..47ee3a4d 100644
--- a/test/Runtime/Uclibc/2008-03-04-libc-atexit-uses-dso-handle.c
+++ b/test/Runtime/Uclibc/2008-03-04-libc-atexit-uses-dso-handle.c
@@ -1,5 +1,6 @@
 // RUN: %llvmgcc %s -emit-llvm -O0 -c -o %t1.bc
-// RUN: %klee --exit-on-error --libc=uclibc %t1.bc
+// RUN: rm -rf %t.klee-out
+// RUN: %klee --output-dir=%t.klee-out --exit-on-error --libc=uclibc %t1.bc
 
 // just make sure atexit works ok
 
diff --git a/test/Runtime/Uclibc/Environ.c b/test/Runtime/Uclibc/Environ.c
index 36db1911..76208278 100644
--- a/test/Runtime/Uclibc/Environ.c
+++ b/test/Runtime/Uclibc/Environ.c
@@ -1,5 +1,6 @@
 // RUN: %llvmgcc %s -emit-llvm -g -c -o %t1.bc
-// RUN: %klee --libc=uclibc --exit-on-error %t1.bc
+// RUN: rm -rf %t.klee-out
+// RUN: %klee --output-dir=%t.klee-out --libc=uclibc --exit-on-error %t1.bc
 
 #include <assert.h>
 #include <stdlib.h>
diff --git a/test/regression/2007-07-25-invalid-stp-array-binding-to-objectstate.c b/test/regression/2007-07-25-invalid-stp-array-binding-to-objectstate.c
index ad585ddd..611656bd 100644
--- a/test/regression/2007-07-25-invalid-stp-array-binding-to-objectstate.c
+++ b/test/regression/2007-07-25-invalid-stp-array-binding-to-objectstate.c
@@ -1,5 +1,6 @@
 // RUN: %llvmgcc %s -emit-llvm -O0 -c -o %t1.bc
-// RUN: %klee %t1.bc
+// RUN: rm -rf %t.klee-out
+// RUN: %klee --output-dir=%t.klee-out %t1.bc
 
 #include <assert.h>
 
diff --git a/test/regression/2007-07-30-unflushed-byte.c b/test/regression/2007-07-30-unflushed-byte.c
index ba8a08a7..20f60eef 100644
--- a/test/regression/2007-07-30-unflushed-byte.c
+++ b/test/regression/2007-07-30-unflushed-byte.c
@@ -1,5 +1,6 @@
 // RUN: %llvmgcc %s -emit-llvm -O0 -c -o %t1.bc
-// RUN: %klee %t1.bc
+// RUN: rm -rf %t.klee-out
+// RUN: %klee --output-dir=%t.klee-out %t1.bc
 
 #include <assert.h>
 
diff --git a/test/regression/2007-08-01-bool-zext-in-call.ll b/test/regression/2007-08-01-bool-zext-in-call.ll
index fc77785d..1a4bf4f3 100644
--- a/test/regression/2007-08-01-bool-zext-in-call.ll
+++ b/test/regression/2007-08-01-bool-zext-in-call.ll
@@ -1,12 +1,6 @@
-; RUN: rm -rf %T/xxx
-;
-; The output directory must be explicitly set so that it ends up in the Output/
-; directory which is not scanned for .ll files by llvm-lit, otherwise running
-; test suite a second time will cause problems because assembly.ll generated by
-; executing this test case the first time will be detected as a test case.
-;
-; RUN: llvm-as -f %s -o - | %klee --output-dir=%T/xxx
-; RUN: not test -f %T/xxx/klee-last/test0001.abort.err
+; RUN: rm -rf %t.klee-out
+; RUN: llvm-as -f %s -o - | %klee --output-dir=%t.klee-out
+; RUN: not test -f %t.klee-out/test0001.abort.err
 
 declare void @klee_abort()
 
diff --git a/test/regression/2007-08-01-cache-unclear-on-overwrite-flushed.c b/test/regression/2007-08-01-cache-unclear-on-overwrite-flushed.c
index 15f4e90e..0aa20896 100644
--- a/test/regression/2007-08-01-cache-unclear-on-overwrite-flushed.c
+++ b/test/regression/2007-08-01-cache-unclear-on-overwrite-flushed.c
@@ -1,5 +1,6 @@
 // RUN: %llvmgcc %s -emit-llvm -O0 -c -o %t1.bc
-// RUN: %klee %t1.bc
+// RUN: rm -rf %t.klee-out
+// RUN: %klee --output-dir=%t.klee-out %t1.bc
 
 #include <assert.h>
 #include <stdio.h>
diff --git a/test/regression/2007-08-06-64bit-shift.c b/test/regression/2007-08-06-64bit-shift.c
index 958e56c0..ac282dbd 100644
--- a/test/regression/2007-08-06-64bit-shift.c
+++ b/test/regression/2007-08-06-64bit-shift.c
@@ -1,5 +1,6 @@
 // RUN: %llvmgcc %s -emit-llvm -O0 -c -o %t1.bc
-// RUN: %klee %t1.bc
+// RUN: rm -rf %t.klee-out
+// RUN: %klee --output-dir=%t.klee-out %t1.bc
 
 #include <assert.h>
 
diff --git a/test/regression/2007-08-06-access-after-free.c b/test/regression/2007-08-06-access-after-free.c
index a1812062..ae80b8b8 100644
--- a/test/regression/2007-08-06-access-after-free.c
+++ b/test/regression/2007-08-06-access-after-free.c
@@ -1,5 +1,6 @@
 // RUN: %llvmgcc %s -emit-llvm -O0 -c -o %t1.bc
-// RUN: %klee %t1.bc
+// RUN: rm -rf %t.klee-out
+// RUN: %klee --output-dir=%t.klee-out %t1.bc
 
 #include <assert.h>
 
diff --git a/test/regression/2007-08-08-free-zero.c b/test/regression/2007-08-08-free-zero.c
index 935b04fd..3718f3cf 100644
--- a/test/regression/2007-08-08-free-zero.c
+++ b/test/regression/2007-08-08-free-zero.c
@@ -1,6 +1,7 @@
 // RUN: %llvmgcc %s -emit-llvm -O0 -c -o %t1.bc
-// RUN: %klee %t1.bc
-// RUN: ls %T/klee-last | not grep *.err
+// RUN: rm -rf %t.klee-out
+// RUN: %klee --output-dir=%t.klee-out %t1.bc
+// RUN: ls %t.klee-out | not grep *.err
 
 #include <stdlib.h>
 
diff --git a/test/regression/2007-08-16-invalid-constant-value.c b/test/regression/2007-08-16-invalid-constant-value.c
index ea0a5fee..e0b304f4 100644
--- a/test/regression/2007-08-16-invalid-constant-value.c
+++ b/test/regression/2007-08-16-invalid-constant-value.c
@@ -2,7 +2,8 @@
 // RUN: %llvmgcc %s -emit-llvm -O2 -c -o %t1.bc
 // RUN: llvm-as -f %p/../Feature/_utils._ll -o %t2.bc
 // RUN: llvm-link %t1.bc %t2.bc -o %t3.bc
-// RUN: %klee %t3.bc
+// RUN: rm -rf %t.klee-out
+// RUN: %klee --output-dir=%t.klee-out %t3.bc
 
 #include <assert.h>
 
diff --git a/test/regression/2007-08-16-valid-write-to-freed-object.c b/test/regression/2007-08-16-valid-write-to-freed-object.c
index 472b7de8..1fca1cca 100644
--- a/test/regression/2007-08-16-valid-write-to-freed-object.c
+++ b/test/regression/2007-08-16-valid-write-to-freed-object.c
@@ -1,5 +1,6 @@
 // RUN: %llvmgcc %s -emit-llvm -O0 -c -o %t1.bc
-// RUN: %klee %t1.bc
+// RUN: rm -rf %t.klee-out
+// RUN: %klee --output-dir=%t.klee-out %t1.bc
 
 unsigned sym() {
   unsigned x;
diff --git a/test/regression/2007-10-11-free-of-alloca.c b/test/regression/2007-10-11-free-of-alloca.c
index 44a9ed4e..cfd633dc 100644
--- a/test/regression/2007-10-11-free-of-alloca.c
+++ b/test/regression/2007-10-11-free-of-alloca.c
@@ -1,10 +1,11 @@
 // RUN: %llvmgcc %s -g -emit-llvm -O0 -c -o %t1.bc
-// RUN: %klee %t1.bc 2>&1 | FileCheck %s
-// RUN: test -f %T/klee-last/test000001.free.err
+// RUN: rm -rf %t.klee-out
+// RUN: %klee --output-dir=%t.klee-out %t1.bc 2>&1 | FileCheck %s
+// RUN: test -f %t.klee-out/test000001.free.err
 
 int main() {
   int buf[4];
-  // CHECK: 2007-10-11-free-of-alloca.c:8: free of alloca
+  // CHECK: 2007-10-11-free-of-alloca.c:9: free of alloca
   free(buf); // this should give runtime error, not crash
   return 0;
 }
diff --git a/test/regression/2007-10-11-illegal-access-after-free-and-branch.c b/test/regression/2007-10-11-illegal-access-after-free-and-branch.c
index 73b3ed3f..c5cffa36 100644
--- a/test/regression/2007-10-11-illegal-access-after-free-and-branch.c
+++ b/test/regression/2007-10-11-illegal-access-after-free-and-branch.c
@@ -1,6 +1,7 @@
 // RUN: %llvmgcc %s -emit-llvm -g -c -o %t1.bc
-// RUN: %klee --optimize %t1.bc 2>&1 | FileCheck %s
-// RUN: test -f %T/klee-last/test000001.ptr.err
+// RUN: rm -rf %t.klee-out
+// RUN: %klee --output-dir=%t.klee-out --optimize %t1.bc 2>&1 | FileCheck %s
+// RUN: test -f %t.klee-out/test000001.ptr.err
 
 #include <stdlib.h>
 #include <stdio.h>
@@ -14,7 +15,7 @@ int main(int argc, char **argv) {
   free(buf);
   if (x)
   {
-    // CHECK: 2007-10-11-illegal-access-after-free-and-branch.c:18: memory error: out of bound pointer
+    // CHECK: 2007-10-11-illegal-access-after-free-and-branch.c:19: memory error: out of bound pointer
     return buf[2];
   }
   klee_silent_exit(0);
diff --git a/test/regression/2007-10-12-failed-make-symbolic-after-copy.c b/test/regression/2007-10-12-failed-make-symbolic-after-copy.c
index bfe61f2c..800b57e7 100644
--- a/test/regression/2007-10-12-failed-make-symbolic-after-copy.c
+++ b/test/regression/2007-10-12-failed-make-symbolic-after-copy.c
@@ -1,6 +1,7 @@
 // RUN: %llvmgcc %s -emit-llvm -O0 -c -o %t1.bc
-// RUN: %klee %t1.bc
-// RUN: test -f %T/klee-last/test000001.ktest
+// RUN: rm -rf %t.klee-out
+// RUN: %klee --output-dir=%t.klee-out %t1.bc
+// RUN: test -f %t.klee-out/test000001.ktest
 
 int main() {
   unsigned x, y[4];
diff --git a/test/regression/2008-03-04-free-of-global.c b/test/regression/2008-03-04-free-of-global.c
index 5351128d..3416fd61 100644
--- a/test/regression/2008-03-04-free-of-global.c
+++ b/test/regression/2008-03-04-free-of-global.c
@@ -1,11 +1,12 @@
 // RUN: %llvmgcc %s -g -emit-llvm -O0 -c -o %t1.bc
-// RUN: %klee %t1.bc 2>&1 | FileCheck %s
-// RUN: test -f %T/klee-last/test000001.free.err
+// RUN: rm -rf %t.klee-out
+// RUN: %klee --output-dir=%t.klee-out %t1.bc 2>&1 | FileCheck %s
+// RUN: test -f %t.klee-out/test000001.free.err
 
 int buf[4];
 
 int main() {
-  // CHECK: 2008-03-04-free-of-global.c:9: free of global
+  // CHECK: 2008-03-04-free-of-global.c:10: free of global
   free(buf); // this should give runtime error, not crash
   return 0;
 }
diff --git a/test/regression/2008-03-11-free-of-malloc-zero.c b/test/regression/2008-03-11-free-of-malloc-zero.c
index d096818b..07ec2918 100644
--- a/test/regression/2008-03-11-free-of-malloc-zero.c
+++ b/test/regression/2008-03-11-free-of-malloc-zero.c
@@ -1,5 +1,6 @@
 // RUN: %llvmgcc %s -emit-llvm -O0 -c -o %t1.bc
-// RUN: %klee --exit-on-error %t1.bc
+// RUN: rm -rf %t.klee-out
+// RUN: %klee --output-dir=%t.klee-out --exit-on-error %t1.bc
 
 #include <stdlib.h>
 
diff --git a/test/regression/2008-04-10-bad-alloca-free.c b/test/regression/2008-04-10-bad-alloca-free.c
index a6215f64..3404a42e 100644
--- a/test/regression/2008-04-10-bad-alloca-free.c
+++ b/test/regression/2008-04-10-bad-alloca-free.c
@@ -1,5 +1,6 @@
 // RUN: %llvmgcc %s -emit-llvm -O0 -c -o %t1.bc
-// RUN: %klee --exit-on-error %t1.bc
+// RUN: rm -rf %t.klee-out
+// RUN: %klee --output-dir=%t.klee-out --exit-on-error %t1.bc
 
 void f(int *addr) {
   klee_make_symbolic(addr, sizeof *addr, "moo");
diff --git a/test/regression/2008-05-23-gep-with-global-const.c b/test/regression/2008-05-23-gep-with-global-const.c
index 3ad9b24e..6bd78dd2 100644
--- a/test/regression/2008-05-23-gep-with-global-const.c
+++ b/test/regression/2008-05-23-gep-with-global-const.c
@@ -1,5 +1,6 @@
 // RUN: %llvmgcc -emit-llvm -O0 -c -o %t.bc %s
-// RUN: %klee --exit-on-error %t.bc
+// RUN: rm -rf %t.klee-out
+// RUN: %klee --output-dir=%t.klee-out --exit-on-error %t.bc
 
 #include <assert.h>
 
diff --git a/test/regression/2012-05-13-asm-causes-aborts.c b/test/regression/2012-05-13-asm-causes-aborts.c
index 6622d02b..322e5bb8 100644
--- a/test/regression/2012-05-13-asm-causes-aborts.c
+++ b/test/regression/2012-05-13-asm-causes-aborts.c
@@ -1,5 +1,6 @@
 // RUN: %llvmgcc %s -emit-llvm -O0 -c -o %t1.bc
-// RUN: %klee %t1.bc
+// RUN: rm -rf %t.klee-out
+// RUN: %klee --output-dir=%t.klee-out %t1.bc
 
 int main(int argc, char *argv[]){
 	__asm__ __volatile__ ("movl %eax, %eax");
diff --git a/test/regression/2014-07-04-unflushed-error-report.c b/test/regression/2014-07-04-unflushed-error-report.c
index 63431370..0518fb4d 100644
--- a/test/regression/2014-07-04-unflushed-error-report.c
+++ b/test/regression/2014-07-04-unflushed-error-report.c
@@ -1,6 +1,7 @@
 // RUN: %llvmgcc %s -emit-llvm -g -O0 -c -o %t.bc
-// RUN: %klee -check-overshift %t.bc 2> %t.log
-// RUN: FileCheck -input-file=%T/klee-last/test000001.overshift.err %s
+// RUN: rm -rf %t.klee-out
+// RUN: %klee --output-dir=%t.klee-out -check-overshift %t.bc 2> %t.log
+// RUN: FileCheck -input-file=%t.klee-out/test000001.overshift.err %s
 
 /* This test checks that the error file isn't empty and contains the
  * right content.
@@ -18,7 +19,7 @@ int main()
   // CHECK-NEXT: 2014-07-04-unflushed-error-report.c
   // FIXME: Need newer FileCheck for to do ``Line: [[@LINE+1]]``
   // Just hardcode line number for now
-  // CHECK-NEXT: Line: 22
+  // CHECK-NEXT: Line: 23
   result = x << y;
 
   return 0;