]> git.ipfire.org Git - thirdparty/automake.git/commitdiff
Merge branch 'master' into ng/master
authorStefano Lattarini <stefano.lattarini@gmail.com>
Tue, 24 Jul 2012 22:14:09 +0000 (00:14 +0200)
committerStefano Lattarini <stefano.lattarini@gmail.com>
Tue, 24 Jul 2012 22:16:35 +0000 (00:16 +0200)
* master:
  tests: avoid non-textual output in a '.log' file
  tags: refactor to reduce code duplication (2)
  tags: refactor to reduce code duplication (1)
  tests: better name for a couple of tests
  check: support colorized testsuite output by default
  tags: unify recursion for tags targets with that of "usual" targets

+ Extra non-trivial edits:

* automake.in (handle_tests): Drop the '%COLOR%' transform in the
processing of both 'serial-tests.am' and 'parallel-tests.am', which
have superseded the 'check.am' from mainline Automake.
* lib/am/color-tests.am: Remove use of the '%?COLOR%' transform;
just act as if it were unconditionally TRUE.
(am__tty_colors_dummy): Merge into ...
(am__tty_colors): ... this.

Signed-off-by: Stefano Lattarini <stefano.lattarini@gmail.com>
1  2 
automake.in
doc/automake-ng.texi
lib/am/color-tests.am
lib/am/tags.am
t/ax/tap-summary-aux.sh
t/ax/testsuite-summary-checks.sh
t/color-tests.sh
t/color-tests2.sh
t/dist-formats.tap
t/maken3.sh
t/tap-realtime.sh

diff --cc automake.in
index 2d268eb597582479ba29f85954570575420c955b,48ece7fe2646cd64cdd6f32f4f8eb5c0a2c3479b..17ec3ab7cc009d3fb3a2672dfa0412507c0533eb
@@@ -3193,70 -3611,30 +3195,30 @@@ sub handle_tag
           }
        }
  
 -    define_variable ('am__tagged_files',
 -                     '$(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP)'
 -                     . "@config", INTERNAL);
 +    define_variable ('am__tagged_files', INTERNAL,
 +                     qw/$(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP)/,
 +                     @config);
  
-     my @tag_deps = ();
-     my @ctag_deps = ();
-     my @cscope_deps = ();
-     if (var ('SUBDIRS'))
-     {
-       $output_rules .= ("tags-recursive:\n"
-                         . "\tlist='\$(SUBDIRS)'; for subdir in \$\$list; do \\\n"
-                         # Never fail here if a subdir fails; it
-                         # isn't important.
-                         . "\t  test \"\$\$subdir\" = . || (cd \$\$subdir"
-                         . " && \$(MAKE) tags); \\\n"
-                         . "\tdone\n");
-       push (@tag_deps, 'tags-recursive');
-       &depend ('.PHONY', 'tags-recursive');
-       $output_rules .= ("ctags-recursive:\n"
-                         . "\tlist='\$(SUBDIRS)'; for subdir in \$\$list; do \\\n"
-                         # Never fail here if a subdir fails; it
-                         # isn't important.
-                         . "\t  test \"\$\$subdir\" = . || (cd \$\$subdir"
-                         . " && \$(MAKE) ctags); \\\n"
-                         . "\tdone\n");
-       push (@ctag_deps, 'ctags-recursive');
-       &depend ('.PHONY', 'ctags-recursive');
-       $output_rules .= ("cscopelist-recursive:\n"
-                         . "\tlist='\$(SUBDIRS)'; for subdir in \$\$list; do \\\n"
-                         # Never fail here if a subdir fails; it
-                         # isn't important.
-                         . "\t  test \"\$\$subdir\" = . || (cd \$\$subdir"
-                         . " && \$(MAKE) cscopelist); \\\n"
-                         . "\tdone\n");
-       push (@cscope_deps, 'cscopelist-recursive');
-       &depend ('.PHONY', 'cscopelist-recursive');
-     }
      if (rvar('am__tagged_files')->value_as_list_recursive
-           || var ('ETAGS_ARGS') || @tag_deps)
-     {
-       $output_rules .= &file_contents ('tags',
-                                        new Automake::Location,
-                                        TAGSDIRS  => "@tag_deps",
-                                        CTAGSDIRS => "@ctag_deps",
-                                        CSCOPEDIRS => "@cscope_deps");
-     }
-     elsif (reject_var ('TAGS_DEPENDENCIES',
-                      "it doesn't make sense to define 'TAGS_DEPENDENCIES'"
-                      . " without\nsources or 'ETAGS_ARGS'"))
-     {
-     }
+           || var ('ETAGS_ARGS') || var ('SUBDIRS'))
+       {
+       $output_rules .= &file_contents ('tags', new Automake::Location);
+       set_seen 'TAGS_DEPENDENCIES';
+       }
      else
-     {
+       {
+         reject_var ('TAGS_DEPENDENCIES',
+                   "it doesn't make sense to define 'TAGS_DEPENDENCIES'"
+                   . " without\nsources or 'ETAGS_ARGS'");
        # Every Makefile must define some sort of TAGS rule.
        # Otherwise, it would be possible for a top-level "make TAGS"
-       # to fail because some subdirectory failed.
-       $output_rules .= "tags: TAGS\nTAGS:\n\n";
-       # Ditto ctags and cscope.
-       $output_rules .= "ctags: CTAGS\nCTAGS:\n\n";
-       $output_rules .= "cscope cscopelist:\n\n";
-     }
+       # to fail because some subdirectory failed.  Ditto ctags and
+         # cscope.
+         $output_rules .=
+           "tags TAGS:\n\n" .
+           "ctags CTAGS:\n\n" .
+           "cscope cscopelist:\n\n";
+       }
  }
  
  
@@@ -4140,22 -4821,117 +4102,20 @@@ sub handle_test
    if (var ('TESTS'))
      {
        push (@check_tests, 'check-TESTS');
 -      my $check_deps = "@check";
 -      $output_rules .= &file_contents ('check', new Automake::Location,
 -                                     SERIAL_TESTS => !! option 'serial-tests',
 -                                       CHECK_DEPS => $check_deps);
 -
 -      # Tests that are known programs should have $(EXEEXT) appended.
 -      # For matching purposes, we need to adjust XFAIL_TESTS as well.
 -      append_exeext { exists $known_programs{$_[0]} } 'TESTS';
 -      append_exeext { exists $known_programs{$_[0]} } 'XFAIL_TESTS'
 -      if (var ('XFAIL_TESTS'));
 -
 -      if (! option 'serial-tests')
 -        {
 -        define_variable ('TEST_SUITE_LOG', 'test-suite.log', INTERNAL);
 -        my $suff = '.test';
 -        my $at_exeext = '';
 -        my $handle_exeext = exists $configure_vars{'EXEEXT'};
 -        if ($handle_exeext)
 -          {
 -            $at_exeext = subst ('EXEEXT');
 -            $suff = $at_exeext  . ' ' . $suff;
 -          }
 -          if (! var 'TEST_EXTENSIONS')
 -            {
 -            define_variable ('TEST_EXTENSIONS', $suff, INTERNAL);
 -            }
 -          my $var = var 'TEST_EXTENSIONS';
 -          # Currently, we are not able to deal with conditional contents
 -          # in TEST_EXTENSIONS.
 -          if ($var->has_conditional_contents)
 -           {
 -           msg_var 'unsupported', $var,
 -                     "'TEST_EXTENSIONS' cannot have conditional contents";
 -           }
 -        my @test_suffixes = $var->value_as_list_recursive;
 -          if ((my @invalid_test_suffixes =
 -                  grep { !is_valid_test_extension $_ } @test_suffixes) > 0)
 -            {
 -              error $var->rdef (TRUE)->location,
 -                    "invalid test extensions: @invalid_test_suffixes";
 -            }
 -          @test_suffixes = grep { is_valid_test_extension $_ } @test_suffixes;
 -        if ($handle_exeext)
 -          {
 -            unshift (@test_suffixes, $at_exeext)
 -              unless $test_suffixes[0] eq $at_exeext;
 -          }
 -        unshift (@test_suffixes, '');
 -
 -        transform_variable_recursively
 -          ('TESTS', 'TEST_LOGS', 'am__testlogs', 1, INTERNAL,
 -            sub {
 -              my ($subvar, $val, $cond, $full_cond) = @_;
 -              my $obj = $val;
 -              return $obj
 -                if $val =~ /^\@.*\@$/;
 -              $obj =~ s/\$\(EXEEXT\)$//o;
 -
 -              if ($val =~ /(\$\((top_)?srcdir\))\//o)
 -                {
 -                  msg ('error', $subvar->rdef ($cond)->location,
 -                       "using '$1' in TESTS is currently broken: '$val'");
 -                }
  
 -              foreach my $test_suffix (@test_suffixes)
 -                {
 -                  next
 -                    if $test_suffix eq $at_exeext || $test_suffix eq '';
 -                  return substr ($obj, 0, length ($obj) - length ($test_suffix)) . '.log'
 -                    if substr ($obj, - length ($test_suffix)) eq $test_suffix;
 -                }
 -              my $base = $obj;
 -              $obj .= '.log';
 -                handle_per_suffix_test ('',
 -                                        OBJ => $obj,
 -                                        BASE => $base,
 -                                        SOURCE => $val);
 -              return $obj;
 -            });
 -
 -        my $nhelper=1;
 -        my $prev = 'TESTS';
 -        my $post = '';
 -        my $last_suffix = $test_suffixes[$#test_suffixes];
 -        my $cur = '';
 -        foreach my $test_suffix (@test_suffixes)
 -          {
 -            if ($test_suffix eq $last_suffix)
 -              {
 -                $cur = 'TEST_LOGS';
 -              }
 -            else
 -              {
 -                $cur = 'am__test_logs' . $nhelper;
 -              }
 -            define_variable ($cur,
 -              '$(' . $prev . ':' . $test_suffix . $post . '=.log)', INTERNAL);
 -            $post = '.log';
 -            $prev = $cur;
 -            $nhelper++;
 -            if ($test_suffix ne $at_exeext && $test_suffix ne '')
 -              {
 -                  handle_per_suffix_test ($test_suffix,
 -                                          OBJ => '',
 -                                          BASE => '$*',
 -                                          SOURCE => '$<');
 -              }
 -          }
 -        $clean_files{'$(TEST_LOGS)'} = MOSTLY_CLEAN;
 -        $clean_files{'$(TEST_LOGS:.log=.trs)'} = MOSTLY_CLEAN;
 -        $clean_files{'$(TEST_SUITE_LOG)'} = MOSTLY_CLEAN;
 +      if (option 'serial-tests')
 +        {
 +          $output_rules .=
 +            file_contents ('serial-tests', new Automake::Location,
-                            COLOR => !! option 'color-tests',
 +                           CHECK_DEPS => "@check");
 +        }
 +      else
 +        {
 +        define_variable ('TEST_SUITE_LOG', INTERNAL, 'test-suite.log');
 +          require_conf_file ("parallel-tests", FOREIGN, 'test-driver');
 +          $output_rules .=
 +            file_contents ('parallel-tests', new Automake::Location,
-                            COLOR => !! option 'color-tests',
 +                           CHECK_DEPS => "@check");
        }
      }
  }
Simple merge
index db91049ac9eee358fe5efcea360b18567e6fca11,0000000000000000000000000000000000000000..d2e2a7dfd763776a4395d0c68456d86b07cd5bb6
mode 100644,000000..100644
--- /dev/null
@@@ -1,45 -1,0 +1,41 @@@
- am__tty_colors_dummy = \
-   mgn= red= grn= lgn= blu= brg= std=; \
-   am__color_tests=no
- if %?COLOR%
 +## automake - create Makefile.in from Makefile.am
 +## Copyright (C) 2001-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/>.
 +
-   $(am__tty_colors_dummy); \
 +am__tty_colors = { \
- else !%?COLOR%
- am__tty_colors = $(am__tty_colors_dummy)
- endif !%?COLOR%
 +  if test "X$(AM_COLOR_TESTS)" = Xno; then \
 +    am__color_tests=no; \
 +  elif test "X$(AM_COLOR_TESTS)" = Xalways; then \
 +    am__color_tests=yes; \
 +## If stdout is a non-dumb tty, use colors.  If test -t is not supported,
 +## then this check fails; a conservative approach.  Of course do not
 +## redirect stdout here, just stderr.
 +  elif test "X$$TERM" != Xdumb && { test -t 1; } 2>/dev/null; then \
 +    am__color_tests=yes; \
++  else \
++    am__color_tests=no; \
 +  fi; \
 +  if test $$am__color_tests = yes; then \
 +    red='\e[0;31m'; \
 +    grn='\e[0;32m'; \
 +    lgn='\e[1;32m'; \
 +    blu='\e[1;34m'; \
 +    mgn='\e[0;35m'; \
 +    brg='\e[1m'; \
 +    std='\e[m'; \
++  else \
++    mgn= red= grn= lgn= blu= brg= std=; \
 +  fi; \
 +}
diff --cc lib/am/tags.am
index 2abd5630383bc69417e0ee95a46c2469f2435292,730ccc511e5cfa205005fa5864008f5a66c565ad..1db4139a0b091e58b862fa3eb64817d7fc3b7671
@@@ -141,17 -142,19 +142,19 @@@ AM_RECURSIVE_TARGETS += cscop
  cscope: cscope.files
        test ! -s cscope.files \
          || $(CSCOPE) -b -q $(AM_CSCOPEFLAGS) $(CSCOPEFLAGS) -i cscope.files $(CSCOPE_ARGS)
  clean-cscope:
 -      -rm -f cscope.files
 +      rm -f cscope.files
- cscope.files: clean-cscope %CSCOPEDIRS% cscopelist
+ cscope.files: clean-cscope cscopelist
  endif %?TOPDIR_P%
  
- .PHONY: cscopelist
- cscopelist: %CSCOPEDIRS% $(am__tagged_files)
+ if %?SUBDIRS%
+ RECURSIVE_TARGETS += cscopelist-recursive
+ cscopelist: cscopelist-recursive
+ else !%?SUBDIRS%
+ cscopelist: cscopelist-am
+ endif !%?SUBDIRS%
+ cscopelist-am: $(am__tagged_files)
        list='$(am__tagged_files)'; \
        case "$(srcdir)" in \
          [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \
Simple merge
Simple merge
Simple merge
index 18734c96dc77a7f01bdd8b7d459697b98f5a2a12,65ca6c72fb5cc34dda0fd8bc7f2971453f20d44a..f8bd85b3a941f11d739773b9b7d140f4ec3e080f
@@@ -33,9 -33,35 +33,12 @@@ std="$esc\[m
  (set +e; expect -c 'exit 77'; test $? -eq 77) \
    || skip_ "requires a working expect program"
  
 -# Also, if the $MAKE program fails to consider the standard output as a
 -# tty (this happens with e.g., BSD make and Solaris dmake when they're
 -# run in parallel mode; see the autoconf manual), there is little point
 -# in proceeding.
 -cat > Makefile <<'END'
 -all:
 -## Creative quoting in the 'echo' below to avoid risk of spurious output
 -## matches by 'expect', below.
 -      @test -t 1 && echo "stdout" "is" "a" "tty"
 -END
 -
 -cat > expect-check <<'END'
 -eval spawn $env(MAKE)
 -expect {
 -  "stdout is a tty" { exit 0 }
 -  default { exit 1 }
 -}
 -exit 1
 -END
 -MAKE=$MAKE expect -f expect-check \
 -  || skip_ "make spawned by expect should have a tty stdout"
 -rm -f expect-check Makefile
 -
  # Do the tests.
  
- cat >>configure.ac <<END
+ cat >>configure.ac << 'END'
+ if $testsuite_colorized; then :; else
+   AC_SUBST([AM_COLOR_TESTS], [no])
+ fi
  AC_OUTPUT
  END
  
Simple merge
diff --cc t/maken3.sh
index b1875cbe151b5b7ed888f49082cc7f9a9ce4564b,5f5d87a1bdbb15ca533b6ec4ef41a9c1ebecb49e..5dbe7d23a66fe4f1443b82ac0ea81e75cd1d5d89
  # Test 'make -n' for various targets, to ensure that:
  #
  #  1. no files or directories are created or removed, and
 -#
 -#  2. if using GNU make or a make implementation supporting the .MAKE
 -#     special target, the output from make is sufficiently complete.
 +#  2. the output from make is sufficiently complete.
  #
  # This test exercises the GCS-mandated targets (except for dist)
- # as well as tags, TAGS.
+ # as well as tags.
  
  # For gen-testsuite-part: ==> try-with-serial-tests <==
  . ./defs || exit 1
@@@ -130,9 -145,11 +128,9 @@@ check_targets (
      $MAKE -n $target >stdout || { cat stdout; exit 1; }
      cat stdout
      case $target in
-     install-* | installdirs | tags | TAGS ) ;;
+     install-* | installdirs | tags ) ;;
      *)
 -      if $have_dotmake; then
 -        grep "stamp-$target$" stdout || exit 1
 -      fi
 +      grep "stamp-$target$" stdout || exit 1
        test ! -e "stamp-$target" || exit 1
        ;;
      esac
index e3cac34c1f0106c884875b7caab30028b41e88a4,97b035c37a809dd7375f6213bd2295e2bfb9a743..662105386f93e3d38416d3549b91bef1bd1743cc
@@@ -34,9 -34,28 +34,11 @@@ expect -f expect-check || 
  }
  rm -f expect-check
  
 -# Unfortunately, some make implementations (among them, FreeBSD make,
 -# NetBSD make, and Solaris Distributed make), when run in parallel mode,
 -# serialize the output from their targets' recipes unconditionally.  In
 -# such a situation, there's no way the partial results of a TAP test can
 -# be displayed until the test has terminated.  And this is not something
 -# our TAP driver script can work around; in fact, the driver *is* sending
 -# out its output progressively and "in sync" with test execution -- it is
 -# make that is stowing such output away instead of presenting it to the
 -# user as soon as it gets it.
 -if ! using_gmake; then
 -  case $MAKE in
 -    *\ -j*) skip_ "doesn't with non-GNU concurrent make";;
 -  esac
 -  # Prevent Sun Distributed Make from trying to run in parallel.
 -  DMAKE_MODE=serial; export DMAKE_MODE
 -fi
 -
  cat > Makefile.am << 'END'
  TESTS = all.test
+ AM_COLOR_TESTS= no
  END
  . "$am_testauxdir"/tap-setup.sh || fatal_ "sourcing tap-setup.sh"
  
  cat > all.test <<'END'