From d18888242ec6b30444d6353290ecbcc8a6d05ce2 Mon Sep 17 00:00:00 2001 From: Daniel Dunbar <daniel@zuster.org> Date: Tue, 8 May 2012 18:26:07 +0000 Subject: [PATCH] Revert r156393, "[tests] Remove some remaining DejaGNU related cruft.", this patch wasn't ready yet. llvm-svn: 156395 --- llvm/autoconf/configure.ac | 4 + llvm/configure | 177 +++++++++++++++++++++++++++++++++++- llvm/docs/TestingGuide.html | 32 ++++--- llvm/test/Makefile | 43 ++++++++- 4 files changed, 241 insertions(+), 15 deletions(-) diff --git a/llvm/autoconf/configure.ac b/llvm/autoconf/configure.ac index 1b7dcf8b64a9..0f488ab59942 100644 --- a/llvm/autoconf/configure.ac +++ b/llvm/autoconf/configure.ac @@ -1026,13 +1026,17 @@ dnl something if the tool was available. AC_PATH_PROG(BZIP2, [bzip2]) AC_PATH_PROG(CAT, [cat]) AC_PATH_PROG(DOXYGEN, [doxygen]) +AC_PATH_PROG(GROFF, [groff]) AC_PATH_PROG(GZIPBIN, [gzip]) +AC_PATH_PROG(PDFROFF, [pdfroff]) +AC_PATH_PROG(RUNTEST, [runtest]) DJ_AC_PATH_TCLSH AC_PATH_PROG(ZIP, [zip]) AC_PATH_PROGS(OCAMLC, [ocamlc]) AC_PATH_PROGS(OCAMLOPT, [ocamlopt]) AC_PATH_PROGS(OCAMLDEP, [ocamldep]) AC_PATH_PROGS(OCAMLDOC, [ocamldoc]) +AC_PATH_PROGS(GAS, [gas as]) dnl Get the version of the linker in use. AC_LINK_GET_VERSION diff --git a/llvm/configure b/llvm/configure index fe1f0afdc464..348436fc4d28 100755 --- a/llvm/configure +++ b/llvm/configure @@ -741,13 +741,17 @@ INSTALL_DATA BZIP2 CAT DOXYGEN +GROFF GZIPBIN +PDFROFF +RUNTEST TCLSH ZIP OCAMLC OCAMLOPT OCAMLDEP OCAMLDOC +GAS HAVE_LINK_VERSION_SCRIPT INSTALL_LTDL_TRUE INSTALL_LTDL_FALSE @@ -7113,6 +7117,46 @@ echo "${ECHO_T}no" >&6; } fi +# Extract the first word of "groff", so it can be a program name with args. +set dummy groff; ac_word=$2 +{ echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; } +if test "${ac_cv_path_GROFF+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + case $GROFF in + [\\/]* | ?:[\\/]*) + ac_cv_path_GROFF="$GROFF" # 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 { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_path_GROFF="$as_dir/$ac_word$ac_exec_ext" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done +IFS=$as_save_IFS + + ;; +esac +fi +GROFF=$ac_cv_path_GROFF +if test -n "$GROFF"; then + { echo "$as_me:$LINENO: result: $GROFF" >&5 +echo "${ECHO_T}$GROFF" >&6; } +else + { echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6; } +fi + + # Extract the first word of "gzip", so it can be a program name with args. set dummy gzip; ac_word=$2 { echo "$as_me:$LINENO: checking for $ac_word" >&5 @@ -7153,6 +7197,86 @@ echo "${ECHO_T}no" >&6; } fi +# Extract the first word of "pdfroff", so it can be a program name with args. +set dummy pdfroff; ac_word=$2 +{ echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; } +if test "${ac_cv_path_PDFROFF+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + case $PDFROFF in + [\\/]* | ?:[\\/]*) + ac_cv_path_PDFROFF="$PDFROFF" # 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 { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_path_PDFROFF="$as_dir/$ac_word$ac_exec_ext" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done +IFS=$as_save_IFS + + ;; +esac +fi +PDFROFF=$ac_cv_path_PDFROFF +if test -n "$PDFROFF"; then + { echo "$as_me:$LINENO: result: $PDFROFF" >&5 +echo "${ECHO_T}$PDFROFF" >&6; } +else + { echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6; } +fi + + +# Extract the first word of "runtest", so it can be a program name with args. +set dummy runtest; ac_word=$2 +{ echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; } +if test "${ac_cv_path_RUNTEST+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&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 { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_path_RUNTEST="$as_dir/$ac_word$ac_exec_ext" + echo "$as_me:$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 + { echo "$as_me:$LINENO: result: $RUNTEST" >&5 +echo "${ECHO_T}$RUNTEST" >&6; } +else + { echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6; } +fi + + no_itcl=true { echo "$as_me:$LINENO: checking for the tclsh program in tclinclude directory" >&5 @@ -7463,6 +7587,51 @@ fi test -n "$OCAMLDOC" && break done +for ac_prog in gas as +do + # Extract the first word of "$ac_prog", so it can be a program name with args. +set dummy $ac_prog; ac_word=$2 +{ echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; } +if test "${ac_cv_path_GAS+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + case $GAS in + [\\/]* | ?:[\\/]*) + ac_cv_path_GAS="$GAS" # 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 { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_path_GAS="$as_dir/$ac_word$ac_exec_ext" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done +IFS=$as_save_IFS + + ;; +esac +fi +GAS=$ac_cv_path_GAS +if test -n "$GAS"; then + { echo "$as_me:$LINENO: result: $GAS" >&5 +echo "${ECHO_T}$GAS" >&6; } +else + { echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6; } +fi + + + test -n "$GAS" && break +done + { echo "$as_me:$LINENO: checking for linker version" >&5 echo $ECHO_N "checking for linker version... $ECHO_C" >&6; } @@ -10155,7 +10324,7 @@ else lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext <<EOF -#line 10158 "configure" +#line 10327 "configure" #include "confdefs.h" #if HAVE_DLFCN_H @@ -21975,13 +22144,17 @@ INSTALL_DATA!$INSTALL_DATA$ac_delim BZIP2!$BZIP2$ac_delim CAT!$CAT$ac_delim DOXYGEN!$DOXYGEN$ac_delim +GROFF!$GROFF$ac_delim GZIPBIN!$GZIPBIN$ac_delim +PDFROFF!$PDFROFF$ac_delim +RUNTEST!$RUNTEST$ac_delim TCLSH!$TCLSH$ac_delim ZIP!$ZIP$ac_delim OCAMLC!$OCAMLC$ac_delim OCAMLOPT!$OCAMLOPT$ac_delim OCAMLDEP!$OCAMLDEP$ac_delim OCAMLDOC!$OCAMLDOC$ac_delim +GAS!$GAS$ac_delim HAVE_LINK_VERSION_SCRIPT!$HAVE_LINK_VERSION_SCRIPT$ac_delim INSTALL_LTDL_TRUE!$INSTALL_LTDL_TRUE$ac_delim INSTALL_LTDL_FALSE!$INSTALL_LTDL_FALSE$ac_delim @@ -22021,7 +22194,7 @@ LIBOBJS!$LIBOBJS$ac_delim LTLIBOBJS!$LTLIBOBJS$ac_delim _ACEOF - if test `sed -n "s/.*$ac_delim\$/X/p" conf$$subs.sed | grep -c X` = 86; then + if test `sed -n "s/.*$ac_delim\$/X/p" conf$$subs.sed | grep -c X` = 90; then break elif $ac_last_try; then { { echo "$as_me:$LINENO: error: could not make $CONFIG_STATUS" >&5 diff --git a/llvm/docs/TestingGuide.html b/llvm/docs/TestingGuide.html index 18c355058915..1f9c9157306c 100644 --- a/llvm/docs/TestingGuide.html +++ b/llvm/docs/TestingGuide.html @@ -309,22 +309,23 @@ clang/test directory. </p> <a href="http://llvm.org/cmds/lit.html">Lit documentation</a> for more information. </p> - <p>The <tt>lit</tt> test runner looks at each file that is passed to it and - gathers any lines together that match "RUN:". These are the "RUN" lines that - specify how the test is to be run. So, each test script must contain RUN lines - if it is to do anything. If there are no RUN lines, <tt>lit</tt> function will - issue an error and the test will fail.</p> + <p>The <tt>llvm-runtests</tt> function looks at each file that is passed to + it and gathers any lines together that match "RUN:". These are the "RUN" lines + that specify how the test is to be run. So, each test script must contain + RUN lines if it is to do anything. If there are no RUN lines, the + <tt>llvm-runtests</tt> function will issue an error and the test will + fail.</p> <p>RUN lines are specified in the comments of the test program using the keyword <tt>RUN</tt> followed by a colon, and lastly the command (pipeline) to execute. Together, these lines form the "script" that - <tt>lit</tt> executes to run the test case. The syntax of the RUN lines is - similar to a shell's syntax for pipelines including I/O redirection and - variable substitution. However, even though these lines may <i>look</i> like - a shell script, they are not. RUN lines are interpreted directly by the - Tcl <tt>exec</tt> command. They are never executed by a shell. Consequently - the syntax differs from normal shell script syntax in a few ways. You can - specify as many RUN lines as needed.</p> + <tt>llvm-runtests</tt> executes to run the test case. The syntax of the + RUN lines is similar to a shell's syntax for pipelines including I/O + redirection and variable substitution. However, even though these lines + may <i>look</i> like a shell script, they are not. RUN lines are interpreted + directly by the Tcl <tt>exec</tt> command. They are never executed by a + shell. Consequently the syntax differs from normal shell script syntax in a + few ways. You can specify as many RUN lines as needed.</p> <p>lit performs substitution on each RUN line to replace LLVM tool names with the full paths to the executable built for each tool (in @@ -812,6 +813,13 @@ define two separate CHECK lines that match on the same line. </pre> </div> + <p>To make the output more useful, the <tt>llvm_runtest</tt> function wil + scan the lines of the test case for ones that contain a pattern that matches + PR[0-9]+. This is the syntax for specifying a PR (Problem Report) number that + is related to the test case. The number after "PR" specifies the LLVM bugzilla + number. When a PR number is specified, it will be used in the pass/fail + reporting. This is useful to quickly get some context when a test fails.</p> + <p>Finally, any line that contains "END." will cause the special interpretation of lines to terminate. This is generally done right after the last RUN: line. This has two side effects: (a) it prevents special diff --git a/llvm/test/Makefile b/llvm/test/Makefile index 01a07bfec329..a4e53f8d03f8 100644 --- a/llvm/test/Makefile +++ b/llvm/test/Makefile @@ -27,6 +27,7 @@ $(warning GREP_OPTIONS environment variable may interfere with test results) endif ifdef VERBOSE +RUNTESTFLAGS := $(VERBOSE) LIT_ARGS := -v else LIT_ARGS := -s -v @@ -41,6 +42,7 @@ ifdef TESTSUITE LIT_TESTSUITE := $(TESTSUITE) CLEANED_TESTSUITE := $(patsubst %/,%,$(TESTSUITE)) CLEANED_TESTSUITE := $(patsubst test/%,%,$(CLEANED_TESTSUITE)) +RUNTESTFLAGS += --tool $(CLEANED_TESTSUITE) else LIT_TESTSUITE := . endif @@ -74,6 +76,10 @@ ifndef RUNLLVM2CPP IGNORE_TESTS += llvm2cpp.exp endif +ifdef IGNORE_TESTS +RUNTESTFLAGS += --ignore "$(strip $(IGNORE_TESTS))" +endif + # ulimits like these are redundantly enforced by the buildbots, so # just removing them here won't work. # Both AuroraUX & Solaris do not have the -m flag for ulimit @@ -88,6 +94,16 @@ ULIMIT=ulimit -t 600 ; ulimit -d 512000 ; ulimit -m 512000 ; ulimit -v 1024000 ; endif # AuroraUX endif # SunOS +ifneq ($(RUNTEST),) +check-local-dg:: site.exp + ( $(ULIMIT) \ + PATH="$(LLVMToolDir):$(LLVM_SRC_ROOT)/test/Scripts:$(LLVMGCCDIR)/bin:$(PATH)" \ + $(RUNTEST) $(RUNTESTFLAGS) ) +else +check-local-dg:: site.exp + @echo "*** dejagnu not found. Make sure 'runtest' is in your PATH, then reconfigure LLVM." +endif + check-local-lit:: lit.site.cfg Unit/lit.site.cfg ( $(ULIMIT) \ $(LLVM_SRC_ROOT)/utils/lit/lit.py $(LIT_ARGS) $(LIT_TESTSUITE) ) @@ -113,13 +129,38 @@ endif FORCE: +site.exp: FORCE + @echo 'Making a new site.exp file...' + @echo '## Autogenerated by LLVM configuration.' > site.tmp + @echo '# Do not edit!' >> site.tmp + @echo 'set target_triplet "$(TARGET_TRIPLE)"' >> site.tmp + @echo 'set TARGETS_TO_BUILD "$(TARGETS_TO_BUILD)"' >> site.tmp + @echo 'set llvmshlibdir "$(SharedLibDir)"' >>site.tmp + @echo 'set llvm_bindings "$(BINDINGS_TO_BUILD)"' >> site.tmp + @echo 'set srcroot "$(LLVM_SRC_ROOT)"' >>site.tmp + @echo 'set objroot "$(LLVM_OBJ_ROOT)"' >>site.tmp + @echo 'set srcdir "$(LLVM_SRC_ROOT)/test"' >>site.tmp + @echo 'set objdir "$(LLVM_OBJ_ROOT)/test"' >>site.tmp + @echo 'set link "' $(CXX) $(CPP.Flags) $(CXX.Flags) $(TargetCommonOpts) $(CompileCommonOpts) $(LD.Flags) '"' >>site.tmp + @echo 'set shlibext "$(SHLIBEXT)"' >> site.tmp + @echo 'set ocamlopt "$(OCAMLOPT) -cc \"$(CXX_FOR_OCAMLOPT)\" -I $(LibDir)/ocaml"' >> site.tmp + @echo 'set valgrind "$(VALGRIND)"' >> site.tmp + @echo 'set grep "$(GREP)"' >>site.tmp + @echo 'set gas "$(GAS)"' >>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 + ifeq ($(DISABLE_ASSERTIONS),1) ENABLE_ASSERTIONS=0 else ENABLE_ASSERTIONS=1 endif -lit.site.cfg: FORCE +lit.site.cfg: site.exp @echo "Making LLVM 'lit.site.cfg' file..." @$(ECHOPATH) s=@LLVM_SOURCE_DIR@=$(LLVM_SRC_ROOT)=g > lit.tmp @$(ECHOPATH) s=@LLVM_BINARY_DIR@=$(LLVM_OBJ_ROOT)=g >> lit.tmp