From 38a084fb50cfb38570d0194bb076805e4f752c99 Mon Sep 17 00:00:00 2001 From: Dan Liew Date: Sun, 12 Jan 2014 21:34:59 +0000 Subject: Fixed many tests that make use of the file tool to check a file created by KLEE exists. A big difference between DejaGNU and llvm-lit is that in DejaGNU the working directory is the test output directory (e.g. test/Feature/Output) but in llvm-lit the working directory is the test directory (e.g. test/Feature ) To fix this I have used the %T substitution variable for llvm-lit. I have also improved some tests by using LLVM's FileCheck tool and removing of hard coded constants for data type size in some places. This commit inevitably breaks running the tests under DejaGNU. Although it is possible to hack by introducing the %T substitution variable some tests would still be broken because the use of shell pipes in DejaGNU doesn't seem to work properly. I could work around this but it's really not worth the effort. --- test/Runtime/POSIX/FD_Fail2.c | 14 +++++++------- test/Runtime/POSIX/FilePerm.c | 6 +++--- test/Runtime/POSIX/FreeArgv.c | 14 +++++++++----- test/Runtime/POSIX/Isatty.c | 13 +++++++++---- test/Runtime/POSIX/Openat.c | 2 +- test/Runtime/POSIX/PrgName.c | 4 ++-- test/Runtime/POSIX/SeedAndFail.c | 8 ++++---- 7 files changed, 35 insertions(+), 26 deletions(-) (limited to 'test/Runtime/POSIX') 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 #include 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 #include 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 #include +// 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 #include 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/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 #include -- cgit 1.4.1 From 2914a43e42184efe46a7b28caccfbb54c781e795 Mon Sep 17 00:00:00 2001 From: Dan Liew Date: Mon, 13 Jan 2014 17:50:27 +0000 Subject: Added Runtime/POSIX/lit.local.cfg file that prevents the POSIX tests from being executed if not enabled at configure time. --- test/Runtime/POSIX/lit.local.cfg | 7 +++++++ 1 file changed, 7 insertions(+) create mode 100644 test/Runtime/POSIX/lit.local.cfg (limited to 'test/Runtime/POSIX') 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 -- cgit 1.4.1 From 48ce6b94f4fe5131242ba87485cd79e081a991ed Mon Sep 17 00:00:00 2001 From: Dan Liew Date: Mon, 13 Jan 2014 18:04:52 +0000 Subject: Only run SELinux test if support for SELinux was detected at configure time. --- test/Makefile | 1 + test/Runtime/POSIX/SELinux.c | 30 ------------------------------ test/Runtime/POSIX/SELinux/SELinux.c | 30 ++++++++++++++++++++++++++++++ test/Runtime/POSIX/SELinux/lit.local.cfg | 7 +++++++ test/lit.site.cfg.in | 1 + 5 files changed, 39 insertions(+), 30 deletions(-) delete mode 100644 test/Runtime/POSIX/SELinux.c create mode 100644 test/Runtime/POSIX/SELinux/SELinux.c create mode 100644 test/Runtime/POSIX/SELinux/lit.local.cfg (limited to 'test/Runtime/POSIX') diff --git a/test/Makefile b/test/Makefile index ea6624d0..23c891e4 100644 --- a/test/Makefile +++ b/test/Makefile @@ -123,4 +123,5 @@ lit.site.cfg: lit.site.cfg.in -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/Runtime/POSIX/SELinux.c b/test/Runtime/POSIX/SELinux.c deleted file mode 100644 index 65dd1a7f..00000000 --- a/test/Runtime/POSIX/SELinux.c +++ /dev/null @@ -1,30 +0,0 @@ -/* 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 -// XFAIL: no-selinux - -#include -#include -#include - -int main(int argc, char** argv) { - - security_context_t con; - - assert(argc == 2); - - int selinux = is_selinux_enabled(); - printf("selinux enabled = %d\n", selinux); - - if (setfscreatecon(argv[1]) < 0) - printf("Error: set\n"); - else printf("Success: set\n"); - - if (getfscreatecon(&con) < 0) - printf("Error: get\n"); - else printf("Success: get\n"); - - printf("create_con = %s\n", con); - - return 0; -} diff --git a/test/Runtime/POSIX/SELinux/SELinux.c b/test/Runtime/POSIX/SELinux/SELinux.c new file mode 100644 index 00000000..65dd1a7f --- /dev/null +++ b/test/Runtime/POSIX/SELinux/SELinux.c @@ -0,0 +1,30 @@ +/* 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 +// XFAIL: no-selinux + +#include +#include +#include + +int main(int argc, char** argv) { + + security_context_t con; + + assert(argc == 2); + + int selinux = is_selinux_enabled(); + printf("selinux enabled = %d\n", selinux); + + if (setfscreatecon(argv[1]) < 0) + printf("Error: set\n"); + else printf("Success: set\n"); + + if (getfscreatecon(&con) < 0) + printf("Error: get\n"); + else printf("Success: get\n"); + + printf("create_con = %s\n", con); + + return 0; +} 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/lit.site.cfg.in b/test/lit.site.cfg.in index 11159415..6fc3d49c 100644 --- a/test/lit.site.cfg.in +++ b/test/lit.site.cfg.in @@ -16,6 +16,7 @@ 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@" -- cgit 1.4.1 From 8a460a94c6a442e22187e8b5b3560bed34460f4b Mon Sep 17 00:00:00 2001 From: Dan Liew Date: Mon, 13 Jan 2014 18:30:12 +0000 Subject: Remove the last remnants (I think) of DejaGNU. Goodbye! Say hello to our new friend, llvm-lit :) --- autoconf/configure.ac | 5 -- autoconf/m4/path_tclsh.m4 | 39 --------- configure | 132 ------------------------------ test/CXX/dg.exp | 3 - test/Coverage/dg.exp | 3 - test/Dogfood/dg.exp | 3 - test/Expr/Lexer/dg.exp | 3 - test/Expr/Parser/dg.exp | 3 - test/Expr/dg.exp | 3 - test/Feature/dg.exp | 3 - test/Makefile | 66 ++------------- test/Programs/dg.exp | 3 - test/Runtime/POSIX/dg.exp | 5 -- test/Runtime/Uclibc/dg.exp | 5 -- test/Solver/dg.exp | 3 - test/TestRunner.sh | 37 +-------- test/lib/llvm.exp | 199 --------------------------------------------- test/regression/dg.exp | 3 - 18 files changed, 10 insertions(+), 508 deletions(-) delete mode 100644 autoconf/m4/path_tclsh.m4 delete mode 100644 test/CXX/dg.exp delete mode 100644 test/Coverage/dg.exp delete mode 100644 test/Dogfood/dg.exp delete mode 100644 test/Expr/Lexer/dg.exp delete mode 100644 test/Expr/Parser/dg.exp delete mode 100644 test/Expr/dg.exp delete mode 100644 test/Feature/dg.exp delete mode 100644 test/Programs/dg.exp delete mode 100644 test/Runtime/POSIX/dg.exp delete mode 100644 test/Runtime/Uclibc/dg.exp delete mode 100644 test/Solver/dg.exp delete mode 100644 test/lib/llvm.exp delete mode 100644 test/regression/dg.exp (limited to 'test/Runtime/POSIX') 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/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/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/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 23c891e4..c27ffad3 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,25 +32,14 @@ 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." -endif +# Potential support in the future for multiple test suites +LIT_ALL_TESTSUITES := $(LIT_TESTSUITE) -check-local-lit:: lit.site.cfg +check-local:: lit.site.cfg # FIXME: Detect python at configure time ( $(ULIMIT) \ python2 $(LLVM_SRC_ROOT)/utils/lit/lit.py $(LIT_ARGS) $(LIT_TESTSUITE) ) @@ -58,26 +47,7 @@ check-local-lit:: lit.site.cfg check-local-all:: lit.site.cfg # FIXME: Detect python at configure time ( $(ULIMIT) \ - python2 $(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 + python2 $(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` @@ -89,28 +59,6 @@ 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: lit.site.cfg.in @echo "Making KLEE 'lit.site.cfg' file..." @sed -e "s#@KLEE_SOURCE_DIR@#$(PROJ_SRC_ROOT)#g" \ 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/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/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/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..ab50856a 100755 --- a/test/TestRunner.sh +++ b/test/TestRunner.sh @@ -1,36 +1,5 @@ #!/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." +exec llvm-lit "$@" 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/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}]] -- cgit 1.4.1