automake-commit
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Automake-commit] [SCM] GNU Automake branch, master, updated. v1.11-1973


From: Stefano Lattarini
Subject: [Automake-commit] [SCM] GNU Automake branch, master, updated. v1.11-1973-g44737eb
Date: Fri, 17 Feb 2012 12:50:39 +0000

This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "GNU Automake".

http://git.sv.gnu.org/gitweb/?p=automake.git;a=commitdiff;h=44737ebc42660ec28f8555607ae51d2d355e927a

The branch, master has been updated
       via  44737ebc42660ec28f8555607ae51d2d355e927a (commit)
       via  b5788178cedf5f6c78d34ff1f3f3c223c41e579d (commit)
       via  4df475a2d5ee114d1709884ec57698d34c5493cb (commit)
       via  622a348efd03f4fe39194f80ef8373cb6686111a (commit)
       via  0f858eabaed9377bb4c0cf62fec44237528f9728 (commit)
      from  e5da4fbf4a1fad91b3b25e1b86b563bfa793ab0e (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit 44737ebc42660ec28f8555607ae51d2d355e927a
Author: Stefano Lattarini <address@hidden>
Date:   Fri Feb 17 13:46:53 2012 +0100

    tests: relax a test to cater to NetBSD make
    
    * tests/parallel-tests-empty-testlogs.test: When $(TESTS) is empty,
    NetBSD 5.1 make ends up defining $(TESTS_LOGS) to ".log" rather than
    to the empty string (as would be expected).  This behaviour was
    causing a check in this test case to fail.  But that check was in
    fact overly strict, since our recipes are smart enough to work
    around the botched-up substitution.  Also, the failure wasn't a
    regression from Automake 1.11, since that version too would have
    triggered the same error with NetBSD 5.1 make.  So we just relax
    the test a little to avoid extra noise in the testsuite.

commit b5788178cedf5f6c78d34ff1f3f3c223c41e579d
Merge: 622a348 4df475a
Author: Stefano Lattarini <address@hidden>
Date:   Fri Feb 17 13:29:19 2012 +0100

    Merge branch 'maint'
    
    * maint:
      dryrun: $(am__dry_run) not confused by metachars in $(MAKEFLAGS)

commit 622a348efd03f4fe39194f80ef8373cb6686111a
Author: Stefano Lattarini <address@hidden>
Date:   Fri Feb 17 13:14:57 2012 +0100

    tests: TAP-based tests should error if no plan was specified
    
    After this change, it will still be OK for TAP-based tests not to
    report any explicit TAP plan -- but they should state *explicitly*
    that they want to do so, by calling the 'plan_' function with a
    proper argument (currently, either "later" or "unknonwn").
    
    Motivated by a recent issue introduced by yesterday's commit
    'v1.11-1959-g0699a84' (pointed out by Peter Rosin, and fixed
    by follow-up commit 'v1.11-1961-gea44190').
    
    * tests/tap-functions.sh (plan_): Get rid of '$have_tap_plan_',
    and refactor use and initialization of '$planned_' in a way that
    will allow client script to get more information on which kind
    of plan (if any) has been declared by the former 'plan_' invocation.
    (skip_all_): Adjust.
    * tests/defs (exit trap): Only print the "lazy" TAP plan if 'plan_'
    has requested that *explicitly*.
    * syntax-check.mk (sc_tests_tap_plan): Remove: it's obsolete now,
    since a TAP-based test that doesn't call 'plan_' explicitly won't
    print any TAP plan, and the TAP driver will catch that and report
    an error.
    (syntax_check_rules): Adjust.

commit 0f858eabaed9377bb4c0cf62fec44237528f9728
Author: Stefano Lattarini <address@hidden>
Date:   Fri Feb 17 10:57:37 2012 +0100

    tests: expose $(am__dry_run) limitations
    
    Currently, the internal $(am__dry_run) macro can fail in weird ways
    when $(MAKEFLAGS) contains shell metacharacters.  Let's expose this
    limitation in the testsuite (and fix a couple of related weaknesses
    since we are at it).
    
    * tests/make-dryrun.test: Moved ...
    * tests/make-dryrun.tap: ... here, converted to TAP, and extended to
    expose the described limitations.  Also ...
    (am_parallel_tests): Define this so that the 'gen-testsuite-part'
    script won't generate a useless wrapper script.
    * test/list-of-tests.mk: Update.

-----------------------------------------------------------------------

Summary of changes:
 lib/am/header-vars.am                    |   28 ++++---
 syntax-checks.mk                         |   28 -------
 tests/defs                               |    2 +-
 tests/list-of-tests.mk                   |    2 +-
 tests/make-dryrun.tap                    |  125 ++++++++++++++++++++++++++++++
 tests/make-dryrun.test                   |   65 ---------------
 tests/parallel-tests-empty-testlogs.test |   11 +++-
 tests/tap-functions.sh                   |   17 +++--
 8 files changed, 165 insertions(+), 113 deletions(-)
 create mode 100755 tests/make-dryrun.tap
 delete mode 100755 tests/make-dryrun.test

diff --git a/lib/am/header-vars.am b/lib/am/header-vars.am
index fe38903..ba4aa0b 100644
--- a/lib/am/header-vars.am
+++ b/lib/am/header-vars.am
@@ -30,20 +30,28 @@ VPATH = @srcdir@
 ## ("make -n") or not.  Useful in rules that invoke make recursively,
 ## and are thus executed also with "make -n" -- either because they
 ## are declared as dependencies to '.MAKE' (NetBSD make), or because
-## their recipes contain the "$(MAKE)" string (GNU and Solari make).
+## their recipes contain the "$(MAKE)" string (GNU and Solaris make).
 
-## The case statement has [:] in order to not tickle makefile-deps.test
-## which greps for '^ *:'.
 am__make_dryrun = \
   { \
     am__dry=no; \
-    for am__flg in : $(MAKEFLAGS); do \
-      case $$am__flg in \
-        [:]) ;; \
-        *=*|--*) ;; \
-        *n*) am__dry=yes; break;; \
-      esac; \
-    done; \
+    case $$MAKEFLAGS in \
+## If we run "make TESTS='snooze nap'", GNU make will export MAKEFLAGS
+## to "TESTS=foo\ nap", so that the simpler loop below (on word-splitted
+## $$MAKEFLAGS) would see a "make flag" equal to "nap", and would wrongly
+## misinterpret that as and indication that make is running in dry mode.
+## This has already happened in practice.  So we need this hack.
+      *\\[\ \  ]*) \
+        echo 'am--echo: ; @echo "AM"  OK' | $(MAKE) -f - 2>/dev/null \
+          | grep '^AM OK$$' >/dev/null || am__dry=yes;; \
+      *) \
+        for am__flg in $$MAKEFLAGS; do \
+          case $$am__flg in \
+            *=*|--*) ;; \
+            *n*) am__dry=yes; break;; \
+          esac; \
+        done;; \
+    esac; \
     test $$am__dry = yes; \
   }
 
diff --git a/syntax-checks.mk b/syntax-checks.mk
index 13531bd..a8bdcad 100644
--- a/syntax-checks.mk
+++ b/syntax-checks.mk
@@ -68,7 +68,6 @@ sc_tests_automake_fails \
 sc_tests_plain_aclocal \
 sc_tests_plain_perl \
 sc_tests_required_after_defs \
-sc_tests_tap_plan \
 sc_tests_overriding_macros_on_cmdline \
 sc_tests_plain_sleep \
 sc_tests_plain_egrep_fgrep \
@@ -426,33 +425,6 @@ sc_tests_required_after_defs:
          fi; \
        done
 
-## TAP-based test scripts should not forget to declare a TAP plan.  In
-## case it is not known in advance how many tests will be run, a "lazy"
-## plan can be used; but its use should be deliberate, explicitly declared
-## with a "plan_ later" call, rather than the result of an oversight.
-## This check helps to ensure this is indeed the case.
-sc_tests_tap_plan:
-       @with_plan=`grep -l '^ *plan_ ' $(srcdir)/tests/*.tap`; \
-        with_plan=`echo $$with_plan`; \
-        ok=:; \
-        for t in $(srcdir)/tests/*.tap; do \
-          case " $$with_plan " in *" $$t "*) continue;; esac; \
-          case $$t in \
-            *-w.tap) \
-              : it is ok for an *auto-generated* test sourcing an \
-              : hand-written one not to declare a TAP plan: that will \
-              : be done by the sourced test; \
-              t2=`echo $$t | sed -e 's|.*/||' -e 's/-w\.tap$$/.tap/'` \
-                && grep -E "^ *\\.  *[^        ]*/$$t2\\b" $$t >/dev/null \
-                && continue || : ;; \
-          esac; \
-          ok=false; echo $$t; \
-        done; \
-        $$ok || { \
-         echo 'The tests above do not declare a TAP plan.' 1>&2; \
-         exit 1; \
-        }
-
 ## Overriding a Makefile macro on the command line is not portable when
 ## recursive targets are used.  Better use an envvar.  SHELL is an
 ## exception, POSIX says it can't come from the environment.  V, DESTDIR,
diff --git a/tests/defs b/tests/defs
index 7af8f25..505a43f 100644
--- a/tests/defs
+++ b/tests/defs
@@ -1053,7 +1053,7 @@ if test "$sh_errexit_works" = yes; then
     set +e
     cd "$testbuilddir"
     if test $am_using_tap = yes; then
-      if test $have_tap_plan_ != yes && test $exit_status -eq 0; then
+      if test "$planned_" = later && test $exit_status -eq 0; then
         plan_ "now"
       fi
       test $exit_status -eq 0 && test $tap_pass_count_ -eq $tap_count_ \
diff --git a/tests/list-of-tests.mk b/tests/list-of-tests.mk
index 119ebca..a80879f 100644
--- a/tests/list-of-tests.mk
+++ b/tests/list-of-tests.mk
@@ -612,7 +612,7 @@ makej.test \
 makej2.test \
 maken.test \
 maken3.test \
-make-dryrun.test \
+make-dryrun.tap \
 makevars.test \
 man.test \
 man2.test \
diff --git a/tests/make-dryrun.tap b/tests/make-dryrun.tap
new file mode 100755
index 0000000..e54ae01
--- /dev/null
+++ b/tests/make-dryrun.tap
@@ -0,0 +1,125 @@
+#! /bin/sh
+# Copyright (C) 2012 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 2, 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 <http://www.gnu.org/licenses/>.
+
+# Check that $(am__make_dryrun) works as expected.
+
+am_parallel_tests=yes # Avoid generation of a useless wrapper test.
+. ./defs || Exit 1
+
+plan_ 14
+
+if echo "all: ; @+printf %sbb%s aa cc" | $MAKE -n -f - | grep aabbcc; then
+  make_plus_silence () { return 0; }
+else
+  make_plus_silence () { return 1; }
+fi
+
+mkdir sub
+
+echo AC_OUTPUT >> configure.in
+
+cat > Makefile.am <<'END'
+all:
+       : Dummy, nothing to do.
+foo:
+       $(MAKE) all
+notdry:
+       @echo ":: $$MAKEFLAGS ::"; : For debugging.
+       $(am__make_dryrun) && exit 1; exit 0
+dry:
+       address@hidden ":: $$MAKEFLAGS ::"; : For debugging.
+       +$(am__make_dryrun) || exit 1; echo ok > from-dry-mode
+END
+
+$ACLOCAL    || fatal_ "aclocal failed"
+$AUTOCONF   || fatal_ "autoconf failed"
+$AUTOMAKE   || fatal_ "automake failed"
+./configure || fatal_ "configure failed"
+
+# ----------------------------------------------------------------------
+
+check_no_dryrun ()
+{
+  command_ok_ "dry-run ($cnt)" $MAKE notdry ${1+"$@"}
+  cnt=`expr $cnt + 1`
+}
+cnt=1
+
+check_no_dryrun
+
+# Test against a known regression.  This was especially heinous, since
+# make running in normal mode was sometimes mistaken for make running
+# in dry mode.
+check_no_dryrun TESTS="n1.test n2.test"
+check_no_dryrun TESTS="n1 n2" AM_MAKEFLAGS="TESTS='n1 n2'"
+check_no_dryrun TESTS="n1 n2" AM_MAKEFLAGS='TESTS="n1 n2"'
+check_no_dryrun FOOFLAGS="-n -n -knf2 n --none -n"
+check_no_dryrun MYFLAGS="-n --dryrun -n --dry-run -n"
+
+# ----------------------------------------------------------------------
+
+check_dryrun ()
+{
+  r=ok directive=
+  case $1 in
+    -C) condition=$2 reason=$3; shift; shift; shift;;
+     *) condition=: reason=;;
+  esac
+  if $condition; then
+    $MAKE dry ${1+"$@"}   || r='not ok'
+    test -f from-dry-mode || r='not ok'
+    rm -f from-dry-mode   || fatal_ "cleaning up"
+  else
+    directive=SKIP
+  fi
+  result_ "$r" -D "$directive" -r "$reason" "not dry-run ($cnt)"
+  unset r directive reason
+  cnt=`expr $cnt + 1`
+}
+cnt=1
+
+check_dryrun -C make_plus_silence 'recipe prefix "+" unsupported' -n
+check_dryrun -C using_gmake "\$MAKE is not GNU make" --dry-run -k
+
+# ----------------------------------------------------------------------
+
+# Test for when shell metacharacters or backslashes are in $(MAKEFLAGS).
+
+check_metachars ()
+{
+  r=ok
+  $MAKE notdry ${1+"$@"} || r='not ok'
+  if test -f bad; then
+    r='not ok'
+  else
+    rm -f bad || fatal_ "cleaning up"
+  fi
+  result_ "$r" "dry-run, with shell metachars ($cnt)"
+  unset r
+  cnt=`expr $cnt + 1`
+}
+cnt=1
+
+check_metachars MYFLAGS="-n \"n\" '-n' --none -n"
+check_metachars MYFLAGS='-knf2\ n\ \\n'
+check_metachars MYFLAGS="(&) | ; \" \` '"
+check_metachars MYFLAGS=" ' # ' "
+check_metachars MYFLAGS='$(foo)'
+check_metachars MYFLAGS='`touch bad`'
+
+# ----------------------------------------------------------------------
+
+:
diff --git a/tests/make-dryrun.test b/tests/make-dryrun.test
deleted file mode 100755
index 0202dc9..0000000
--- a/tests/make-dryrun.test
+++ /dev/null
@@ -1,65 +0,0 @@
-#! /bin/sh
-# Copyright (C) 2012 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 2, 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 <http://www.gnu.org/licenses/>.
-
-# Check that $(am__make_dryrun) works as expected.
-
-. ./defs || Exit 1
-
-mkdir sub
-
-echo AC_OUTPUT >> configure.in
-
-cat > Makefile.am <<'END'
-all:
-       : Dummy, nothing to do.
-foo:
-       $(MAKE) all
-notdry:
-       @echo ":: $$MAKEFLAGS ::"; : For debugging.
-       $(am__make_dryrun) && exit 1; exit 0
-dry:
-       address@hidden ":: $$MAKEFLAGS ::"; : For debugging.
-       +$(am__make_dryrun) || exit 1; echo ok > from-dry-mode
-END
-
-$ACLOCAL
-$AUTOCONF
-$AUTOMAKE
-./configure
-
-$MAKE notdry
-
-# Test against a known regressions.  This was especially
-# heinous, since make running in normal mode was sometimes
-# mistaken for make running in dry mode.
-$MAKE notdry TESTS="n1.test n2.test"
-$MAKE notdry TESTS="n1 n2" AM_MAKEFLAGS="TESTS='n1 n2'"
-$MAKE notdry TESTS="n1 n2" AM_MAKEFLAGS='TESTS="n1 n2"'
-$MAKE notdry FOOFLAGS="-n -n -knf2 \\n --none -n"
-$MAKE notdry BARFLAGS="-n \"n\" '-n' --none -n"
-
-if echo 'all: ; @+printf %sbb%s aa cc' | $MAKE -n -f - | grep aabbcc; then
-  $MAKE -n dry
-  test -f from-dry-mode
-  rm -f from-dry-mode
-fi
-
-if using_gmake; then
-  $MAKE --dry-run -k dry
-  test -f from-dry-mode
-fi
-
-:
diff --git a/tests/parallel-tests-empty-testlogs.test 
b/tests/parallel-tests-empty-testlogs.test
index e73dae8..608299f 100755
--- a/tests/parallel-tests-empty-testlogs.test
+++ b/tests/parallel-tests-empty-testlogs.test
@@ -34,9 +34,18 @@ mkdir sub1 sub2
 
 cat > sub1/Makefile.am << 'END'
 TESTS =
-check-local:
+END
+
+# When $(TESTS) is empty, NetBSD 5.1 make ends up defining $(TESTS_LOGS)
+# to ".log" rather than to the empty string (as would be expected).
+# But our recipes are smart enough to work around such a botched-up
+# substitution, so let's not bother too much about it.
+if using_gmake; then
+  unindent >> sub1/Makefile.am << 'END'
+    check-local:
        echo $(TEST_LOGS) | grep . && exit 1; exit 0
 END
+fi
 
 cat > sub2/Makefile.am << 'END'
 TESTS = foo.test
diff --git a/tests/tap-functions.sh b/tests/tap-functions.sh
index 50abc70..700904b 100644
--- a/tests/tap-functions.sh
+++ b/tests/tap-functions.sh
@@ -64,19 +64,22 @@ plan_ ()
     bailout_ "plan_: missing argument"
   elif test $# -ge 2; then
     bailout_ "plan_: too many arguments"
+  elif test x"$planned_" != x"none" && test x"$planned_" != x"later"; then
+    bailout_ "plan_: called to many times"
   elif test x"$1" = x"unknown" || test x"$1" = x"later"; then
-    : No-op.
+    # This means we want to get back later to declaring the TAP plan.
+    planned_=later
+    return 0
   elif test x"$1" = x"lazy" || test x"$1" = x"now"; then
-    echo "1..$tap_count_" # Number of test results seen so far.
-    have_tap_plan_=yes
+    planned_=$tap_count_ # Number of test results seen so far.
   elif test $1 -ge 0; then
-    echo "1..$1"
-    have_tap_plan_=yes
+    planned_=$1
   else
     bailout_ "plan_: invalid argument '$1'"
   fi
+  echo "1..$planned_"
 }
-have_tap_plan_=no # Avoid interferences from the environment.
+planned_=none
 
 # diag_ [EXPLANATION]
 # ------------------
@@ -176,7 +179,7 @@ skip_row_ ()
 skip_all_ ()
 {
   echo "1..0 # SKIP" ${1+"$@"}
-  have_tap_plan_=yes
+  planned_=0
   Exit 0
 }
 


hooks/post-receive
-- 
GNU Automake



reply via email to

[Prev in Thread] Current Thread [Next in Thread]