diff options
author | Cristian Cadar <c.cadar@imperial.ac.uk> | 2014-01-21 05:41:25 -0800 |
---|---|---|
committer | Cristian Cadar <c.cadar@imperial.ac.uk> | 2014-01-21 05:41:25 -0800 |
commit | e49c1e1958e863195b01d99c92194289b4034bbb (patch) | |
tree | ee305c933ea7b653f769fe209601ca963938e16d | |
parent | f626bdb1905c4d56fdcca04cd6ee84acb7597431 (diff) | |
parent | ebc387f1181ca39cd72fe8ef27a535cd0c674bcf (diff) | |
download | klee-e49c1e1958e863195b01d99c92194289b4034bbb.tar.gz |
Merge pull request #92 from delcypher/fix_llvm-lit
Move testing infrastructure to llvm-lit and completly remove all DejaGNU support
73 files changed, 368 insertions, 827 deletions
diff --git a/.gitignore b/.gitignore index fb468a14..ba543c8a 100644 --- a/.gitignore +++ b/.gitignore @@ -12,7 +12,9 @@ cscope.* *.status *.config -*.cfg config.h site.exp + +# Site file for llvm-lit +lit.site.cfg diff --git a/autoconf/configure.ac b/autoconf/configure.ac index 5a47e924..af5affc0 100644 --- a/autoconf/configure.ac +++ b/autoconf/configure.ac @@ -564,11 +564,6 @@ else AC_SUBST(REQUIRES_RTTI,[[1]]) fi -dnl ************************************************************************** -dnl * Check for dejagnu -dnl ************************************************************************** -AC_PATH_PROG(RUNTEST, [runtest]) -DJ_AC_PATH_TCLSH dnl ************************************************************************** dnl * Create the output files diff --git a/autoconf/m4/path_tclsh.m4 b/autoconf/m4/path_tclsh.m4 deleted file mode 100644 index 85433de7..00000000 --- a/autoconf/m4/path_tclsh.m4 +++ /dev/null @@ -1,39 +0,0 @@ -dnl This macro checks for tclsh which is required to run dejagnu. On some -dnl platforms (notably FreeBSD), tclsh is named tclshX.Y - this handles -dnl that for us so we can get the latest installed tclsh version. -dnl -AC_DEFUN([DJ_AC_PATH_TCLSH], [ -no_itcl=true -AC_MSG_CHECKING(for the tclsh program in tclinclude directory) -AC_ARG_WITH(tclinclude, - AS_HELP_STRING([--with-tclinclude], - [directory where tcl headers are]), - [with_tclinclude=${withval}],[with_tclinclude='']) -AC_CACHE_VAL(ac_cv_path_tclsh,[ -dnl first check to see if --with-itclinclude was specified -if test x"${with_tclinclude}" != x ; then - if test -f ${with_tclinclude}/tclsh ; then - ac_cv_path_tclsh=`(cd ${with_tclinclude}; pwd)` - elif test -f ${with_tclinclude}/src/tclsh ; then - ac_cv_path_tclsh=`(cd ${with_tclinclude}/src; pwd)` - else - AC_MSG_ERROR([${with_tclinclude} directory doesn't contain tclsh]) - fi -fi]) - -dnl see if one is installed -if test x"${ac_cv_path_tclsh}" = x ; then - AC_MSG_RESULT(none) - AC_PATH_PROGS([TCLSH],[tclsh8.4 tclsh8.4.8 tclsh8.4.7 tclsh8.4.6 tclsh8.4.5 tclsh8.4.4 tclsh8.4.3 tclsh8.4.2 tclsh8.4.1 tclsh8.4.0 tclsh8.3 tclsh8.3.5 tclsh8.3.4 tclsh8.3.3 tclsh8.3.2 tclsh8.3.1 tclsh8.3.0 tclsh]) - if test x"${TCLSH}" = x ; then - ac_cv_path_tclsh=''; - else - ac_cv_path_tclsh="${TCLSH}"; - fi -else - AC_MSG_RESULT(${ac_cv_path_tclsh}) - TCLSH="${ac_cv_path_tclsh}" - AC_SUBST(TCLSH) -fi -]) - diff --git a/configure b/configure index 85e7fec2..d343ac69 100755 --- a/configure +++ b/configure @@ -624,8 +624,6 @@ ac_includes_default="\ ac_subst_vars='LTLIBOBJS LIBOBJS -TCLSH -RUNTEST METASMT_ROOT ENABLE_METASMT STP_ROOT @@ -728,7 +726,6 @@ enable_posix_runtime with_runtime with_stp with_metasmt -with_tclinclude ' ac_precious_vars='build_alias host_alias @@ -1379,7 +1376,6 @@ Optional Packages: (default [Release+Asserts]) --with-stp Location of STP installation directory --with-metasmt Location of metaSMT installation directory - --with-tclinclude directory where tcl headers are Some influential environment variables: CC C compiler command @@ -4994,134 +4990,6 @@ $as_echo "#define SUPPORT_METASMT 1" >>confdefs.h fi -# Extract the first word of "runtest", so it can be a program name with args. -set dummy runtest; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_path_RUNTEST+:} false; then : - $as_echo_n "(cached) " >&6 -else - case $RUNTEST in - [\\/]* | ?:[\\/]*) - ac_cv_path_RUNTEST="$RUNTEST" # Let the user override the test with a path. - ;; - *) - as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_path_RUNTEST="$as_dir/$ac_word$ac_exec_ext" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - - ;; -esac -fi -RUNTEST=$ac_cv_path_RUNTEST -if test -n "$RUNTEST"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $RUNTEST" >&5 -$as_echo "$RUNTEST" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - - -no_itcl=true -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for the tclsh program in tclinclude directory" >&5 -$as_echo_n "checking for the tclsh program in tclinclude directory... " >&6; } - -# Check whether --with-tclinclude was given. -if test "${with_tclinclude+set}" = set; then : - withval=$with_tclinclude; with_tclinclude=${withval} -else - with_tclinclude='' -fi - -if ${ac_cv_path_tclsh+:} false; then : - $as_echo_n "(cached) " >&6 -else - -if test x"${with_tclinclude}" != x ; then - if test -f ${with_tclinclude}/tclsh ; then - ac_cv_path_tclsh=`(cd ${with_tclinclude}; pwd)` - elif test -f ${with_tclinclude}/src/tclsh ; then - ac_cv_path_tclsh=`(cd ${with_tclinclude}/src; pwd)` - else - as_fn_error $? "${with_tclinclude} directory doesn't contain tclsh" "$LINENO" 5 - fi -fi -fi - - -if test x"${ac_cv_path_tclsh}" = x ; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: none" >&5 -$as_echo "none" >&6; } - for ac_prog in tclsh8.4 tclsh8.4.8 tclsh8.4.7 tclsh8.4.6 tclsh8.4.5 tclsh8.4.4 tclsh8.4.3 tclsh8.4.2 tclsh8.4.1 tclsh8.4.0 tclsh8.3 tclsh8.3.5 tclsh8.3.4 tclsh8.3.3 tclsh8.3.2 tclsh8.3.1 tclsh8.3.0 tclsh -do - # Extract the first word of "$ac_prog", so it can be a program name with args. -set dummy $ac_prog; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_path_TCLSH+:} false; then : - $as_echo_n "(cached) " >&6 -else - case $TCLSH in - [\\/]* | ?:[\\/]*) - ac_cv_path_TCLSH="$TCLSH" # Let the user override the test with a path. - ;; - *) - as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_path_TCLSH="$as_dir/$ac_word$ac_exec_ext" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - - ;; -esac -fi -TCLSH=$ac_cv_path_TCLSH -if test -n "$TCLSH"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $TCLSH" >&5 -$as_echo "$TCLSH" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - - test -n "$TCLSH" && break -done - - if test x"${TCLSH}" = x ; then - ac_cv_path_tclsh=''; - else - ac_cv_path_tclsh="${TCLSH}"; - fi -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: ${ac_cv_path_tclsh}" >&5 -$as_echo "${ac_cv_path_tclsh}" >&6; } - TCLSH="${ac_cv_path_tclsh}" - -fi - ac_config_commands="$ac_config_commands Makefile" diff --git a/test/CXX/dg.exp b/test/CXX/dg.exp deleted file mode 100644 index 879685ca..00000000 --- a/test/CXX/dg.exp +++ /dev/null @@ -1,3 +0,0 @@ -load_lib llvm.exp - -RunLLVMTests [lsort [glob -nocomplain $srcdir/$subdir/*.{ll,llx,c,cpp,tr}]] diff --git a/test/Concrete/lit.local.cfg b/test/Concrete/lit.local.cfg new file mode 100644 index 00000000..b882827d --- /dev/null +++ b/test/Concrete/lit.local.cfg @@ -0,0 +1,3 @@ +# FIXME: Why are these here +# Disable all tests in this directory +config.suffixes = [ ] diff --git a/test/Coverage/ReadArgs.c b/test/Coverage/ReadArgs.c index 7ebf056e..ddfb1747 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 xxx -// RUN: echo " --output-dir=xxx " > %t1.args +// RUN: rm -rf %T/xxx +// RUN: echo " --output-dir=%T/xxx " > %t1.args // RUN: %klee --read-args %t1.args %t1.bc -// RUN: test -d xxx +// RUN: test -d %T/xxx int main() { return 0; diff --git a/test/Coverage/dg.exp b/test/Coverage/dg.exp deleted file mode 100644 index 879685ca..00000000 --- a/test/Coverage/dg.exp +++ /dev/null @@ -1,3 +0,0 @@ -load_lib llvm.exp - -RunLLVMTests [lsort [glob -nocomplain $srcdir/$subdir/*.{ll,llx,c,cpp,tr}]] diff --git a/test/Dogfood/dg.exp b/test/Dogfood/dg.exp deleted file mode 100644 index 879685ca..00000000 --- a/test/Dogfood/dg.exp +++ /dev/null @@ -1,3 +0,0 @@ -load_lib llvm.exp - -RunLLVMTests [lsort [glob -nocomplain $srcdir/$subdir/*.{ll,llx,c,cpp,tr}]] diff --git a/test/Expr/Lexer/dg.exp b/test/Expr/Lexer/dg.exp deleted file mode 100644 index 94fc4df8..00000000 --- a/test/Expr/Lexer/dg.exp +++ /dev/null @@ -1,3 +0,0 @@ -load_lib llvm.exp - -RunLLVMTests [lsort [glob -nocomplain $srcdir/$subdir/*.{pc}]] diff --git a/test/Expr/Parser/ConstantFolding.pc b/test/Expr/Parser/ConstantFolding.pc index 2c8a4c52..a02920db 100644 --- a/test/Expr/Parser/ConstantFolding.pc +++ b/test/Expr/Parser/ConstantFolding.pc @@ -2,196 +2,196 @@ array a[64] : w32 -> w8 = symbolic -# RUN: grep -A 2 \"# Query 1$\" %t > %t2 -# RUN: grep \"(query .. false)\" %t2 +# RUN: grep -A 2 "# Query 1$" %t > %t2 +# RUN: grep "(query .. false)" %t2 (query [] (Not (Ult (w32 0) (w32 1)))) # Check -- 0 + X ==> X -# RUN: grep -A 2 \"# Query 2$\" %t > %t2 -# RUN: grep \"(query .. false .(Read w8 0 a).)\" %t2 +# RUN: grep -A 2 "# Query 2$" %t > %t2 +# RUN: grep "(query .. false .(Read w8 0 a).)" %t2 (query [] false [(Add w8 0 (Read w8 0 a))]) -# RUN: grep -A 2 \"# Query 3$\" %t > %t2 -# RUN: grep \"(query .. false .(Read w8 0 a).)\" %t2 +# RUN: grep -A 2 "# Query 3$" %t > %t2 +# RUN: grep "(query .. false .(Read w8 0 a).)" %t2 (query [] false [(Add w8 (Read w8 0 a) 0)]) # Check -- C_0 + (C_1 + X) ==> (C_0 + C_1) + X -# RUN: grep -A 2 \"# Query 4$\" %t > %t2 -# RUN: grep \"(query .. false .(Add w8 30 (Read w8 0 a)).)\" %t2 +# RUN: grep -A 2 "# Query 4$" %t > %t2 +# RUN: grep "(query .. false .(Add w8 30 (Read w8 0 a)).)" %t2 (query [] false [(Add w8 10 (Add w8 20 (Read w8 0 a)))]) # Check -- C_0 + (X + C_1) ==> (C_0 + C_1) + X -# RUN: grep -A 2 \"# Query 5$\" %t > %t2 -# RUN: grep \"(query .. false .(Add w8 30 (Read w8 0 a)).)\" %t2 +# RUN: grep -A 2 "# Query 5$" %t > %t2 +# RUN: grep "(query .. false .(Add w8 30 (Read w8 0 a)).)" %t2 (query [] false [(Add w8 10 (Add w8 (Read w8 0 a) 20))]) # Check -- C_0 + (C_1 - X) ==> (C_0 + C_1) - X -# RUN: grep -A 2 \"# Query 6$\" %t > %t2 -# RUN: grep \"(query .. false .(Sub w8 30 (Read w8 0 a)).)\" %t2 +# RUN: grep -A 2 "# Query 6$" %t > %t2 +# RUN: grep "(query .. false .(Sub w8 30 (Read w8 0 a)).)" %t2 (query [] false [(Add w8 10 (Sub w8 20 (Read w8 0 a)))]) # Check -- C_0 + (X - C_1) ==> (C_0 - C_1) + X -# RUN: grep -A 2 \"# Query 7$\" %t > %t2 -# RUN: grep \"(query .. false .(Add w8 246 (Read w8 0 a)).)\" %t2 +# RUN: grep -A 2 "# Query 7$" %t > %t2 +# RUN: grep "(query .. false .(Add w8 246 (Read w8 0 a)).)" %t2 (query [] false [(Add w8 10 (Sub w8 (Read w8 0 a) 20))]) # Check -- (X + Y) + Z ==> X + (Y + Z) -# RUN: grep -A 3 \"# Query 8$\" %t > %t2 -# RUN: grep \"(query .. false .(Add w8 (Read w8 0 a)\" %t2 -# RUN: grep \"(Add w8 (Read w8 1 a) (Read w8 2 a)\" %t2 +# RUN: grep -A 3 "# Query 8$" %t > %t2 +# RUN: grep "(query .. false .(Add w8 (Read w8 0 a)" %t2 +# RUN: grep "(Add w8 (Read w8 1 a) (Read w8 2 a)" %t2 (query [] false [(Add w8 (Add w8 (Read w8 0 a) (Read w8 1 a)) (Read w8 2 a))]) # Check -- (X - Y) + Z ==> X + (Z - Y) -# RUN: grep -A 3 \"# Query 9$\" %t > %t2 -# RUN: grep \"(query .. false .(Add w8 (Read w8 0 a)\" %t2 -# RUN: grep \"(Sub w8 (Read w8 2 a) (Read w8 1 a)\" %t2 +# RUN: grep -A 3 "# Query 9$" %t > %t2 +# RUN: grep "(query .. false .(Add w8 (Read w8 0 a)" %t2 +# RUN: grep "(Sub w8 (Read w8 2 a) (Read w8 1 a)" %t2 (query [] false [(Add w8 (Sub w8 (Read w8 0 a) (Read w8 1 a)) (Read w8 2 a))]) # Check -- X + (C + Y) ==> C + (X + Y) -# RUN: grep -A 3 \"# Query 10$\" %t > %t2 -# RUN: grep \"(query .. false .(Add w8 10\" %t2 -# RUN: grep \"(Add w8 (Read w8 0 a) (Read w8 1 a)\" %t2 +# RUN: grep -A 3 "# Query 10$" %t > %t2 +# RUN: grep "(query .. false .(Add w8 10" %t2 +# RUN: grep "(Add w8 (Read w8 0 a) (Read w8 1 a)" %t2 (query [] false [(Add w8 (Read w8 0 a) (Add w8 10 (Read w8 1 a)))]) # Check -- X + (Y + C) ==> C + (X + Y) -# RUN: grep -A 3 \"# Query 11$\" %t > %t2 -# RUN: grep \"(query .. false .(Add w8 10\" %t2 -# RUN: grep \"(Add w8 (Read w8 0 a) (Read w8 1 a)\" %t2 +# RUN: grep -A 3 "# Query 11$" %t > %t2 +# RUN: grep "(query .. false .(Add w8 10" %t2 +# RUN: grep "(Add w8 (Read w8 0 a) (Read w8 1 a)" %t2 (query [] false [(Add w8 (Read w8 0 a) (Add w8 (Read w8 1 a) 10))]) # Check -- X + (C - Y) ==> C + (X - Y) -# RUN: grep -A 3 \"# Query 12$\" %t > %t2 -# RUN: grep \"(query .. false .(Add w8 10\" %t2 -# RUN: grep \"(Sub w8 (Read w8 0 a) (Read w8 1 a)\" %t2 +# RUN: grep -A 3 "# Query 12$" %t > %t2 +# RUN: grep "(query .. false .(Add w8 10" %t2 +# RUN: grep "(Sub w8 (Read w8 0 a) (Read w8 1 a)" %t2 (query [] false [(Add w8 (Read w8 0 a) (Sub w8 10 (Read w8 1 a)))]) # Check -- X + (Y - C) ==> -C + (X + Y) -# RUN: grep -A 3 \"# Query 13$\" %t > %t2 -# RUN: grep \"(query .. false .(Add w8 246\" %t2 -# RUN: grep \"(Add w8 (Read w8 0 a) (Read w8 1 a)\" %t2 +# RUN: grep -A 3 "# Query 13$" %t > %t2 +# RUN: grep "(query .. false .(Add w8 246" %t2 +# RUN: grep "(Add w8 (Read w8 0 a) (Read w8 1 a)" %t2 (query [] false [(Add w8 (Read w8 0 a) (Sub w8 (Read w8 1 a) 10))]) # Check -- C_0 - (C_1 + X) ==> (C_0 - C1) - X -# RUN: grep -A 2 \"# Query 14$\" %t > %t2 -# RUN: grep \"(query .. false .(Sub w8 10 (Read w8 0 a))\" %t2 +# RUN: grep -A 2 "# Query 14$" %t > %t2 +# RUN: grep "(query .. false .(Sub w8 10 (Read w8 0 a))" %t2 (query [] false [(Sub w8 20 (Add w8 10 (Read w8 0 a)))]) # Check -- C_0 - (X + C_1) ==> (C_0 + C1) + X -# RUN: grep -A 2 \"# Query 15$\" %t > %t2 -# RUN: grep \"(query .. false .(Sub w8 10 (Read w8 0 a))\" %t2 +# RUN: grep -A 2 "# Query 15$" %t > %t2 +# RUN: grep "(query .. false .(Sub w8 10 (Read w8 0 a))" %t2 (query [] false [(Sub w8 20 (Add w8 (Read w8 0 a) 10))]) # Check -- C_0 - (C_1 - X) ==> (C_0 - C1) + X -# RUN: grep -A 2 \"# Query 16$\" %t > %t2 -# RUN: grep \"(query .. false .(Add w8 10 (Read w8 0 a))\" %t2 +# RUN: grep -A 2 "# Query 16$" %t > %t2 +# RUN: grep "(query .. false .(Add w8 10 (Read w8 0 a))" %t2 (query [] false [(Sub w8 20 (Sub w8 10 (Read w8 0 a)))]) # Check -- C_0 - (X - C_1) ==> (C_0 + C1) - X -# RUN: grep -A 2 \"# Query 17$\" %t > %t2 -# RUN: grep \"(query .. false .(Sub w8 30 (Read w8 0 a))\" %t2 +# RUN: grep -A 2 "# Query 17$" %t > %t2 +# RUN: grep "(query .. false .(Sub w8 30 (Read w8 0 a))" %t2 (query [] false [(Sub w8 20 (Sub w8 (Read w8 0 a) 10))]) # Check -- (C_0 + X) - C_1 ==> (C_0 - C1) + X -# RUN: grep -A 2 \"# Query 18$\" %t > %t2 -# RUN: grep \"(query .. false .(Add w8 246 (Read w8 0 a))\" %t2 +# RUN: grep -A 2 "# Query 18$" %t > %t2 +# RUN: grep "(query .. false .(Add w8 246 (Read w8 0 a))" %t2 (query [] false [(Sub w8 (Add w8 10 (Read w8 0 a)) 20)]) # Check -- (X + C_0) - C_1 ==> (C_0 - C1) + X -# RUN: grep -A 2 \"# Query 19$\" %t > %t2 -# RUN: grep \"(query .. false .(Add w8 246 (Read w8 0 a))\" %t2 +# RUN: grep -A 2 "# Query 19$" %t > %t2 +# RUN: grep "(query .. false .(Add w8 246 (Read w8 0 a))" %t2 (query [] false [(Sub w8 (Add w8 (Read w8 0 a) 10) 20)]) # Check -- (C_0 - X) - C_1 ==> (C_0 - C1) - X -# RUN: grep -A 2 \"# Query 20$\" %t > %t2 -# RUN: grep \"(query .. false .(Sub w8 246 (Read w8 0 a))\" %t2 +# RUN: grep -A 2 "# Query 20$" %t > %t2 +# RUN: grep "(query .. false .(Sub w8 246 (Read w8 0 a))" %t2 (query [] false [(Sub w8 (Sub w8 10 (Read w8 0 a)) 20)]) # Check -- (X - C_0) - C_1 ==> -(C_0 + C1) + X -# RUN: grep -A 2 \"# Query 21$\" %t > %t2 -# RUN: grep \"(query .. false .(Add w8 226 (Read w8 0 a))\" %t2 +# RUN: grep -A 2 "# Query 21$" %t > %t2 +# RUN: grep "(query .. false .(Add w8 226 (Read w8 0 a))" %t2 (query [] false [(Sub w8 (Sub w8 (Read w8 0 a) 10) 20)]) # Check -- (X + Y) - Z ==> X + (Y - Z) -# RUN: grep -A 3 \"# Query 22$\" %t > %t2 -# RUN: grep \"(query .. false .(Add w8 (Read w8 0 a)\" %t2 -# RUN: grep \"(Sub w8 (Read w8 1 a) (Read w8 2 a)\" %t2 +# RUN: grep -A 3 "# Query 22$" %t > %t2 +# RUN: grep "(query .. false .(Add w8 (Read w8 0 a)" %t2 +# RUN: grep "(Sub w8 (Read w8 1 a) (Read w8 2 a)" %t2 (query [] false [(Sub w8 (Add w8 (Read w8 0 a) (Read w8 1 a)) (Read w8 2 a))]) # Check -- (X - Y) - Z ==> X - (Y + Z) -# RUN: grep -A 3 \"# Query 23$\" %t > %t2 -# RUN: grep \"(query .. false .(Sub w8 (Read w8 0 a)\" %t2 -# RUN: grep \"(Add w8 (Read w8 1 a) (Read w8 2 a)\" %t2 +# RUN: grep -A 3 "# Query 23$" %t > %t2 +# RUN: grep "(query .. false .(Sub w8 (Read w8 0 a)" %t2 +# RUN: grep "(Add w8 (Read w8 1 a) (Read w8 2 a)" %t2 (query [] false [(Sub w8 (Sub w8 (Read w8 0 a) (Read w8 1 a)) (Read w8 2 a))]) # Check -- X - (C + Y) ==> -C + (X - Y) -# RUN: grep -A 3 \"# Query 24$\" %t > %t2 -# RUN: grep \"(query .. false .(Add w8 246\" %t2 -# RUN: grep \"(Sub w8 (Read w8 0 a) (Read w8 1 a)\" %t2 +# RUN: grep -A 3 "# Query 24$" %t > %t2 +# RUN: grep "(query .. false .(Add w8 246" %t2 +# RUN: grep "(Sub w8 (Read w8 0 a) (Read w8 1 a)" %t2 (query [] false [(Sub w8 (Read w8 0 a) (Add w8 10 (Read w8 1 a)))]) # Check -- X - (Y + C) ==> -C + (X - Y) -# RUN: grep -A 3 \"# Query 25$\" %t > %t2 -# RUN: grep \"(query .. false .(Add w8 246\" %t2 -# RUN: grep \"(Sub w8 (Read w8 0 a) (Read w8 1 a)\" %t2 +# RUN: grep -A 3 "# Query 25$" %t > %t2 +# RUN: grep "(query .. false .(Add w8 246" %t2 +# RUN: grep "(Sub w8 (Read w8 0 a) (Read w8 1 a)" %t2 (query [] false [(Sub w8 (Read w8 0 a) (Add w8 (Read w8 1 a) 10))]) # Check -- X - (C - Y) ==> -C + (X + Y) -# RUN: grep -A 3 \"# Query 26$\" %t > %t2 -# RUN: grep \"(query .. false .(Add w8 246\" %t2 -# RUN: grep \"(Add w8 (Read w8 0 a) (Read w8 1 a)\" %t2 +# RUN: grep -A 3 "# Query 26$" %t > %t2 +# RUN: grep "(query .. false .(Add w8 246" %t2 +# RUN: grep "(Add w8 (Read w8 0 a) (Read w8 1 a)" %t2 (query [] false [(Sub w8 (Read w8 0 a) (Sub w8 10 (Read w8 1 a)))]) # Check -- X - (Y - C) ==> C + (X - Y) -# RUN: grep -A 3 \"# Query 27$\" %t > %t2 -# RUN: grep \"(query .. false .(Add w8 10\" %t2 -# RUN: grep \"(Sub w8 (Read w8 0 a) (Read w8 1 a)\" %t2 +# RUN: grep -A 3 "# Query 27$" %t > %t2 +# RUN: grep "(query .. false .(Add w8 10" %t2 +# RUN: grep "(Sub w8 (Read w8 0 a) (Read w8 1 a)" %t2 (query [] false [(Sub w8 (Read w8 0 a) (Sub w8 (Read w8 1 a) 10))]) # Check -- X * 0 ==> 0 -# RUN: grep -A 2 \"# Query 28$\" %t > %t2 -# RUN: grep \"(query .. false .(w8 0).\" %t2 +# RUN: grep -A 2 "# Query 28$" %t > %t2 +# RUN: grep "(query .. false .(w8 0)." %t2 (query [] false [(Mul w8 0 (Read w8 0 a))]) # Check -- X * 1 ==> X -# RUN: grep -A 2 \"# Query 29$\" %t > %t2 -# RUN: grep \"(query .. false .(Read w8 0 a).\" %t2 +# RUN: grep -A 2 "# Query 29$" %t > %t2 +# RUN: grep "(query .. false .(Read w8 0 a)." %t2 (query [] false [(Mul w8 1 (Read w8 0 a))]) # Check -- X & 0 ==> 0 -# RUN: grep -A 2 \"# Query 30$\" %t > %t2 -# RUN: grep \"(query .. false .(w8 0).\" %t2 +# RUN: grep -A 2 "# Query 30$" %t > %t2 +# RUN: grep "(query .. false .(w8 0)." %t2 (query [] false [(And w8 0 (Read w8 0 a))]) # Check -- X & 0b1...1 ==> X -# RUN: grep -A 2 \"# Query 31$\" %t > %t2 -# RUN: grep \"(query .. false .(Read w8 0 a).\" %t2 +# RUN: grep -A 2 "# Query 31$" %t > %t2 +# RUN: grep "(query .. false .(Read w8 0 a)." %t2 (query [] false [(And w8 255 (Read w8 0 a))]) # Check -- X | 0 ==> X -# RUN: grep -A 2 \"# Query 32$\" %t > %t2 -# RUN: grep \"(query .. false .(Read w8 0 a).\" %t2 +# RUN: grep -A 2 "# Query 32$" %t > %t2 +# RUN: grep "(query .. false .(Read w8 0 a)." %t2 (query [] false [(Or w8 0 (Read w8 0 a))]) # Check -- X | 0b1...1 ==> X -# RUN: grep -A 2 \"# Query 33$\" %t > %t2 -# RUN: grep \"(query .. false .(w8 255).\" %t2 +# RUN: grep -A 2 "# Query 33$" %t > %t2 +# RUN: grep "(query .. false .(w8 255)." %t2 (query [] false [(Or w8 255 (Read w8 0 a))]) # Check -- X ^ 0b1...1 ==> X -# RUN: grep -A 2 \"# Query 34$\" %t > %t2 -# RUN: grep \"(query .. false .(Read w8 0 a).\" %t2 +# RUN: grep -A 2 "# Query 34$" %t > %t2 +# RUN: grep "(query .. false .(Read w8 0 a)." %t2 (query [] false [(Xor w8 0 (Read w8 0 a))]) # Check -- true == X ==> X -# RUN: grep -A 2 \"# Query 35$\" %t > %t2 -# RUN: grep \"(query .. false .(Eq 0 (Read w8 0 a)).\" %t2 +# RUN: grep -A 2 "# Query 35$" %t > %t2 +# RUN: grep "(query .. false .(Eq 0 (Read w8 0 a))." %t2 (query [] false [(Eq true (Eq 0 (Read w8 0 a)))]) # Check -- !!X ==> X -# RUN: grep -A 2 \"# Query 36$\" %t > %t2 -# RUN: grep \"(query .. false .(Eq 0 (Read w8 0 a)).\" %t2 +# RUN: grep -A 2 "# Query 36$" %t > %t2 +# RUN: grep "(query .. false .(Eq 0 (Read w8 0 a))." %t2 (query [] false [(Not (Not (Eq 0 (Read w8 0 a))))]) # Check -- !Const -# RUN: grep -A 2 \"# Query 37$\" %t > %t2 -# RUN: grep \"(query .. false .true.\" %t2 +# RUN: grep -A 2 "# Query 37$" %t > %t2 +# RUN: grep "(query .. false .true." %t2 (query [] false [(Eq (Not w32 0xdeadbeef) 0x21524110)]) diff --git a/test/Expr/Parser/MultiByteReads.pc b/test/Expr/Parser/MultiByteReads.pc index ea2e7a5d..71f0288f 100644 --- a/test/Expr/Parser/MultiByteReads.pc +++ b/test/Expr/Parser/MultiByteReads.pc @@ -1,6 +1,6 @@ -# RUN: %kleaver -print-ast -pc-multibyte-reads=true %s >log -# RUN: grep -q "(ReadLSB w32 4 arr1)" log -# RUN: grep -q "(ReadMSB w32 2 arr2)" log +# RUN: %kleaver -print-ast -pc-multibyte-reads=true %s > %t.log +# RUN: grep -q "(ReadLSB w32 4 arr1)" %t.log +# RUN: grep -q "(ReadMSB w32 2 arr2)" %t.log array arr1[8] : w32 -> w8 = symbolic array arr2[8] : w32 -> w8 = symbolic diff --git a/test/Expr/Parser/Simplify.pc b/test/Expr/Parser/Simplify.pc index 1a853b16..6d817b6f 100644 --- a/test/Expr/Parser/Simplify.pc +++ b/test/Expr/Parser/Simplify.pc @@ -3,38 +3,38 @@ array a[64] : w32 -> w8 = symbolic # Check -- X u> Y ==> Y u< X -# RUN: grep -A 2 \"# Query 1\" %t > %t2 -# RUN: grep \"(query .. false .(Ult (Read w8 1 a) (Read w8 0 a)).)\" %t2 +# RUN: grep -A 2 "# Query 1" %t > %t2 +# RUN: grep "(query .. false .(Ult (Read w8 1 a) (Read w8 0 a)).)" %t2 (query [] false [(Ugt (Read w8 0 a) (Read w8 1 a))]) # Check -- X u>= Y ==> Y u<= X -# RUN: grep -A 2 \"# Query 2\" %t > %t2 -# RUN: grep \"(query .. false .(Ule (Read w8 1 a) (Read w8 0 a)).)\" %t2 +# RUN: grep -A 2 "# Query 2" %t > %t2 +# RUN: grep "(query .. false .(Ule (Read w8 1 a) (Read w8 0 a)).)" %t2 (query [] false [(Uge (Read w8 0 a) (Read w8 1 a))]) # Check -- X u> Y ==> Y u< X -# RUN: grep -A 2 \"# Query 3\" %t > %t2 -# RUN: grep \"(query .. false .(Slt (Read w8 1 a) (Read w8 0 a)).)\" %t2 +# RUN: grep -A 2 "# Query 3" %t > %t2 +# RUN: grep "(query .. false .(Slt (Read w8 1 a) (Read w8 0 a)).)" %t2 (query [] false [(Sgt (Read w8 0 a) (Read w8 1 a))]) # Check -- X u>= Y ==> Y u<= X -# RUN: grep -A 2 \"# Query 4\" %t > %t2 -# RUN: grep \"(query .. false .(Sle (Read w8 1 a) (Read w8 0 a)).)\" %t2 +# RUN: grep -A 2 "# Query 4" %t > %t2 +# RUN: grep "(query .. false .(Sle (Read w8 1 a) (Read w8 0 a)).)" %t2 (query [] false [(Sge (Read w8 0 a) (Read w8 1 a))]) # Check -- X != Y ==> !(X == Y) -# RUN: grep -A 2 \"# Query 5\" %t > %t2 -# RUN: grep \"(query .. false .(Not (Eq (Read w8 0 a) (Read w8 1 a))).)\" %t2 +# RUN: grep -A 2 "# Query 5" %t > %t2 +# RUN: grep "(query .. false .(Not (Eq (Read w8 0 a) (Read w8 1 a))).)" %t2 (query [] false [(Ne (Read w8 0 a) (Read w8 1 a))]) # Check -- !(X or Y) ==> !X and !Y -# RUN: grep -A 3 \"# Query 6$\" %t > %t2 -# RUN: grep \"(query .. false .(And (Not (Eq 0 (Read w8 0 a)))\" %t2 -# RUN: grep \"(Not (Eq 1 (Read w8 1 a))))\" %t2 +# RUN: grep -A 3 "# Query 6$" %t > %t2 +# RUN: grep "(query .. false .(And (Not (Eq 0 (Read w8 0 a)))" %t2 +# RUN: grep "(Not (Eq 1 (Read w8 1 a))))" %t2 (query [] false [(Not (Or (Eq 0 (Read w8 0 a)) (Eq 1 (Read w8 1 a))))]) # Check -- false == X ==> !X -# RUN: grep -A 2 \"# Query 7\" %t > %t2 -# RUN: grep \"(query .. false .(Not (Extract 1 (Read w8 0 a))).)\" %t2 +# RUN: grep -A 2 "# Query 7" %t > %t2 +# RUN: grep "(query .. false .(Not (Extract 1 (Read w8 0 a))).)" %t2 (query [] false [(Eq (Extract w1 1 (Read w8 0 a)) false)]) diff --git a/test/Expr/Parser/dg.exp b/test/Expr/Parser/dg.exp deleted file mode 100644 index 94fc4df8..00000000 --- a/test/Expr/Parser/dg.exp +++ /dev/null @@ -1,3 +0,0 @@ -load_lib llvm.exp - -RunLLVMTests [lsort [glob -nocomplain $srcdir/$subdir/*.{pc}]] diff --git a/test/Expr/dg.exp b/test/Expr/dg.exp deleted file mode 100644 index 94fc4df8..00000000 --- a/test/Expr/dg.exp +++ /dev/null @@ -1,3 +0,0 @@ -load_lib llvm.exp - -RunLLVMTests [lsort [glob -nocomplain $srcdir/$subdir/*.{pc}]] diff --git a/test/Feature/AsmAddresses.c b/test/Feature/AsmAddresses.c index a58fc059..d0b89ef1 100644 --- a/test/Feature/AsmAddresses.c +++ b/test/Feature/AsmAddresses.c @@ -1,6 +1,6 @@ -// RUN: %llvmgcc -g -c -o %t.bc %s +// RUN: %llvmgcc -emit-llvm -g -c -o %t.bc %s // RUN: %klee --exit-on-error --use-asm-addresses %t.bc -// RUN: %llvmgcc -DOVERLAP -g -c -o %t.bc %s +// RUN: %llvmgcc -emit-llvm -DOVERLAP -g -c -o %t.bc %s // RUN: not %klee --exit-on-error --use-asm-addresses %t.bc #include <assert.h> diff --git a/test/Feature/CallToUndefinedExternal.cpp b/test/Feature/CallToUndefinedExternal.cpp index 84b5a3b4..26e8fc55 100644 --- a/test/Feature/CallToUndefinedExternal.cpp +++ b/test/Feature/CallToUndefinedExternal.cpp @@ -1,10 +1,11 @@ // RUN: %llvmgxx %s -emit-llvm -g -c -o %t1.bc -// RUN: %klee %t1.bc -// RUN: test -f klee-last/test000001.external.err +// RUN: %klee %t1.bc 2>&1 | FileCheck %s +// RUN: test -f %T/klee-last/test000001.external.err extern "C" void poof(void); int main() { + // CHECK: failed external call: poof poof(); return 0; diff --git a/test/Feature/CheckMemoryAccess.c b/test/Feature/CheckMemoryAccess.c index dd6e8745..30590f88 100644 --- a/test/Feature/CheckMemoryAccess.c +++ b/test/Feature/CheckMemoryAccess.c @@ -1,4 +1,4 @@ -// RUN: %llvmgcc -g -c %s -o %t.bc +// RUN: %llvmgcc -emit-llvm -g -c %s -o %t.bc // RUN: %klee %t.bc > %t.log // RUN: grep -q "good" %t.log // RUN: not grep -q "bad" %t.log diff --git a/test/Feature/DanglingConcreteReadExpr.c b/test/Feature/DanglingConcreteReadExpr.c index 1bf44c3f..204187a2 100644 --- a/test/Feature/DanglingConcreteReadExpr.c +++ b/test/Feature/DanglingConcreteReadExpr.c @@ -1,6 +1,6 @@ // RUN: %llvmgcc %s -emit-llvm -O0 -c -o %t1.bc // RUN: %klee %t1.bc -// RUN: grep "total queries = 2" klee-last/info +// RUN: grep "total queries = 2" %T/klee-last/info #include <assert.h> diff --git a/test/Feature/DefineFixedObject.c b/test/Feature/DefineFixedObject.c index 36822434..9f71f89b 100644 --- a/test/Feature/DefineFixedObject.c +++ b/test/Feature/DefineFixedObject.c @@ -1,4 +1,4 @@ -// RUN: %llvmgcc -c -o %t1.bc %s +// RUN: %llvmgcc -emit-llvm -c -o %t1.bc %s // RUN: %klee --exit-on-error %t1.bc #include <stdio.h> diff --git a/test/Feature/DoubleFree.c b/test/Feature/DoubleFree.c index 3727ef2b..d97e0c08 100644 --- a/test/Feature/DoubleFree.c +++ b/test/Feature/DoubleFree.c @@ -1,10 +1,11 @@ // RUN: %llvmgcc %s -emit-llvm -O0 -c -o %t1.bc -// RUN: %klee %t1.bc -// RUN: test -f klee-last/test000001.ptr.err +// RUN: %klee %t1.bc 2>&1 | FileCheck %s +// RUN: test -f %T/klee-last/test000001.ptr.err int main() { int *x = malloc(4); free(x); + // CHECK: memory error: invalid pointer: free free(x); return 0; } diff --git a/test/Feature/DumpStatesOnHalt.c b/test/Feature/DumpStatesOnHalt.c index d86b786b..c65d5568 100644 --- a/test/Feature/DumpStatesOnHalt.c +++ b/test/Feature/DumpStatesOnHalt.c @@ -1,8 +1,9 @@ // 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 -// RUN: test -f klee-last/test000001.ktest +// 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 int main() { int x = 10; return x; } +// CHECK: halting execution, dumping remaining states diff --git a/test/Feature/ExprLogging.c b/test/Feature/ExprLogging.c index 9e9df87a..abab8031 100644 --- a/test/Feature/ExprLogging.c +++ b/test/Feature/ExprLogging.c @@ -1,14 +1,14 @@ // 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 klee-last/all-queries.pc > %t3.log +// RUN: %kleaver -print-ast %T/klee-last/all-queries.pc > %t3.log // RUN: %kleaver -print-ast %t3.log > %t4.log // RUN: diff %t3.log %t4.log -// RUN: %kleaver -print-ast klee-last/solver-queries.pc > %t3.log +// RUN: %kleaver -print-ast %T/klee-last/solver-queries.pc > %t3.log // RUN: %kleaver -print-ast %t3.log > %t4.log // RUN: diff %t3.log %t4.log -// RUN: grep "^; Query" klee-last/all-queries.smt2 | wc -l | grep -q 17 -// RUN: grep "^; Query" klee-last/solver-queries.smt2 | wc -l | grep -q 17 +// 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 #include <assert.h> diff --git a/test/Feature/Float.c b/test/Feature/Float.c index a1f54fd8..f7e4dde0 100644 --- a/test/Feature/Float.c +++ b/test/Feature/Float.c @@ -1,4 +1,4 @@ -// RUN: %llvmgcc -g -c %s -o %t.bc +// RUN: %llvmgcc -emit-llvm -g -c %s -o %t.bc // RUN: %klee %t.bc > %t.log // RUN: grep "3.30* -1.10* 2.420*" %t.log diff --git a/test/Feature/GetValue.c b/test/Feature/GetValue.c index dfd40d69..5023c51c 100644 --- a/test/Feature/GetValue.c +++ b/test/Feature/GetValue.c @@ -1,4 +1,4 @@ -// RUN: %llvmgcc -c -o %t1.bc %s +// RUN: %llvmgcc -emit-llvm -c -o %t1.bc %s // RUN: %klee --exit-on-error %t1.bc #include <stdio.h> diff --git a/test/Feature/InAndOutOfBounds.c b/test/Feature/InAndOutOfBounds.c index ba655b83..729d6b78 100644 --- a/test/Feature/InAndOutOfBounds.c +++ b/test/Feature/InAndOutOfBounds.c @@ -1,8 +1,8 @@ -// RUN: %llvmgcc %s -emit-llvm -O0 -c -o %t1.bc -// RUN: %klee %t1.bc -// RUN: test -f klee-last/test000001.ptr.err -o -f klee-last/test000002.ptr.err -// RUN: test ! -f klee-last/test000001.ptr.err -o ! -f klee-last/test000002.ptr.err -// RUN: test ! -f klee-last/test000003.ktest +// 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 unsigned klee_urange(unsigned start, unsigned end) { unsigned x; @@ -12,7 +12,9 @@ unsigned klee_urange(unsigned start, unsigned end) { } int main() { - int *x = malloc(4); + 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 x[klee_urange(0,2)] = 1; free(x); return 0; diff --git a/test/Feature/IntrinsicTrap.ll b/test/Feature/IntrinsicTrap.ll index 5af46225..13b93e4d 100644 --- a/test/Feature/IntrinsicTrap.ll +++ b/test/Feature/IntrinsicTrap.ll @@ -1,8 +1,6 @@ ; RUN: llvm-as %s -f -o %t1.bc ; RUN: %klee -disable-opt %t1.bc -; RUN: grep abort() klee-last/assembly.ll | wc -l | grep -q 2 -; RUN: echo "llvm.trap()" > %t2.ll -; RUN: grep llvm.trap() klee-last/assembly.ll %t2.ll | wc -l | grep -q 1 +; RUN: FileCheck %s --input-file=%T/klee-last/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" @@ -15,6 +13,8 @@ entry: br i1 %c, label %btrue, label %bfalse btrue: + ; CHECK-NOT: call void @llvm.trap() + ; CHECK: call void @abort() call void @llvm.trap() noreturn nounwind unreachable @@ -25,4 +25,6 @@ return: ret i32 0 } +; CHECK-NOT: call void @llvm.trap() +; CHECK: declare void @abort() declare void @llvm.trap() noreturn nounwind diff --git a/test/Feature/KleeReportError.c b/test/Feature/KleeReportError.c index dda72fd0..37c07ed1 100644 --- a/test/Feature/KleeReportError.c +++ b/test/Feature/KleeReportError.c @@ -1,6 +1,6 @@ -// RUN: %llvmgcc %s -emit-llvm -O0 -c -o %t2.bc -// RUN: %klee --emit-all-errors %t2.bc > %t3.log -// RUN: ls klee-last/ | grep .my.err | wc -l | grep 2 +// 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 #include <stdio.h> #include <assert.h> @@ -16,6 +16,9 @@ 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 + // FIXME: Use FileCheck's relative line number syntax klee_report_error(__FILE__, __LINE__, "My error", "my.err"); } diff --git a/test/Feature/LongDouble.cpp b/test/Feature/LongDouble.cpp index ecee43b4..6e6baf6a 100644 --- a/test/Feature/LongDouble.cpp +++ b/test/Feature/LongDouble.cpp @@ -1,11 +1,11 @@ // 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: 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 -// RUN: grep -q {1/0=inf} %t.log -// RUN: grep -q {1/-1=-1\\.0\\+} %t.log -// RUN: grep -q {1/-2=-0\\.50\\+} %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 +// RUN: grep -q 1/0=inf %t.log +// RUN: grep -q 1/-1=-1\\.0\\+ %t.log +// RUN: grep -q 1/-2=-0\\.50\\+ %t.log #include <cstdio> #include <cstdlib> @@ -44,10 +44,17 @@ int main(int argc, char ** argv) // test 80-bit external dispatch long double d = powl((long double)-11.0, (long double)a); + // FIXME: Use CHECK-DAG: with FileCheck tool + // CHECK-DAG: powl(-11.0,0)=1.0 + // CHECK-DAG: powl(-11.0,1)=-11.0 + // CHECK-DAG: powl(-11.0,2)=121.0 printf("powl(-11.0,%d)=%Lf\n", a, d); // test 80-bit fdiv long double e = (long double) 1 / (long double) b; + // CHECK-DAG: 1/0=inf + // CHECK-DAG: 1/1-1=-1.0 + // CHECK-DAG: 1/-2=-0.50 printf("1/%d=%Lf\n", b, e); return 0; diff --git a/test/Feature/LowerSwitch.c b/test/Feature/LowerSwitch.c index 1b92e398..49cad076 100644 --- a/test/Feature/LowerSwitch.c +++ b/test/Feature/LowerSwitch.c @@ -1,8 +1,8 @@ // 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 klee-last/test000010.ktest +// 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 klee-last/test000010.ktest +// RUN: test -f %T/klee-last/test000010.ktest #include <stdio.h> diff --git a/test/Feature/MakeConcreteSymbolic.c b/test/Feature/MakeConcreteSymbolic.c index 29b43a04..bfbb807d 100644 --- a/test/Feature/MakeConcreteSymbolic.c +++ b/test/Feature/MakeConcreteSymbolic.c @@ -1,8 +1,8 @@ // RUN: %llvmgcc %s -emit-llvm -g -c -o %t1.bc // RUN: %klee --exit-on-error %t1.bc -// RUN: grep "done: total queries = 0" klee-last/info +// 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" klee-last/info +// RUN: grep "done: total queries = 2" %T/klee-last/info #include <assert.h> diff --git a/test/Feature/MemoryLimit.c b/test/Feature/MemoryLimit.c index d959c3de..a3c1250e 100644 --- a/test/Feature/MemoryLimit.c +++ b/test/Feature/MemoryLimit.c @@ -1,5 +1,5 @@ -// RUN: %llvmgcc -DLITTLE_ALLOC -g -c %s -o %t.little.bc -// RUN: %llvmgcc -g -c %s -o %t.big.bc +// 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: not grep -q "MALLOC FAILED" %t.little.log diff --git a/test/Feature/MultipleFreeResolution.c b/test/Feature/MultipleFreeResolution.c index 8a36f459..cd8a383b 100644 --- a/test/Feature/MultipleFreeResolution.c +++ b/test/Feature/MultipleFreeResolution.c @@ -1,7 +1,7 @@ -// RUN: %llvmgcc %s -emit-llvm -O0 -c -o %t1.bc -// RUN: %klee --emit-all-errors %t1.bc -// RUN: ls klee-last/ | grep .ktest | wc -l | grep 4 -// RUN: ls klee-last/ | grep .err | wc -l | grep 3 +// 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 #include <stdlib.h> #include <stdio.h> @@ -31,9 +31,14 @@ 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 + // FIXME: Use FileCheck's relative line numbers for (i=0; i<3; i++) { printf("*buf[%d] = %d\n", i, *buf[i]); } return 0; } +// CHECK: KLEE: done: generated tests = 4 diff --git a/test/Feature/MultipleReallocResolution.c b/test/Feature/MultipleReallocResolution.c index b1a14ace..1f77485f 100644 --- a/test/Feature/MultipleReallocResolution.c +++ b/test/Feature/MultipleReallocResolution.c @@ -1,7 +1,7 @@ // RUN: %llvmgcc %s -emit-llvm -O0 -c -o %t1.bc // RUN: %klee %t1.bc -// RUN: ls klee-last/ | grep .err | wc -l | grep 2 -// RUN: ls klee-last/ | grep .ptr.err | wc -l | grep 2 +// RUN: ls %T/klee-last/ | grep .err | wc -l | grep 2 +// RUN: ls %T/klee-last/ | grep .ptr.err | wc -l | grep 2 #include <assert.h> #include <stdlib.h> diff --git a/test/Feature/NamedSeedMatching.c b/test/Feature/NamedSeedMatching.c index bb7f6097..16da3117 100644 --- a/test/Feature/NamedSeedMatching.c +++ b/test/Feature/NamedSeedMatching.c @@ -1,4 +1,4 @@ -// RUN: %llvmgcc -c -g %s -o %t.bc +// 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 diff --git a/test/Feature/OneFreeError.c b/test/Feature/OneFreeError.c index 8eb13298..e83b535a 100644 --- a/test/Feature/OneFreeError.c +++ b/test/Feature/OneFreeError.c @@ -1,10 +1,12 @@ -// RUN: %llvmgcc %s -emit-llvm -O0 -c -o %t1.bc -// RUN: %klee %t1.bc -// RUN: test -f klee-last/test000001.ptr.err +// 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 int main() { int *x = malloc(4); free(x); + // CHECK: OneFreeError.c:10: 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 11a9eecb..72d36b70 100644 --- a/test/Feature/OneOutOfBounds.c +++ b/test/Feature/OneOutOfBounds.c @@ -1,9 +1,11 @@ -// RUN: %llvmgcc %s -emit-llvm -O0 -c -o %t1.bc -// RUN: %klee %t1.bc -// RUN: test -f klee-last/test000001.ptr.err +// 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 int main() { - int *x = malloc(4); + int *x = malloc(sizeof(int)); + // CHECK: OneOutOfBounds.c:9: memory error: out of bound pointer + // FIXME: Use FileCheck's relative line numbers x[1] = 1; free(x); return 0; diff --git a/test/Feature/OverlappedError.c b/test/Feature/OverlappedError.c index aa220ed9..886c7ec8 100644 --- a/test/Feature/OverlappedError.c +++ b/test/Feature/OverlappedError.c @@ -1,7 +1,7 @@ // RUN: %llvmgcc %s -g -emit-llvm -O0 -c -o %t1.bc // RUN: %klee %t1.bc -// RUN: ls klee-last/ | grep .ktest | wc -l | grep 4 -// RUN: ls klee-last/ | grep .ptr.err | wc -l | grep 2 +// RUN: ls %T/klee-last/ | grep .ktest | wc -l | grep 4 +// RUN: ls %T/klee-last/ | grep .ptr.err | wc -l | grep 2 #include <stdlib.h> diff --git a/test/Feature/PreferCex.c b/test/Feature/PreferCex.c index 97ce5101..6cdb8446 100644 --- a/test/Feature/PreferCex.c +++ b/test/Feature/PreferCex.c @@ -1,6 +1,6 @@ // RUN: %llvmgcc %s -emit-llvm -O0 -c -o %t1.bc // RUN: %klee --exit-on-error %t1.bc -// RUN: ktest-tool klee-last/test000001.ktest | grep -F 'Hi\x00\x00' +// RUN: ktest-tool %T/klee-last/test000001.ktest | FileCheck %s #include <assert.h> #include <stdlib.h> @@ -10,6 +10,7 @@ int main() { char buf[4]; klee_make_symbolic(buf, sizeof buf); + // CHECK: Hi\x00\x00 klee_prefer_cex(buf, buf[0]=='H'); klee_prefer_cex(buf, buf[1]=='i'); klee_prefer_cex(buf, buf[2]=='\0'); diff --git a/test/Feature/Realloc.c b/test/Feature/Realloc.c index a47adad6..62aa170b 100644 --- a/test/Feature/Realloc.c +++ b/test/Feature/Realloc.c @@ -1,6 +1,5 @@ // RUN: %llvmgcc %s -emit-llvm -O0 -c -o %t1.bc -// RUN: %klee --exit-on-error %t1.bc -// RUN: grep "KLEE: WARNING ONCE: Large alloc" klee-last/warnings.txt +// RUN: %klee --exit-on-error %t1.bc 2>&1 | FileCheck %s #include <assert.h> #include <stdlib.h> @@ -11,6 +10,7 @@ int main() { assert(p); p[1] = 52; + // CHECK: KLEE: WARNING ONCE: Large alloc int *p2 = realloc(p, 1<<30); assert(p2[1] == 52); diff --git a/test/Feature/ReplayPath.c b/test/Feature/ReplayPath.c index f88ad6dc..ccf59657 100644 --- a/test/Feature/ReplayPath.c +++ b/test/Feature/ReplayPath.c @@ -1,7 +1,7 @@ // RUN: %llvmgcc %s -emit-llvm -O0 -DCOND_EXIT -c -o %t1.bc // RUN: klee --write-paths %t1.bc > %t3.good // RUN: %llvmgcc %s -emit-llvm -O0 -c -o %t2.bc -// RUN: %klee --replay-path klee-last/test000001.path %t2.bc >%t3.log +// RUN: %klee --replay-path %T/klee-last/test000001.path %t2.bc > %t3.log // RUN: diff %t3.log %t3.good #include <unistd.h> diff --git a/test/Feature/SetForking.c b/test/Feature/SetForking.c index 8620110d..cbae33c0 100644 --- a/test/Feature/SetForking.c +++ b/test/Feature/SetForking.c @@ -1,4 +1,4 @@ -// RUN: %llvmgcc -g -c %s -o %t.bc +// RUN: %llvmgcc -emit-llvm -g -c %s -o %t.bc // RUN: %klee %t.bc > %t.log // RUN: sort %t.log | uniq -c > %t.uniq.log // RUN: grep "1 A" %t.uniq.log diff --git a/test/Feature/Vararg.c b/test/Feature/Vararg.c index 9f6643bc..31eee235 100644 --- a/test/Feature/Vararg.c +++ b/test/Feature/Vararg.c @@ -1,7 +1,7 @@ // RUN: %llvmgcc %s -emit-llvm -O0 -c -o %t1.bc // RUN: %klee %t1.bc > %t2.out // RUN: grep "types: (52, 37, 2.00, (9,12,15))" %t2.out -// RUN: test -f klee-last/test000001.ptr.err +// RUN: test -f %T/klee-last/test000001.ptr.err #include <stdarg.h> #include <assert.h> diff --git a/test/Feature/WriteCov.c b/test/Feature/WriteCov.c index bb2d64e8..45e7bc43 100644 --- a/test/Feature/WriteCov.c +++ b/test/Feature/WriteCov.c @@ -1,7 +1,7 @@ // 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 klee-last/test000001.cov klee-last/test000002.cov >%t3.txt -// RUN: grep -c WriteCov.c:17 klee-last/test000001.cov klee-last/test000002.cov >>%t3.txt +// 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 diff --git a/test/Feature/dg.exp b/test/Feature/dg.exp deleted file mode 100644 index 879685ca..00000000 --- a/test/Feature/dg.exp +++ /dev/null @@ -1,3 +0,0 @@ -load_lib llvm.exp - -RunLLVMTests [lsort [glob -nocomplain $srcdir/$subdir/*.{ll,llx,c,cpp,tr}]] diff --git a/test/Makefile b/test/Makefile index 75e05dda..61a91800 100644 --- a/test/Makefile +++ b/test/Makefile @@ -11,7 +11,7 @@ LEVEL = .. DIRS = # -# Make Dejagnu the default for testing +# Make llvm-lit the default for testing # all:: check-local @@ -19,12 +19,12 @@ all:: check-local include Makefile.tests #===------------------------------------------------------------------------===# -# DejaGNU testing support +# llvm-lit testing support #===------------------------------------------------------------------------===# +ULIMIT = ulimit -t 600 ; ulimit -d 512000 ; # FIXME: Fix test suite so we can run lit in parallel. ifdef VERBOSE -RUNTESTFLAGS := $(VERBOSE) LIT_ARGS := -j1 -v else LIT_ARGS := -j1 -s -v @@ -32,50 +32,27 @@ endif ifdef TESTSUITE LIT_TESTSUITE := $(TESTSUITE) -CLEANED_TESTSUITE := $(patsubst %/,%,$(TESTSUITE)) -CLEANED_TESTSUITE := $(patsubst test/%,%,$(CLEANED_TESTSUITE)) -RUNTESTFLAGS := --tool $(CLEANED_TESTSUITE) else LIT_TESTSUITE := . endif -ifneq ($(RUNTEST),) -check-local:: site.exp - ( ulimit -t 600 ; ulimit -d 512000 ; \ - PATH="$(ToolDir):$(LLVMToolDir):$(LLVM_SRC_ROOT)/test/Scripts:$(PATH)" \ - $(RUNTEST) $(RUNTESTFLAGS) ; \ - ! grep FAIL testrun.log; ! grep -q ^FAIL testrun.log; ) -else -check-local:: site.exp - @echo "*** dejagnu not found. Make sure runtest is in your PATH, then reconfigure llvm." +# Older LLVM versions don't detect python at configure time +# so guess the location +ifndef PYTHON + # llvm-lit doesn't work with python3 so force python2 + PYTHON := python2 endif -check-local-lit:: lit.site.cfg - ( $(ULIMIT) \ - $(LLVM_SRC_ROOT)/utils/lit/lit.py $(LIT_ARGS) $(LIT_TESTSUITE) ) +# Potential support in the future for multiple test suites +LIT_ALL_TESTSUITES := $(LIT_TESTSUITE) -check-local-all:: lit.site.cfg - ( $(ULIMIT) \ - $(LLVM_SRC_ROOT)/utils/lit/lit.py $(LIT_ARGS) $(LIT_TESTSUITE) ) +check-local:: lit.site.cfg + $(Verb) ( $(ULIMIT) \ + $(PYTHON) $(LLVM_SRC_ROOT)/utils/lit/lit.py $(LIT_ARGS) $(LIT_TESTSUITE) ) -ifdef TESTONE -CLEANED_TESTONE := $(patsubst %/,%,$(TESTONE)) -CLEANED_TESTONE := $(patsubst test/%,%,$(CLEANED_TESTONE)) -SUBDIR := $(shell dirname $(CLEANED_TESTONE)) -TESTPATH := $(PROJ_SRC_ROOT)/test/$(CLEANED_TESTONE) -check-one: site.exp $(TCLSH) - $(Verb)( echo "source $(PROJ_OBJ_ROOT)/test/site.exp" ; \ - echo "set subdir $(SUBDIR)" ; \ - echo "proc pass { msg } { puts \"PASS: \$$msg\" } "; \ - echo "proc fail { msg } { puts \"FAIL: \$$msg\" }" ; \ - echo "proc xfail { msg } { puts \"XFAIL: \$$msg\" }" ; \ - echo "proc xpass { msg } { puts \"XPASS: \$$msg\" }" ; \ - echo "source $(PROJ_SRC_ROOT)/test/lib/llvm.exp" ; \ - echo "RunLLVMTests $(TESTPATH)" ) | \ - ( ulimit -t 600 ; ulimit -d 512000 ; \ - PATH="$(ToolDir):$(LLVMToolDir):$(LLVM_SRC_ROOT)/test/Scripts:$(PATH)" \ - $(TCLSH) ) -endif +check-local-all:: lit.site.cfg + $(Verb) ( $(ULIMIT) \ + $(PYTHON) $(LLVM_SRC_ROOT)/utils/lit/lit.py $(LIT_ARGS) $(LIT_ALL_TESTSUITES) ) clean:: $(RM) -rf `find $(PROJ_OBJ_ROOT)/test -name Output -type d -print` @@ -87,31 +64,17 @@ clean:: $(RM) -rf `find $(PROJ_OBJ_ROOT)/test -name test.log` rm -f site.exp -site.exp: Makefile $(LEVEL)/Makefile.config - @echo 'Making a new site.exp file...' - @echo '## these variables are automatically generated by make ##' >site.tmp - @echo '# Do not edit here. If you wish to override these values' >>site.tmp - @echo '# edit the last section' >>site.tmp - @echo 'set target_triplet "$(TARGET_TRIPLE)"' >> site.tmp - @echo 'set ENABLE_UCLIBC "$(ENABLE_UCLIBC)"' >> site.tmp - @echo 'set ENABLE_POSIX_RUNTIME "$(ENABLE_POSIX_RUNTIME)"' >> site.tmp - @echo 'set TEST_FEATURE_LIST "$(TEST_FEATURE_LIST)"' >> site.tmp - @echo 'set srcroot "$(PROJ_SRC_ROOT)"' >>site.tmp - @echo 'set objroot "$(PROJ_OBJ_ROOT)"' >>site.tmp - @echo 'set srcdir "$(PROJ_SRC_ROOT)/test"' >>site.tmp - @echo 'set objdir "$(PROJ_OBJ_ROOT)/test"' >>site.tmp - @echo 'set llvmgcc "$(LLVMCC) -I$(PROJ_SRC_ROOT)/include"' >> site.tmp - @echo 'set llvmgxx "$(LLVMCXX) -I$(PROJ_SRC_ROOT)/include"' >> site.tmp - @echo '## All variables above are generated by configure. Do Not Edit ## ' >>site.tmp - @test ! -f site.exp || \ - sed '1,/^## All variables above are.*##/ d' site.exp >> site.tmp - @-rm -f site.bak - @test ! -f site.exp || mv site.exp site.bak - @mv site.tmp site.exp - -lit.site.cfg: site.exp +lit.site.cfg: lit.site.cfg.in @echo "Making KLEE 'lit.site.cfg' file..." @sed -e "s#@KLEE_SOURCE_DIR@#$(PROJ_SRC_ROOT)#g" \ -e "s#@KLEE_BINARY_DIR@#$(PROJ_OBJ_ROOT)#g" \ -e "s#@KLEE_TOOLS_DIR@#$(ToolDir)#g" \ + -e "s#@LLVM_TOOLS_DIR@#$(LLVMToolDir)#g" \ + -e "s#@LLVM_VERSION_MAJOR@#$(LLVM_VERSION_MAJOR)#g" \ + -e "s#@LLVMCC@#$(KLEE_BITCODE_C_COMPILER) -I$(PROJ_SRC_ROOT)/include#g" \ + -e "s#@LLVMCXX@#$(KLEE_BITCODE_CXX_COMPILER) -I$(PROJ_SRC_ROOT)/include#g" \ + -e "s#@ENABLE_UCLIBC@#$(ENABLE_UCLIBC)#g" \ + -e "s#@ENABLE_POSIX_RUNTIME@#$(ENABLE_POSIX_RUNTIME)#g" \ + -e "s#@TARGET_TRIPLE@#$(TARGET_TRIPLE)#g" \ + -e "s#@HAVE_SELINUX@#$(HAVE_SELINUX)#g" \ $(PROJ_SRC_DIR)/lit.site.cfg.in > $@ diff --git a/test/Programs/dg.exp b/test/Programs/dg.exp deleted file mode 100644 index 879685ca..00000000 --- a/test/Programs/dg.exp +++ /dev/null @@ -1,3 +0,0 @@ -load_lib llvm.exp - -RunLLVMTests [lsort [glob -nocomplain $srcdir/$subdir/*.{ll,llx,c,cpp,tr}]] diff --git a/test/Runtime/POSIX/FD_Fail2.c b/test/Runtime/POSIX/FD_Fail2.c index b42e03bf..624329fc 100644 --- a/test/Runtime/POSIX/FD_Fail2.c +++ b/test/Runtime/POSIX/FD_Fail2.c @@ -1,12 +1,12 @@ // 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 klee-last/test000001.ktest -// RUN: test -f klee-last/test000002.ktest -// RUN: test -f klee-last/test000003.ktest -// RUN: test -f klee-last/test000004.ktest -// RUN: test -f klee-last/test000005.ktest -// RUN: test -f klee-last/test000006.ktest -// RUN: test -f klee-last/test000007.ktest +// 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 #include <stdio.h> #include <assert.h> diff --git a/test/Runtime/POSIX/FilePerm.c b/test/Runtime/POSIX/FilePerm.c index d387c2a9..1346c09a 100644 --- a/test/Runtime/POSIX/FilePerm.c +++ b/test/Runtime/POSIX/FilePerm.c @@ -1,8 +1,8 @@ // 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 klee-last/test000001.ktest -// RUN: test -f klee-last/test000002.ktest -// RUN: test -f klee-last/test000003.ktest +// RUN: test -f %T/klee-last/test000001.ktest +// RUN: test -f %T/klee-last/test000002.ktest +// RUN: test -f %T/klee-last/test000003.ktest #include <stdio.h> #include <sys/types.h> diff --git a/test/Runtime/POSIX/FreeArgv.c b/test/Runtime/POSIX/FreeArgv.c index ceec4de2..4d2e5b75 100644 --- a/test/Runtime/POSIX/FreeArgv.c +++ b/test/Runtime/POSIX/FreeArgv.c @@ -1,18 +1,22 @@ -// RUN: %llvmgcc %s -emit-llvm -O0 -c -o %t.bc -// RUN: %klee --posix-runtime %t.bc --sym-args 1 1 1 -// RUN: test -f klee-last/test000001.free.err -// RUN: test -f klee-last/test000002.free.err -// RUN: test -f klee-last/test000003.free.err +// 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 int main(int argc, char **argv) { + // FIXME: Use FileCheck's CHECK-DAG to check source locations switch(klee_range(0, 3, "range")) { case 0: + // CHECK: free of global free(argv); break; case 1: + // CHECK: free of global free(argv[0]); break; case 2: + // CHECK: free of global free(argv[1]); break; } diff --git a/test/Runtime/POSIX/Isatty.c b/test/Runtime/POSIX/Isatty.c index 293ee653..bd514d48 100644 --- a/test/Runtime/POSIX/Isatty.c +++ b/test/Runtime/POSIX/Isatty.c @@ -1,9 +1,9 @@ // 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: test -f klee-last/test000001.ktest -// RUN: test -f klee-last/test000002.ktest -// RUN: test -f klee-last/test000003.ktest -// RUN: test -f klee-last/test000004.ktest +// 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: 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 @@ -15,16 +15,21 @@ #include <stdio.h> #include <assert.h> +// FIXME: Use new FileCheck to check klee's output int main(int argc, char** argv) { int fd0 = 0; // stdin int fd1 = 1; // stdout int r = isatty(fd0); + // CHECK-DAG: stdin is a tty + // CHECK-DAG: stdin is NOT a tty if (r) fprintf(stderr, "stdin is a tty\n"); else fprintf(stderr, "stdin is NOT a tty\n"); r = isatty(fd1); + // CHECK-DAG: stdout is a tty + // CHECK-DAG: stdout is NOT a tty if (r) fprintf(stderr, "stdout is a tty\n"); else fprintf(stderr, "stdout is NOT a tty\n"); diff --git a/test/Runtime/POSIX/Openat.c b/test/Runtime/POSIX/Openat.c index d417ee47..3c17f976 100644 --- a/test/Runtime/POSIX/Openat.c +++ b/test/Runtime/POSIX/Openat.c @@ -1,6 +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: test -f klee-last/test000001.ktest +// RUN: test -f %T/klee-last/test000001.ktest #include <assert.h> #include <fcntl.h> diff --git a/test/Runtime/POSIX/PrgName.c b/test/Runtime/POSIX/PrgName.c index dc6a4b8c..6bc682ca 100644 --- a/test/Runtime/POSIX/PrgName.c +++ b/test/Runtime/POSIX/PrgName.c @@ -1,7 +1,7 @@ // 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 klee-last/test000001.ktest -// RUN: test -f klee-last/test000002.ktest +// RUN: test -f %T/klee-last/test000001.ktest +// RUN: test -f %T/klee-last/test000002.ktest // RUN: grep -q "No" %t.log // RUN: grep -qv "Yes" %t.log diff --git a/test/Runtime/POSIX/SELinux.c b/test/Runtime/POSIX/SELinux/SELinux.c index 65dd1a7f..65dd1a7f 100644 --- a/test/Runtime/POSIX/SELinux.c +++ b/test/Runtime/POSIX/SELinux/SELinux.c diff --git a/test/Runtime/POSIX/SELinux/lit.local.cfg b/test/Runtime/POSIX/SELinux/lit.local.cfg new file mode 100644 index 00000000..2046d4d0 --- /dev/null +++ b/test/Runtime/POSIX/SELinux/lit.local.cfg @@ -0,0 +1,7 @@ +def getRoot(config): + if not config.parent: + return config + return getRoot(config.parent) + +if not getRoot(config).have_selinux: + config.unsupported = True diff --git a/test/Runtime/POSIX/SeedAndFail.c b/test/Runtime/POSIX/SeedAndFail.c index 740db664..d9bd7f8d 100644 --- a/test/Runtime/POSIX/SeedAndFail.c +++ b/test/Runtime/POSIX/SeedAndFail.c @@ -1,8 +1,8 @@ // RUN: %llvmgcc %s -emit-llvm -g -O0 -c -o %t.bc -// RUN: rm -rf tmp-123 -// RUN: %klee --libc=uclibc --output-dir=tmp-123 --posix-runtime %t.bc --sym-files 1 10 2>%t.log -// RUN: %klee --seed-out-dir=tmp-123 --zero-seed-extension --libc=uclibc --posix-runtime %t.bc --sym-files 1 10 --max-fail 1 -// RUN: ls klee-last | grep -c assert | grep 4 +// 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 #include <string.h> #include <assert.h> diff --git a/test/Runtime/POSIX/dg.exp b/test/Runtime/POSIX/dg.exp deleted file mode 100644 index 88406208..00000000 --- a/test/Runtime/POSIX/dg.exp +++ /dev/null @@ -1,5 +0,0 @@ -load_lib llvm.exp - -if { [klee_supports_posix_runtime] } { - RunLLVMTests [lsort [glob -nocomplain $srcdir/$subdir/*.{ll,llx,c,cpp,tr}]] -} diff --git a/test/Runtime/POSIX/lit.local.cfg b/test/Runtime/POSIX/lit.local.cfg new file mode 100644 index 00000000..680351b7 --- /dev/null +++ b/test/Runtime/POSIX/lit.local.cfg @@ -0,0 +1,7 @@ +def getRoot(config): + if not config.parent: + return config + return getRoot(config.parent) + +if not getRoot(config).enable_posix_runtime: + config.unsupported = True diff --git a/test/Runtime/Uclibc/dg.exp b/test/Runtime/Uclibc/dg.exp deleted file mode 100644 index 9c1663c3..00000000 --- a/test/Runtime/Uclibc/dg.exp +++ /dev/null @@ -1,5 +0,0 @@ -load_lib llvm.exp - -if { [klee_supports_uclibc] } { - RunLLVMTests [lsort [glob -nocomplain $srcdir/$subdir/*.{ll,llx,c,cpp,tr}]] -} diff --git a/test/Runtime/Uclibc/lit.local.cfg b/test/Runtime/Uclibc/lit.local.cfg new file mode 100644 index 00000000..c9944834 --- /dev/null +++ b/test/Runtime/Uclibc/lit.local.cfg @@ -0,0 +1,7 @@ +def getRoot(config): + if not config.parent: + return config + return getRoot(config.parent) + +if not getRoot(config).enable_uclibc: + config.unsupported = True diff --git a/test/Solver/LargeIntegers.pc b/test/Solver/LargeIntegers.pc index 53ff3a51..e0921393 100644 --- a/test/Solver/LargeIntegers.pc +++ b/test/Solver/LargeIntegers.pc @@ -2,16 +2,16 @@ array a[64] : w32 -> w8 = symbolic -# RUN: grep -A 1 \"Query 0\" %t > %t2 -# RUN: grep \"Expr 0:\t18446744073709551618\" %t2 +# RUN: grep -A 1 "Query 0" %t > %t2 +# RUN: grep "Expr 0: 18446744073709551618" %t2 (query [] false [(Concat w128 (w64 1) (w64 2))]) -# RUN: grep -A 1 \"Query 1\" %t > %t2 -# RUN: grep \"Expr 0:\t16\" %t2 +# RUN: grep -A 1 "Query 1" %t > %t2 +# RUN: grep "Expr 0: 16" %t2 (query [] false [(Extract w5 60 (Concat w128 (w64 1) (w64 2)))]) -# RUN: grep -A 1 \"Query 2\" %t > %t2 -# RUN: grep \"Array 0:\ta.16, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1\" %t2 +# RUN: grep -A 1 "Query 2" %t > %t2 +# RUN: grep "Array 0: a.16, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1" %t2 (query [(Eq 0x0102030405060708090A0B0C0D0E0F10 (ReadLSB w128 0 a))] false [] [a]) diff --git a/test/Solver/dg.exp b/test/Solver/dg.exp deleted file mode 100644 index 94fc4df8..00000000 --- a/test/Solver/dg.exp +++ /dev/null @@ -1,3 +0,0 @@ -load_lib llvm.exp - -RunLLVMTests [lsort [glob -nocomplain $srcdir/$subdir/*.{pc}]] diff --git a/test/TestRunner.sh b/test/TestRunner.sh index 3e2cace4..3a69604b 100755 --- a/test/TestRunner.sh +++ b/test/TestRunner.sh @@ -1,36 +1,6 @@ #!/bin/sh -# -# TestRunner.sh - This script is used to run the deja-gnu tests exactly like -# deja-gnu does, by executing the Tcl script specified in the test case's -# RUN: lines. This is made possible by a simple make target supported by the -# test/Makefile. All this script does is invoke that make target. -# -# Usage: -# TestRunner.sh {script_names} -# -# This script is typically used by cd'ing to a test directory and then -# running TestRunner.sh with a list of test file names you want to run. -# -TESTPATH=`pwd` -SUBDIR="" -if test `dirname $1` = "." ; then - while test `basename $TESTPATH` != "test" -a ! -z "$TESTPATH" ; do - tmp=`basename $TESTPATH` - SUBDIR="$tmp/$SUBDIR" - TESTPATH=`dirname $TESTPATH` - done -fi +# Deprecated, use 'llvm-lit'. -for TESTFILE in "$@" ; do - if test `dirname $TESTFILE` = . ; then - if test -d "$TESTPATH" ; then - cd $TESTPATH - make check-one TESTONE="$SUBDIR$TESTFILE" - cd $PWD - else - echo "Can't find klee/test directory in " `pwd` - fi - else - make check-one TESTONE=$TESTFILE - fi -done +echo "warning: '$0' is deprecated, use 'llvm-lit' instead." +# FIXME: Make test suite work in parallel. +exec llvm-lit --threads=1 "$@" diff --git a/test/lib/llvm.exp b/test/lib/llvm.exp deleted file mode 100644 index ce52c4b5..00000000 --- a/test/lib/llvm.exp +++ /dev/null @@ -1,199 +0,0 @@ -# This procedure executes one line of a test case's execution script. -proc execOneLine { test PRS outcome lineno line } { - set status 0 - set resultmsg "" - set retval [ catch { eval exec -keepnewline -- $line } errmsg ] - if { $retval != 0 } { - set code [lindex $::errorCode 0] - set lineno [expr $lineno + 1] - if { $PRS != ""} { - set PRS " for $PRS" - } - set errmsg " at line $lineno\nwhile running: $line\n$errmsg" - switch "$code" { - CHILDSTATUS { - set status [lindex $::errorCode 2] - if { $status != 0 } { - set resultmsg "$test$PRS\nFailed with exit($status)$errmsg" - } - } - CHILDKILLED { - set signal [lindex $::errorCode 2] - set resultmsg "$test$PRS\nFailed with signal($signal)$errmsg" - } - CHILDSUSP { - set signal [lindex $::errorCode 2] - set resultmsg "$test$PRS\nFailed with suspend($signal)$errmsg" - } - POSIX { - set posixNum [lindex $::errorCode 1] - set posixMsg [lindex $::errorCode 2] - set resultmsg "$test$PRS\nFailed with posix($posixNum,$posixMsg)$errmsg" - } - NONE { - } - default { - } - } - } - return $resultmsg -} - -# This procedure performs variable substitutions on the RUN: lines of a test -# cases. -proc substitute { line test tmpFile } { - global srcroot objroot srcdir objdir subdir target_triplet - global llvmgcc llvmgxx llvmgcc_version - set path [file join $srcdir $subdir] - - # Substitute all Tcl variables. - set new_line [subst $line ] - - #replace %llvmgcc with actual path to llvmgcc - regsub -all {%llvmgcc} $new_line "$llvmgcc -emit-llvm" new_line - #replace %llvmgxx with actual path to llvmg++ - regsub -all {%llvmgxx} $new_line "$llvmgxx -emit-llvm" new_line - #replace %klee with klee binary - regsub -all {%klee} $new_line "klee" new_line - #replace %kleaver with kleaver binary - regsub -all {%kleaver} $new_line "kleaver" new_line - #replace %p with path to source, - regsub -all {%p} $new_line [file join $srcdir $subdir] new_line - #replace %s with filename - regsub -all {%s} $new_line $test new_line - #replace %t with temp filenames - regsub -all {%t} $new_line $tmpFile new_line - #replace %% with % - regsub -all {%%} $new_line % new_line - return $new_line -} - -# This procedure runs the set of tests for the test_source_files array. -proc RunLLVMTests { test_source_files } { - global srcroot objroot srcdir objdir subdir TEST_FEATURE_LIST target_triplet - set timeout 60 - - set path [file join $objdir $subdir] - - #Make Output Directory if it does not exist already - if { [file exists path] } { - cd $path - } else { - file mkdir $path - cd $path - } - - file mkdir Output - cd Output - - foreach test $test_source_files { - #Should figure out best way to set the timeout - #set timeout 40 - - set filename [file tail $test] - set outcome PASS - set tmpFile "$filename.tmp" - - #set hasRunline bool to check if testcase has a runline - set numLines 0 - - # Open the test file and start reading lines - set testFileId [ open $test r] - set runline "" - set PRNUMS "" - foreach line [split [read $testFileId] \n] { - - # if its the END. line then stop parsing (optimization for big files) - if {[regexp {END.[ *]$} $line match endofscript]} { - break - - # if the line is continued, concatenate and continue the loop - } elseif {[regexp {RUN: *(.+)(\\)$} $line match oneline suffix]} { - set runline "$runline$oneline " - - # if its a terminating RUN: line then do substitution on the whole line - # and then save the line. - } elseif {[regexp {RUN: *([^&]+)(&&)?} $line match oneline suffix]} { - set runline "$runline$oneline" - set runline [ substitute $runline $test $tmpFile ] - set lines($numLines) $runline - set numLines [expr $numLines + 1] - set runline "" - - # if its an PR line, save the problem report number - } elseif {[regexp {PR([0-9]+)} $line match prnum]} { - if {$PRNUMS == ""} { - set PRNUMS "PR$prnum" - } else { - set PRNUMS "$PRNUMS,$prnum" - } - # if its an XFAIL line, see if we should be XFAILing or not. - } elseif {[regexp {XFAIL:[ *](.+)} $line match features]} { - set features - - foreach feature [split $features ,] { - if { [regexp {\*} $feature match] } { - set outcome XFAIL - } elseif { [regexp $feature $target_triplet match] } { - set outcome XFAIL - } elseif { [regexp $feature $TEST_FEATURE_LIST match] } { - set outcome XFAIL - } - } - } - } - - # Done reading the script - close $testFileId - - - if { $numLines == 0 } { - fail "$test: \nDoes not have a RUN line\n" - } else { - set failed 0 - for { set i 0 } { $i < $numLines } { set i [ expr $i + 1 ] } { - regsub ^.*RUN:(.*) $lines($i) \1 theLine - set resultmsg [execOneLine $test $PRNUMS $outcome $i $theLine ] - if { $resultmsg != "" } { - if { $outcome == "XFAIL" } { - xfail "$resultmsg" - } else { - fail "$resultmsg" - } - set failed 1 - break - } - } - if { $failed } { - continue - } else { - if { $PRNUMS != "" } { - set PRNUMS " for $PRNUMS" - } - if { $outcome == "XFAIL" } { - xpass "$test$PRNUMS" - } else { - pass "$test$PRNUMS" - } - } - } - } -} - -# Check if klee was configured with POSIX runtime support. -proc klee_supports_posix_runtime { } { - global ENABLE_POSIX_RUNTIME - if { $ENABLE_POSIX_RUNTIME == "1" } { - return 1 - } - return 0 -} - -# Check if klee was configured with uclibc support. -proc klee_supports_uclibc { } { - global ENABLE_UCLIBC - if { $ENABLE_UCLIBC == "1" } { - return 1 - } - return 0 -} diff --git a/test/lit.cfg b/test/lit.cfg index 39aaa824..36a79b42 100644 --- a/test/lit.cfg +++ b/test/lit.cfg @@ -8,11 +8,11 @@ import os config.name = 'KLEE' # testFormat: The test format to use to interpret tests. -config.test_format = lit.formats.TclTest() +config.test_format = lit.formats.ShTest(execute_external=False) -# suffixes: A list of file extensions to treat as test files, this is actually -# set by on_clone(). -config.suffixes = [] +# suffixes: A list of file extensions to treat as test files +# Note this can be overridden by lit.local.cfg files +config.suffixes = ['.ll', '.c', '.cpp', '.pc'] # test_source_root: The root path where tests are located. config.test_source_root = os.path.dirname(__file__) @@ -27,107 +27,39 @@ if klee_obj_root is not None: klee_tools_dir = getattr(config, 'klee_tools_dir', None) if not klee_tools_dir: lit.fatal('No KLEE tools dir set!') - path = os.path.pathsep.join((klee_tools_dir, config.environment['PATH'])) + + # Check LLVM tool directory + llvm_tools_dir = getattr(config, 'llvm_tools_dir', None) + if not llvm_tools_dir: + lit.fatal('No LLVM tool directory set!') + + 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'] - -### - -import os +config.environment['PWD'] = os.environ['PWD'] # Check that the object root is known. if config.test_exec_root is None: lit.fatal('test execution root not set!') -### - -# Load site data from DejaGNU's site.exp. -import re -site_exp = {} -# FIXME: Implement lit.site.cfg. -for line in open(os.path.join(config.klee_obj_root, 'test', 'site.exp')): - m = re.match('set ([^ ]+) "([^"]*)"', line) - if m: - site_exp[m.group(1)] = m.group(2) - -# Add substitutions. -config.substitutions.append(('%llvmgcc_only', site_exp['llvmgcc'])) -for sub in ['llvmgcc', 'llvmgxx']: - if sub in ('llvmgcc', 'llvmgxx'): - config.substitutions.append(('%' + sub, - site_exp[sub] + ' -emit-llvm -w')) - # FIXME: This is a hack to avoid LLVMC tests failing due to a clang driver - # warning when passing in "-fexceptions -fno-exceptions". - elif sub == 'compile_cxx': - config.substitutions.append(('%' + sub, - site_exp[sub].replace('-fno-exceptions', ''))) - else: - config.substitutions.append(('%' + sub, site_exp[sub])) - -# FIXME: Give these proper paths. -config.substitutions.append(('%kleaver', 'kleaver')) -config.substitutions.append(('%klee', 'klee')) - -def klee_supports_posix_runtime(): - return int(site_exp['ENABLE_POSIX_RUNTIME']) - -def klee_supports_uclibc(): - return int(site_exp['ENABLE_UCLIBC']) - -excludes = [] - -# Provide target_triple for use in XFAIL and XTARGET. -config.target_triple = site_exp['target_triplet'] - -# Provide on_clone hook for reading 'dg.exp'. -import os -simpleLibData = re.compile(r"""load_lib llvm.exp - -RunLLVMTests \[lsort \[glob -nocomplain \$srcdir/\$subdir/\*\.(.*)\]\]""", - re.MULTILINE) -conditionalLibData = re.compile(r"""load_lib llvm.exp - -if.*\[?(klee[^ ]*)\].*{ - *RunLLVMTests \[lsort \[glob -nocomplain \$srcdir/\$subdir/\*\.(.*)\]\] -\}""", re.MULTILINE) -def on_clone(parent, cfg, for_path): - def addSuffixes(match): - if match[0] == '{' and match[-1] == '}': - cfg.suffixes = ['.' + s for s in match[1:-1].split(',')] - else: - cfg.suffixes = ['.' + match] - - libPath = os.path.join(os.path.dirname(for_path), - 'dg.exp') - if not os.path.exists(libPath): - cfg.unsupported = True - return - - # Reset unsupported, in case we inherited it. - cfg.unsupported = False - lib = open(libPath).read().strip() - - # Check for a simple library. - m = simpleLibData.match(lib) - if m: - addSuffixes(m.group(1)) - return - - # Check for a conditional test set. - m = conditionalLibData.match(lib) - if m: - funcname,match = m.groups() - addSuffixes(match) - - func = globals().get(funcname) - if not func: - lit.error('unsupported predicate %r' % funcname) - elif not func(): - cfg.unsupported = True - return - # Otherwise, give up. - lit.error('unable to understand %r:\n%s' % (libPath, lib)) - -config.on_clone = on_clone + +# Add substitutions from lit.site.cfg +subs = [ 'llvmgcc', 'llvmgxx'] +for name in subs: + value = getattr(config, name, None) + if value == None: + 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) ) ) + + +# LLVM < 3.0 doesn't Support %T directive +if int(config.llvm_version_major) == 2: + # This is a hack + config.substitutions.append(('%T','Output')) diff --git a/test/lit.site.cfg.in b/test/lit.site.cfg.in index ec92b32d..6fc3d49c 100644 --- a/test/lit.site.cfg.in +++ b/test/lit.site.cfg.in @@ -3,6 +3,23 @@ config.klee_src_root = "@KLEE_SOURCE_DIR@" config.klee_obj_root = "@KLEE_BINARY_DIR@" config.klee_tools_dir = "@KLEE_TOOLS_DIR@" +config.llvm_tools_dir = "@LLVM_TOOLS_DIR@" + +# Needed to check if a hack needs to be applied +config.llvm_version_major = "@LLVM_VERSION_MAJOR@" + +# Compilers +# FIXME: use llvmcc not llvmgcc +config.llvmgcc = "@LLVMCC@" +config.llvmgxx = "@LLVMCXX@" + +# Features +config.enable_uclibc = True if @ENABLE_UCLIBC@ == 1 else False +config.enable_posix_runtime = True if @ENABLE_POSIX_RUNTIME@ == 1 else False +config.have_selinux = True if @HAVE_SELINUX@ == 1 else False + +# Current target +config.target_triple = "@TARGET_TRIPLE@" # Let the main config do the real work. lit.load_config(config, "@KLEE_SOURCE_DIR@/test/lit.cfg") 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 d10a41ef..fc77785d 100644 --- a/test/regression/2007-08-01-bool-zext-in-call.ll +++ b/test/regression/2007-08-01-bool-zext-in-call.ll @@ -1,5 +1,12 @@ -; RUN: llvm-as -f %s -o - | %klee 2> %t1.log -; RUN: not test -f klee-last/test0001.abort.err +; 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 declare void @klee_abort() diff --git a/test/regression/2007-10-11-free-of-alloca.c b/test/regression/2007-10-11-free-of-alloca.c index 71a16f6b..44a9ed4e 100644 --- a/test/regression/2007-10-11-free-of-alloca.c +++ b/test/regression/2007-10-11-free-of-alloca.c @@ -1,9 +1,10 @@ -// RUN: %llvmgcc %s -emit-llvm -O0 -c -o %t1.bc -// RUN: %klee %t1.bc -// RUN: test -f klee-last/test000001.free.err +// 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 int main() { int buf[4]; + // CHECK: 2007-10-11-free-of-alloca.c:8: 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 fbbb99c3..73b3ed3f 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,6 @@ // RUN: %llvmgcc %s -emit-llvm -g -c -o %t1.bc -// RUN: %klee --optimize %t1.bc -// RUN: test -f klee-last/test000001.ptr.err +// RUN: %klee --optimize %t1.bc 2>&1 | FileCheck %s +// RUN: test -f %T/klee-last/test000001.ptr.err #include <stdlib.h> #include <stdio.h> @@ -13,7 +13,10 @@ int main(int argc, char **argv) { unsigned char x = buf[1]; free(buf); if (x) + { + // CHECK: 2007-10-11-illegal-access-after-free-and-branch.c:18: memory error: out of bound pointer return buf[2]; + } klee_silent_exit(0); return 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 e9a280c3..bfe61f2c 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,6 @@ // RUN: %llvmgcc %s -emit-llvm -O0 -c -o %t1.bc // RUN: %klee %t1.bc -// RUN: test -f klee-last/test000001.ktest +// RUN: test -f %T/klee-last/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 7821398d..5351128d 100644 --- a/test/regression/2008-03-04-free-of-global.c +++ b/test/regression/2008-03-04-free-of-global.c @@ -1,10 +1,11 @@ -// RUN: %llvmgcc %s -emit-llvm -O0 -c -o %t1.bc -// RUN: %klee %t1.bc -// RUN: test -f klee-last/test000001.free.err +// 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 int buf[4]; int main() { + // CHECK: 2008-03-04-free-of-global.c:9: free of global free(buf); // this should give runtime error, not crash return 0; } 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 5e03ec1d..3ad9b24e 100644 --- a/test/regression/2008-05-23-gep-with-global-const.c +++ b/test/regression/2008-05-23-gep-with-global-const.c @@ -1,4 +1,4 @@ -// RUN: %llvmgcc -O0 -c -o %t.bc %s +// RUN: %llvmgcc -emit-llvm -O0 -c -o %t.bc %s // RUN: %klee --exit-on-error %t.bc #include <assert.h> diff --git a/test/regression/dg.exp b/test/regression/dg.exp deleted file mode 100644 index 879685ca..00000000 --- a/test/regression/dg.exp +++ /dev/null @@ -1,3 +0,0 @@ -load_lib llvm.exp - -RunLLVMTests [lsort [glob -nocomplain $srcdir/$subdir/*.{ll,llx,c,cpp,tr}]] |