From a03bb70a8903b1726168f43a99f55732907aef00 Mon Sep 17 00:00:00 2001 From: Stefano Lattarini Date: Mon, 21 Jun 2010 17:47:28 +0200 Subject: [PATCH] Minor improvements and fixes in tests `depcomp*.test'. * tests/depcomp.test: Do not create useless dummy source files. Add a trailing `:' command. * tests/depcomp2.test: Use `unset' on the CFLAG variable to ensure it's not in in the environment, rather tthan exporting it with an empty value. Do not pass CC=gcc to configure, as that's already done in ./defs since we have gcc in $required. Ensure verbose printing of captured stderr, and normalize its checking. Add a trailing `:' command. * tests/depcomp3.test: Quote literal dots and dollar characters in grep regexps. Always use `: >' rather than `touch' to create empty files. Explicitly declare phony targets as such in the created Makefile.am. Add a trailing `:' command. * tests/depcomp4.test: Quote literal dots and dollar characters in grep regexp. Explicitly declare phony targets as such in the created Makefile.am. Ensure verbose printing of captured makes' stoud/stderr. Add a trailing `:' command. * tests/depcomp5.test: Move setting of `errexit' shell flag earlier in the script (just after inclusion of ./defs). Quote literal dots and dollar characters in grep regexps. Explicitly declare phony targets as such in the created Makefile.am. Add a trailing `:' command. * tests/depcomp6.test: Consistenty use m4 quoting in the generated configure.in. Cosmetic fixes to spacing. Make the "dummy" `if' statement required by OpenBSD's sh `set -e' more robust, and add explanatory comments to it. * tests/depcomp7.test: Likewise, and add a trailing `:' command. --- ChangeLog | 28 ++++++++++++++++++++++++++++ tests/depcomp.test | 5 ++--- tests/depcomp2.test | 9 +++++---- tests/depcomp3.test | 9 ++++++--- tests/depcomp4.test | 9 ++++++--- tests/depcomp5.test | 11 +++++++---- tests/depcomp6.test | 13 +++++++++---- tests/depcomp7.test | 16 ++++++++++++---- 8 files changed, 75 insertions(+), 25 deletions(-) diff --git a/ChangeLog b/ChangeLog index 6c59e4628..f13d3e831 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,33 @@ 2010-08-08 Stefano Lattarini + Minor improvements and fixes in tests `depcomp*.test'. + * tests/depcomp.test: Do not create useless dummy source files. + Add a trailing `:' command. + * tests/depcomp2.test: Use `unset' on the CFLAG variable to ensure + it's not in in the environment, rather tthan exporting it with an + empty value. Do not pass CC=gcc to configure, as that's already + done in ./defs since we have gcc in $required. Ensure verbose + printing of captured stderr, and normalize its checking. Add a + trailing `:' command. + * tests/depcomp3.test: Quote literal dots and dollar characters in + grep regexps. Always use `: >' rather than `touch' to create empty + files. Explicitly declare phony targets as such in the created + Makefile.am. Add a trailing `:' command. + * tests/depcomp4.test: Quote literal dots and dollar characters in + grep regexp. Explicitly declare phony targets as such in the + created Makefile.am. Ensure verbose printing of captured makes' + stoud/stderr. Add a trailing `:' command. + * tests/depcomp5.test: Move setting of `errexit' shell flag earlier + in the script (just after inclusion of ./defs). Quote literal dots + and dollar characters in grep regexps. Explicitly declare phony + targets as such in the created Makefile.am. Add a trailing `:' + command. + * tests/depcomp6.test: Consistenty use m4 quoting in the generated + configure.in. Cosmetic fixes to spacing. Make the "dummy" `if' + statement required by OpenBSD's sh `set -e' more robust, and add + explanatory comments to it. + * tests/depcomp7.test: Likewise, and add a trailing `:' command. + Separate failing part of test `all.test'. * tests/all.test: Keep only (x)failing part of the test. Working checks moved out to ... diff --git a/tests/depcomp.test b/tests/depcomp.test index 8b9be2948..d5b6c7835 100755 --- a/tests/depcomp.test +++ b/tests/depcomp.test @@ -40,12 +40,11 @@ END cp subdir/Makefile.am subdir2/Makefile.am -: > subdir/foo.c -: > subdir2/foo.c - $ACLOCAL $AUTOMAKE --add-missing # There used to be a bug where this was created in the first subdir with C # sources in it instead of in $top_srcdir or $ac_auxdir test -f depcomp + +: diff --git a/tests/depcomp2.test b/tests/depcomp2.test index 2b4353c51..e8e4a6728 100755 --- a/tests/depcomp2.test +++ b/tests/depcomp2.test @@ -43,11 +43,12 @@ END : > subdir/foo.c # Ignore user CFLAGS. -CFLAGS= -export CFLAGS +unset CFLAGS || : $ACLOCAL $AUTOMAKE --add-missing $AUTOCONF -./configure CC='gcc' 2>error.log -test -z "`cat error.log`" +./configure 2>stderr || { cat stderr >&2; Exit 1; } +test ! -s stderr + +: diff --git a/tests/depcomp3.test b/tests/depcomp3.test index 2a5db6049..513a01d54 100755 --- a/tests/depcomp3.test +++ b/tests/depcomp3.test @@ -1,5 +1,5 @@ #! /bin/sh -# Copyright (C) 2003 Free Software Foundation, Inc. +# Copyright (C) 2003, 2010 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 @@ -32,14 +32,15 @@ AUTOMAKE_OPTIONS = subdir-objects check_PROGRAMS = prg prg_SOURCES = src/sub.c src/foo.h +.PHONY: grepdeps grepdeps: - grep 'src/sub.$(OBJEXT).*:' src/$(DEPDIR)/sub.Po + grep 'src/sub\.\$(OBJEXT).*:' src/$(DEPDIR)/sub.Po END mkdir src -touch src/foo.h +: > src/foo.h cat >src/sub.c < Makefile.am << 'END' noinst_LTLIBRARIES = liba.la liba_la_SOURCES = a.c foo.h +.PHONY: grepdeps grepdeps: - grep 'a.lo *:' ./$(DEPDIR)/a.Plo + grep 'a\.lo *:' ./$(DEPDIR)/a.Plo END : > foo.h @@ -51,7 +52,9 @@ $AUTOMAKE -a grep am_cv_CC_dependencies_compiler_type configure ./configure am_cv_CC_dependencies_compiler_type=makedepend -$MAKE >output 2>&1 +$MAKE >output 2>&1 || { cat output; Exit 1; } cat output grep 'unknown directive' output && Exit 1 $MAKE grepdeps + +: diff --git a/tests/depcomp5.test b/tests/depcomp5.test index 9637288c4..9a4e1b148 100755 --- a/tests/depcomp5.test +++ b/tests/depcomp5.test @@ -1,5 +1,5 @@ #! /bin/sh -# Copyright (C) 2003, 2004 Free Software Foundation, Inc. +# Copyright (C) 2003, 2004, 2010 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 @@ -19,6 +19,8 @@ required='icc' . ./defs || Exit 1 +set -e + # Automake supports icc since version 7.0 through a dedicated depcomp mode. # icc 8.0 and greater understand gcc options, so depmode is set to gcc. if icc -V -help 2>&1 | grep 'Version 7'; then @@ -27,8 +29,6 @@ else expect='depmode=gcc' fi -set -e - cat >> configure.in << 'END' AC_PROG_CC AM_PROG_CC_C_O @@ -40,8 +40,9 @@ AUTOMAKE_OPTIONS = subdir-objects check_PROGRAMS = prg prg_SOURCES = src/sub.c src/foo.h +.PHONY: grepdeps grepdeps: - grep 'src/sub.$(OBJEXT).*:' src/$(DEPDIR)/sub.Po + grep 'src/sub\.\$(OBJEXT).*:' src/$(DEPDIR)/sub.Po END @@ -66,3 +67,5 @@ $AUTOMAKE -a grep "$expect" Makefile $MAKE check $MAKE grepdeps + +: diff --git a/tests/depcomp6.test b/tests/depcomp6.test index 0b6a7f540..7fc651f60 100755 --- a/tests/depcomp6.test +++ b/tests/depcomp6.test @@ -1,5 +1,5 @@ #! /bin/sh -# Copyright (C) 2006 Free Software Foundation, Inc. +# Copyright (C) 2006, 2010 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 @@ -24,7 +24,7 @@ cat >> configure.in << 'END' AC_PROG_CC AM_PROG_CC_C_O AC_PROG_RANLIB -AC_CONFIG_FILES(sub2/Makefile) +AC_CONFIG_FILES([sub2/Makefile]) AC_OUTPUT END @@ -86,7 +86,7 @@ $AUTOCONF $AUTOMAKE -a ./configure --enable-dependency-tracking -$MAKE +$MAKE # check that dependency tracking works if grep 'depmode=none' Makefile; then : @@ -94,6 +94,11 @@ else cd sub2 $sleep echo 'choke me' > sub3/ba3.h - if $MAKE; then Exit 1; fi + # Do not use `$MAKE && Exit 1' here, since even relatively-recent + # versions of the BSD shell wrongly exit when the `errexit' shell + # flag is active if a command within "&&" fails inside a compound + # statement. + if $MAKE; then Exit 1; else :; fi fi + : diff --git a/tests/depcomp7.test b/tests/depcomp7.test index 67702c781..695041af5 100755 --- a/tests/depcomp7.test +++ b/tests/depcomp7.test @@ -1,5 +1,5 @@ #! /bin/sh -# Copyright (C) 2006, 2007 Free Software Foundation, Inc. +# Copyright (C) 2006, 2007, 2010 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 @@ -25,7 +25,7 @@ cat >> configure.in << 'END' AC_PROG_CC AM_PROG_CC_C_O AM_PROG_LIBTOOL -AC_CONFIG_FILES(sub2/Makefile) +AC_CONFIG_FILES([sub2/Makefile]) AC_OUTPUT END @@ -88,8 +88,9 @@ $AUTOCONF $AUTOMAKE -a for staticshared in --disable-shared "" --disable-static; do + ./configure --enable-dependency-tracking $staticshared - $MAKE + $MAKE # check that dependency tracking works if grep 'depmode=none' Makefile; then : @@ -97,7 +98,11 @@ for staticshared in --disable-shared "" --disable-static; do cd sub2 $sleep echo 'choke me' > sub3/ba3.h - if $MAKE; then Exit 1; fi + # Do not use `$MAKE && Exit 1' here, since even relatively-recent + # versions of the BSD shell wrongly exit when the `errexit' shell + # flag is active if a command within "&&" fails inside a compound + # statement. + if $MAKE; then Exit 1; else :; fi cd .. fi @@ -106,4 +111,7 @@ for staticshared in --disable-shared "" --disable-static; do test ! -f sub2/sub3/ba3.d echo 'extern int x;' > sub2/sub3/ba3.h + done + +: -- 2.47.2