automake-patches
[Top][All Lists]
Advanced

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

[PATCH 4/5] Ensure we don't print 'warning:' or 'error:' twice.


From: Ralf Wildenhues
Subject: [PATCH 4/5] Ensure we don't print 'warning:' or 'error:' twice.
Date: Sun, 11 Apr 2010 22:32:21 +0200
User-agent: Mutt/1.5.20 (2009-10-28)

* Makefile.am (sc_ensure_testsuite_has_run): New helper rule.
(sc_tests_logs_duplicate_prefixes): New rule, to check for
wrong-looking warning and error messages in the test suite logs.
* aclocal.in (scan_configure_dep, scan_file): Remove duplicate
`warning: ' prefix.
* tests/vars3.test: Rename variable to avoid false positive.

Signed-off-by: Ralf Wildenhues <address@hidden>
---

I didn't want to let the sc_tests_logs_duplicate_prefixes rule depend
upon 'check' because that would make 'maintainer-check' very expensive.
Introducing a toplevel GNUmakefile, we could safely use 'make check
RECHECK_LOGS=', but for now it's fine to just require a test-suite.log
file to be present.


 ChangeLog        |    8 ++++++++
 Makefile.am      |   19 +++++++++++++++++++
 Makefile.in      |   14 ++++++++++++++
 aclocal.in       |    6 +++---
 tests/vars3.test |    6 +++---
 5 files changed, 47 insertions(+), 6 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 65a637d..f63d2a5 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,13 @@
 2010-04-11  Ralf Wildenhues  <address@hidden>
 
+       Ensure we don't print 'warning:' or 'error:' twice.
+       * Makefile.am (sc_ensure_testsuite_has_run): New helper rule.
+       (sc_tests_logs_duplicate_prefixes): New rule, to check for
+       wrong-looking warning and error messages in the test suite logs.
+       * aclocal.in (scan_configure_dep, scan_file): Remove duplicate
+       `warning: ' prefix.
+       * tests/vars3.test: Rename variable to avoid false positive.
+
        Prepend type to warning, error, and fatal messages.
        For the first part of messages of types `error' or `fatal',
        prepend `error: ' to the message.  Prepend `warning: ' to
diff --git a/Makefile.am b/Makefile.am
index 6c24285..f5ab44f 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -190,6 +190,7 @@ sc_tests_required_after_defs \
 sc_tests_overriding_macros_on_cmdline \
 sc_tests_plain_sleep \
 sc_tests_plain_egrep_fgrep \
+sc_tests_logs_duplicate_prefixes \
 sc_mkdir_p \
 sc_perl_at_substs \
 sc_unquoted_DESTDIR \
@@ -458,6 +459,24 @@ sc_tests_plain_egrep_fgrep:
          exit 1; \
        fi
 
+## Rule to ensure that the testsuite has been run before.  We don't depend on 
`check'
+## here, because that would be very wasteful in the common case.  We could run
+## `make check RECHECK_LOGS=' and avoid toplevel races with 
AM_RECURSIVE_TARGETS.
+sc_ensure_testsuite_has_run:
+       @if test ! -f tests/test-suite.log; then \
+         echo "Run \`make check' before \`maintainer-check'" >&2; \
+         exit 1; \
+       fi
+.PHONY: sc_ensure_testsuite_has_run
+
+## Ensure our warning and error messages do not contain duplicate 'warning:' 
prefixes.
+## This test actually depends on the testsuite having been run before; but it 
would be
+sc_tests_logs_duplicate_prefixes: sc_ensure_testsuite_has_run
+       @if grep -E '(warning|error):.*(warning|error):' tests/*.log; then \
+         echo 'Duplicate warning/error message prefixes seen in above tests.' 
>&2; \
+         exit 1; \
+       fi
+
 sc_mkdir_p:
        @if grep 'mkdir_p' $(srcdir)/automake.in \
              $(srcdir)/lib/am/*.am $(srcdir)/tests/*.test; then \
diff --git a/Makefile.in b/Makefile.in
index d8e60c0..15d81ba 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -312,6 +312,7 @@ sc_tests_required_after_defs \
 sc_tests_overriding_macros_on_cmdline \
 sc_tests_plain_sleep \
 sc_tests_plain_egrep_fgrep \
+sc_tests_logs_duplicate_prefixes \
 sc_mkdir_p \
 sc_perl_at_substs \
 sc_unquoted_DESTDIR \
@@ -1180,6 +1181,19 @@ sc_tests_plain_egrep_fgrep:
          exit 1; \
        fi
 
+sc_ensure_testsuite_has_run:
+       @if test ! -f tests/test-suite.log; then \
+         echo "Run \`make check' before \`maintainer-check'" >&2; \
+         exit 1; \
+       fi
+.PHONY: sc_ensure_testsuite_has_run
+
+sc_tests_logs_duplicate_prefixes: sc_ensure_testsuite_has_run
+       @if grep -E '(warning|error):.*(warning|error):' tests/*.log; then \
+         echo 'Duplicate warning/error message prefixes seen in above tests.' 
>&2; \
+         exit 1; \
+       fi
+
 sc_mkdir_p:
        @if grep 'mkdir_p' $(srcdir)/automake.in \
              $(srcdir)/lib/am/*.am $(srcdir)/tests/*.test; then \
diff --git a/aclocal.in b/aclocal.in
index dc84762..9622711 100644
--- a/aclocal.in
+++ b/aclocal.in
@@ -435,7 +435,7 @@ sub scan_configure_dep ($)
          # Make this just a warning, because we do not know whether
          # the macro is actually used (it could be called conditionally).
          msg ('unsupported', "$file:$line",
-              "warning: macro `$2' not found in library");
+              "macro `$2' not found in library");
        }
     }
 
@@ -507,7 +507,7 @@ sub scan_file ($$$)
          if ($number !~ /$serial_number_rx/go)
            {
              msg ('syntax', "$file:$.",
-                  "warning: ill-formed serial number `$number', "
+                  "ill-formed serial number `$number', "
                   . "expecting a version string with only digits and dots");
            }
          elsif ($defun_seen)
@@ -559,7 +559,7 @@ sub scan_file ($$$)
          $defun_seen = 1;
          if (! defined $1)
            {
-             msg ('syntax', "$file:$.", "warning: underquoted definition of $2"
+             msg ('syntax', "$file:$.", "underquoted definition of $2"
                   . "\n  run info '(automake)Extending aclocal'\n"
                   . "  or see http://sources.redhat.com/automake/";
                   . "automake.html#Extending-aclocal")
diff --git a/tests/vars3.test b/tests/vars3.test
index 3d10a90..3f61c90 100755
--- a/tests/vars3.test
+++ b/tests/vars3.test
@@ -1,5 +1,5 @@
 #! /bin/sh
-# Copyright (C) 2002  Free Software Foundation, Inc.
+# Copyright (C) 2002, 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
@@ -30,7 +30,7 @@ L05 = "$(bad boy)"
 L06 = $(this:is= ok)
 L07 = ${three errors}${on this} $(long line)
 L08$(o u c h): $(wildcard *.c)
-       ${another error}
+       ${another Error}
        echo $${ok-this is}
 L11: $(thisis) $(ok)
        ${here}
@@ -69,7 +69,7 @@ grep 'on this' stderr
 grep 'long line' stderr
 grep 'o u c h' stderr
 grep 'wildcard' stderr
-grep 'another error' stderr
+grep 'another Error' stderr
 grep 'thisis' stderr && Exit 1
 grep 'here' stderr && Exit 1
 
-- 
1.7.0.rc1.161.g90487





reply via email to

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