From 4ef867ba48c74023884db11d5e38e77602527b75 Mon Sep 17 00:00:00 2001 From: Ralf Wildenhues Date: Mon, 6 Oct 2008 22:46:57 +0200 Subject: Improve test coverage of current TESTS semantics. * tests/check8.test: New test, for subdir tests and setting of $srcdir. * tests/check9.test: New test, check @substituted@ TESTS. * tests/Makefile.am: Update. Signed-off-by: Ralf Wildenhues --- ChangeLog | 8 +++ aclocal.m4 | 4 +- configure | 208 ++++++++++++++++++++++++++++-------------------------- tests/Makefile.am | 2 + tests/Makefile.in | 2 + tests/check8.test | 94 ++++++++++++++++++++++++ tests/check9.test | 80 +++++++++++++++++++++ 7 files changed, 295 insertions(+), 103 deletions(-) create mode 100755 tests/check8.test create mode 100755 tests/check9.test diff --git a/ChangeLog b/ChangeLog index 895fa3967..324a6b91c 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +2008-10-06 Ralf Wildenhues + + Improve test coverage of current TESTS semantics. + * tests/check8.test: New test, for subdir tests and setting of + $srcdir. + * tests/check9.test: New test, check @substituted@ TESTS. + * tests/Makefile.am: Update. + 2008-10-05 Ralf Wildenhues * m4/minuso.m4 (AM_PROG_CC_C_O): Work around shell quoting issue diff --git a/aclocal.m4 b/aclocal.m4 index 9ea293606..e5004a7c4 100644 --- a/aclocal.m4 +++ b/aclocal.m4 @@ -13,8 +13,8 @@ m4_ifndef([AC_AUTOCONF_VERSION], [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl -m4_if(m4_defn([AC_AUTOCONF_VERSION]), [2.62],, -[m4_warning([this file was generated for autoconf 2.62. +m4_if(m4_defn([AC_AUTOCONF_VERSION]), [2.63],, +[m4_warning([this file was generated for autoconf 2.63. You have another version of autoconf. It may work, but is not guaranteed to. If you have problems, you may need to regenerate the build system entirely. To do so, use the procedure documented by the package, typically `autoreconf'.])]) diff --git a/configure b/configure index 3e51620be..2c2aa4dc2 100755 --- a/configure +++ b/configure @@ -1,6 +1,6 @@ #! /bin/sh # Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.62 for GNU Automake 1.10.1a. +# Generated by GNU Autoconf 2.63 for GNU Automake 1.10.1a. # # Report bugs to . # @@ -601,82 +601,82 @@ PACKAGE_STRING='GNU Automake 1.10.1a' PACKAGE_BUGREPORT='bug-automake@gnu.org' ac_unique_file="automake.in" -ac_subst_vars='SHELL -PATH_SEPARATOR -PACKAGE_NAME -PACKAGE_TARNAME -PACKAGE_VERSION -PACKAGE_STRING -PACKAGE_BUGREPORT -exec_prefix -prefix -program_transform_name -bindir -sbindir -libexecdir -datarootdir -datadir -sysconfdir -sharedstatedir -localstatedir -includedir -oldincludedir -docdir -infodir -htmldir -dvidir -pdfdir -psdir -libdir -localedir -mandir -DEFS -ECHO_C -ECHO_N -ECHO_T -LIBS -build_alias -host_alias -target_alias -build -build_cpu -build_vendor -build_os -am_AUTOCONF -INSTALL_PROGRAM -INSTALL_SCRIPT -INSTALL_DATA -am__isrc -CYGPATH_W -PACKAGE -VERSION -ACLOCAL -AUTOCONF -AUTOMAKE -AUTOHEADER -MAKEINFO -install_sh -STRIP -INSTALL_STRIP_PROGRAM -MKDIR_P -mkdir_p -AWK -SET_MAKE -am__leading_dot -AMTAR -am__tar -am__untar -APIVERSION -pkgvdatadir -PERL -TEX -LN -MODIFICATION_DELAY -GREP -EGREP -FGREP +ac_subst_vars='LTLIBOBJS LIBOBJS -LTLIBOBJS' +FGREP +EGREP +GREP +MODIFICATION_DELAY +LN +TEX +PERL +pkgvdatadir +APIVERSION +am__untar +am__tar +AMTAR +am__leading_dot +SET_MAKE +AWK +mkdir_p +MKDIR_P +INSTALL_STRIP_PROGRAM +STRIP +install_sh +MAKEINFO +AUTOHEADER +AUTOMAKE +AUTOCONF +ACLOCAL +VERSION +PACKAGE +CYGPATH_W +am__isrc +INSTALL_DATA +INSTALL_SCRIPT +INSTALL_PROGRAM +am_AUTOCONF +build_os +build_vendor +build_cpu +build +target_alias +host_alias +build_alias +LIBS +ECHO_T +ECHO_N +ECHO_C +DEFS +mandir +localedir +libdir +psdir +pdfdir +dvidir +htmldir +infodir +docdir +oldincludedir +includedir +localstatedir +sharedstatedir +sysconfdir +datadir +datarootdir +libexecdir +sbindir +bindir +program_transform_name +prefix +exec_prefix +PACKAGE_BUGREPORT +PACKAGE_STRING +PACKAGE_VERSION +PACKAGE_TARNAME +PACKAGE_NAME +PATH_SEPARATOR +SHELL' ac_subst_files='' ac_user_opts=' enable_option_checking @@ -1106,9 +1106,9 @@ fi if test -n "$ac_unrecognized_opts"; then case $enable_option_checking in no) ;; - fatal) { $as_echo "$as_me: error: Unrecognized options: $ac_unrecognized_opts" >&2 + fatal) { $as_echo "$as_me: error: unrecognized options: $ac_unrecognized_opts" >&2 { (exit 1); exit 1; }; } ;; - *) $as_echo "$as_me: WARNING: Unrecognized options: $ac_unrecognized_opts" >&2 ;; + *) $as_echo "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2 ;; esac fi @@ -1161,7 +1161,7 @@ test "$silent" = yes && exec 6>/dev/null ac_pwd=`pwd` && test -n "$ac_pwd" && ac_ls_di=`ls -di .` && ac_pwd_ls_di=`cd "$ac_pwd" && ls -di .` || - { $as_echo "$as_me: error: Working directory cannot be determined" >&2 + { $as_echo "$as_me: error: working directory cannot be determined" >&2 { (exit 1); exit 1; }; } test "X$ac_ls_di" = "X$ac_pwd_ls_di" || { $as_echo "$as_me: error: pwd does not report name of working directory" >&2 @@ -1373,7 +1373,7 @@ test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF GNU Automake configure 1.10.1a -generated by GNU Autoconf 2.62 +generated by GNU Autoconf 2.63 Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc. @@ -1387,7 +1387,7 @@ This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. It was created by GNU Automake $as_me 1.10.1a, which was -generated by GNU Autoconf 2.62. Invocation command line was +generated by GNU Autoconf 2.63. Invocation command line was $ $0 $@ @@ -1510,8 +1510,8 @@ _ASBOX case $ac_val in #( *${as_nl}*) case $ac_var in #( - *_cv_*) { $as_echo "$as_me:$LINENO: WARNING: Cache variable $ac_var contains a newline." >&5 -$as_echo "$as_me: WARNING: Cache variable $ac_var contains a newline." >&2;} ;; + *_cv_*) { $as_echo "$as_me:$LINENO: WARNING: cache variable $ac_var contains a newline" >&5 +$as_echo "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;; esac case $ac_var in #( _ | IFS | as_nl) ;; #( @@ -1714,6 +1714,8 @@ $as_echo "$as_me: current value: \`$ac_new_val'" >&2;} fi done if $ac_cache_corrupted; then + { $as_echo "$as_me:$LINENO: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} { $as_echo "$as_me:$LINENO: error: changes in the environment can compromise the build" >&5 $as_echo "$as_me: error: changes in the environment can compromise the build" >&2;} { { $as_echo "$as_me:$LINENO: error: run \`make distclean' and/or \`rm $cache_file' and start over" >&5 @@ -2273,12 +2275,8 @@ fi else case $cross_compiling:$ac_tool_warned in yes:) -{ $as_echo "$as_me:$LINENO: WARNING: In the future, Autoconf will not detect cross-tools -whose name does not start with the host triplet. If you think this -configuration is useful to you, please write to autoconf@gnu.org." >&5 -$as_echo "$as_me: WARNING: In the future, Autoconf will not detect cross-tools -whose name does not start with the host triplet. If you think this -configuration is useful to you, please write to autoconf@gnu.org." >&2;} +{ $as_echo "$as_me:$LINENO: WARNING: using cross tools not prefixed with host triplet" >&5 +$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac STRIP=$ac_ct_STRIP @@ -2780,8 +2778,8 @@ _ACEOF case $ac_val in #( *${as_nl}*) case $ac_var in #( - *_cv_*) { $as_echo "$as_me:$LINENO: WARNING: Cache variable $ac_var contains a newline." >&5 -$as_echo "$as_me: WARNING: Cache variable $ac_var contains a newline." >&2;} ;; + *_cv_*) { $as_echo "$as_me:$LINENO: WARNING: cache variable $ac_var contains a newline" >&5 +$as_echo "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;; esac case $ac_var in #( _ | IFS | as_nl) ;; #( @@ -3209,7 +3207,7 @@ exec 6>&1 # values after options handling. ac_log=" This file was extended by GNU Automake $as_me 1.10.1a, which was -generated by GNU Autoconf 2.62. Invocation command line was +generated by GNU Autoconf 2.63. Invocation command line was CONFIG_FILES = $CONFIG_FILES CONFIG_HEADERS = $CONFIG_HEADERS @@ -3222,6 +3220,12 @@ on `(hostname || uname -n) 2>/dev/null | sed 1q` _ACEOF +case $ac_config_files in *" +"*) set x $ac_config_files; shift; ac_config_files=$*;; +esac + + + cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 # Files that config.status was made for. config_files="$ac_config_files" @@ -3233,14 +3237,15 @@ ac_cs_usage="\ \`$as_me' instantiates files from templates according to the current configuration. -Usage: $0 [OPTIONS] [FILE]... +Usage: $0 [OPTION]... [FILE]... -h, --help print this help, then exit -V, --version print version number and configuration settings, then exit - -q, --quiet do not print progress messages + -q, --quiet, --silent + do not print progress messages -d, --debug don't remove temporary files --recheck update $as_me by reconfiguring in the same conditions - --file=FILE[:TEMPLATE] + --file=FILE[:TEMPLATE] instantiate the configuration file FILE Configuration files: @@ -3252,7 +3257,7 @@ _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_cs_version="\\ GNU Automake config.status 1.10.1a -configured by $0, generated by GNU Autoconf 2.62, +configured by $0, generated by GNU Autoconf 2.63, with options \\"`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`\\" Copyright (C) 2008 Free Software Foundation, Inc. @@ -3452,7 +3457,8 @@ for ac_last_try in false false false false false :; do $as_echo "$as_me: error: could not make $CONFIG_STATUS" >&2;} { (exit 1); exit 1; }; } - if test `sed -n "s/.*$ac_delim\$/X/p" conf$$subs.awk | grep -c X` = $ac_delim_num; then + ac_delim_n=`sed -n "s/.*$ac_delim\$/X/p" conf$$subs.awk | grep -c X` + if test $ac_delim_n = $ac_delim_num; then break elif $ac_last_try; then { { $as_echo "$as_me:$LINENO: error: could not make $CONFIG_STATUS" >&5 @@ -3579,8 +3585,8 @@ do esac case $ac_mode$ac_tag in :[FHL]*:*);; - :L* | :C*:*) { { $as_echo "$as_me:$LINENO: error: Invalid tag $ac_tag." >&5 -$as_echo "$as_me: error: Invalid tag $ac_tag." >&2;} + :L* | :C*:*) { { $as_echo "$as_me:$LINENO: error: invalid tag $ac_tag" >&5 +$as_echo "$as_me: error: invalid tag $ac_tag" >&2;} { (exit 1); exit 1; }; };; :[FH]-) ac_tag=-:-;; :[FH]*) ac_tag=$ac_tag:$ac_tag.in;; @@ -3886,7 +3892,7 @@ if test "$no_create" != yes; then $ac_cs_success || { (exit 1); exit 1; } fi if test -n "$ac_unrecognized_opts" && test "$enable_option_checking" != no; then - { $as_echo "$as_me:$LINENO: WARNING: Unrecognized options: $ac_unrecognized_opts" >&5 -$as_echo "$as_me: WARNING: Unrecognized options: $ac_unrecognized_opts" >&2;} + { $as_echo "$as_me:$LINENO: WARNING: unrecognized options: $ac_unrecognized_opts" >&5 +$as_echo "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2;} fi diff --git a/tests/Makefile.am b/tests/Makefile.am index 522706053..42da07173 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -89,6 +89,8 @@ check4.test \ check5.test \ check6.test \ check7.test \ +check8.test \ +check9.test \ checkall.test \ clean.test \ clean2.test \ diff --git a/tests/Makefile.in b/tests/Makefile.in index a761e660f..eec4ecfce 100644 --- a/tests/Makefile.in +++ b/tests/Makefile.in @@ -222,6 +222,8 @@ check4.test \ check5.test \ check6.test \ check7.test \ +check8.test \ +check9.test \ checkall.test \ clean.test \ clean2.test \ diff --git a/tests/check8.test b/tests/check8.test new file mode 100755 index 000000000..242be5627 --- /dev/null +++ b/tests/check8.test @@ -0,0 +1,94 @@ +#! /bin/sh +# Copyright (C) 2008 Free Software Foundation, Inc. +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 3, or (at your option) +# any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . + +# Check subdir TESTS. + +. ./defs || Exit 1 + +set -e + +cat >> configure.in << 'END' +AC_PROG_CC +AM_PROG_CC_C_O +AC_OUTPUT +END + +cat > Makefile.am << 'END' +AUTOMAKE_OPTIONS = subdir-objects +TESTS = foo sub/foo $(check_PROGRAMS) +XFAIL_TESTS = foo sub/baz +check_PROGRAMS = bar sub/bar baz sub/baz +END + +mkdir sub + +cat >>foo <<'END' +#! /bin/sh +test -f "$srcdir/Makefile.am" +END +cat >>sub/foo <<'END' +#! /bin/sh +test -f "$srcdir/Makefile.am" +END +chmod a+x foo sub/foo + +cat >>bar.c <<'END' +int main() { return 0; } +END +cat >>sub/bar.c <<'END' +int main() { return 0; } +END +cat >>baz.c <<'END' +#include +int main() { return EXIT_FAILURE; } +END +cat >>sub/baz.c <<'END' +#include +int main() { return EXIT_FAILURE; } +END + +$ACLOCAL +$AUTOCONF +$AUTOMAKE -a + +unset TESTS || : + +./configure +AM_COLOR_TESTS=always $MAKE -e check >stdout && { cat stdout; Exit 1; } +cat stdout +grep 'XPASS.* foo$' stdout +grep '^[^X]*PASS.* sub/foo$' stdout +grep '^[^X]*PASS.* bar$' stdout +grep '^[^X]*PASS.* sub/bar$' stdout +grep '^[^X]*FAIL.* baz$' stdout +grep 'XFAIL.* sub/baz$' stdout + +$MAKE distclean + +mkdir build +cd build +../configure +$MAKE check >stdout && { cat stdout; Exit 1; } +cat stdout +# Note: we are not grepping for the space here, due to the Solaris make VPATH +# rewriting (if we fix that, we can still write a separate test for it). +grep 'XPASS.*foo$' stdout +grep '^[^X]*PASS.*sub/foo$' stdout +grep '^[^X]*PASS.*bar$' stdout +grep '^[^X]*PASS.*sub/bar$' stdout +grep '^[^X]*FAIL.*baz$' stdout +grep 'XFAIL.*sub/baz$' stdout +: diff --git a/tests/check9.test b/tests/check9.test new file mode 100755 index 000000000..91c37c5eb --- /dev/null +++ b/tests/check9.test @@ -0,0 +1,80 @@ +#! /bin/sh +# Copyright (C) 2008 Free Software Foundation, Inc. +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 3, or (at your option) +# any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . + +# Check @substituted@ TESTS. +# Note that in this test, we rely on the .test extension for the +# substituted names: this is necessary for parallel-tests. + +. ./defs || Exit 1 + +set -e + +cat >> configure.in << 'END' +AC_PROG_CC +AC_SUBST([script_tests], ['subst-pass-script.test subst-xfail-script.test']) +AC_SUBST([prog_tests], ['subst-pass-prog.test$(EXEEXT) subst-xfail-prog.test$(EXEEXT)']) +AC_SUBST([xfail_tests], ['xfail-script.test subst-xfail-script.test xfail-prog subst-xfail-prog.test$(EXEEXT)']) +AC_OUTPUT +END + +cat > Makefile.am << 'END' +TESTS = pass-script.test xfail-script.test @script_tests@ $(check_PROGRAMS) +XFAIL_TESTS = @xfail_tests@ +check_PROGRAMS = pass-prog xfail-prog @prog_tests@ +EXTRA_PROGRAMS = subst-pass-prog.test subst-xfail-prog.test +END + +cat >>pass-script.test <<'END' +#! /bin/sh +exit 0 +END +cat >>xfail-script.test <<'END' +#! /bin/sh +exit 1 +END +chmod a+x pass-script.test xfail-script.test +cp pass-script.test subst-pass-script.test +cp xfail-script.test subst-xfail-script.test + +cat >>pass-prog.c <<'END' +int main() { return 0; } +END +cat >>xfail-prog.c <<'END' +#include +int main() { return EXIT_FAILURE; } +END +# The .test extension is removed for the default source file name: +cp pass-prog.c subst-pass-prog.c +cp xfail-prog.c subst-xfail-prog.c + +$ACLOCAL +$AUTOCONF +$AUTOMAKE -a + +unset TESTS || : + +./configure +$MAKE all +$MAKE check +$MAKE distclean + +mkdir build +cd build +../configure +$MAKE all +$MAKE check +$MAKE distclean +: -- cgit v1.2.3