[Top][All Lists]

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

[FYI] {micro} lint, tests: warn against redirected 'run_make' invocation

From: Stefano Lattarini
Subject: [FYI] {micro} lint, tests: warn against redirected 'run_make' invocations
Date: Wed, 22 May 2013 22:41:12 +0200

The testsuite shell function 'run_make()' has the three options
-E, -O and -M to perform the various kind of output redirections,
so the test scripts should use them instead of redirecting the
output "by hand":

    run_make ARGS >stdout           =>  run_make -O ARGS
    run_make ARGS >stderr           =>  run_make -E ARGS
    run_make ARGS >stdout 2>stderr  =>  run_make -O -E ARGS
    run_make ARGS >output 2>&1      =>  run_make -M ARGS

See the commit message of v1.13.2-13-gc7cfa09, 2013-05-22
(tests: run_make: options to do command redirection) for an
explanation of why this is a good idea.

It's worth noting that the present patch only introduced a new
static maintainer check looking against the undesired idioms,
but doesn't yet remove usages of such idioms from the testsuite.
That will be done by follow-up patch(es).

* (): New.

Signed-off-by: Stefano Lattarini <address@hidden>
--- | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/ b/
index 3feb400..2cf7e26 100644
--- a/
+++ b/
@@ -62,6 +62,7 @@ sc_tests_no_source_defs \
 sc_tests_obsolete_variables \
 sc_tests_here_document_format \
 sc_tests_command_subst \
+sc_tests_no_run_make_redirect \
 sc_tests_exit_not_Exit \
 sc_tests_automake_fails \
 sc_tests_required_after_defs \
@@ -339,6 +340,14 @@ sc_tests_no_source_defs:
          exit 1; \
+## Invocation of 'run_make' should not have output redirections.
+       @if grep -Pzo '\brun_make\b(.*(\\\n))*.*>.*' $(xtests); then \
+         echo 'Do not redirect "run_make" invocations, use' \
+              '"run_make {-E|-O|-M}" instead.' 1>&2; \
+         exit 1; \
+       fi
 ## Use AUTOMAKE_fails when appropriate
        @if grep -v '^#' $(xtests) | grep '\$$AUTOMAKE.*&&.*exit'; then \

reply via email to

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