automake-ng
[Top][All Lists]
Advanced

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

[Automake-NG] [PATCH 7/6] [ng] check: in recipes, don't use pipe when re


From: Stefano Lattarini
Subject: [Automake-NG] [PATCH 7/6] [ng] check: in recipes, don't use pipe when redirection suffices
Date: Sun, 22 Jul 2012 11:44:48 +0200

Instead of the botched idiom:

    while read c; do echo $c; done <file | command

use the simpler and much better one:

    command <file

Not only the latter is simpler and marginally more efficient, but is also
better at catching possible unexpected I/O errors; while in the former,
the exit status of the while loop (which might have revealed such errors)
was lost in the pipeline.

* lib/am/parallel-tests.am ($(TEST_SUITE_LOG), recheck): Use the better
idiom.

Co-authored-by: Akim Demaille <address@hidden>
Signed-off-by: Stefano Lattarini <address@hidden>
---
 lib/am/parallel-tests.am |    8 +++-----
 1 file changed, 3 insertions(+), 5 deletions(-)

diff --git a/lib/am/parallel-tests.am b/lib/am/parallel-tests.am
index 048cdfa..218fcd9 100644
--- a/lib/am/parallel-tests.am
+++ b/lib/am/parallel-tests.am
@@ -406,8 +406,7 @@ $(TEST_SUITE_LOG): $(am__test_logs) $(am__test_results)
          echo;                                                         \
          echo ".. contents:: :depth: 2";                               \
          echo;                                                         \
-         while read b; do echo $$b; done <$$workdir/bases              \
-           | $(am__create_global_log);                                 \
+         $(am__create_global_log) <$$workdir/bases                     \
        } >$(TEST_SUITE_LOG).tmp; then                                  \
          mv -f $(TEST_SUITE_LOG).tmp $(TEST_SUITE_LOG);                \
        else                                                            \
@@ -471,9 +470,8 @@ recheck: all %CHECK_DEPS%
        @test -z "$(TEST_SUITE_LOG)" || rm -f $(TEST_SUITE_LOG)
 ## If running a "make recheck", we must only consider tests that had an
 ## unexpected outcome (FAIL or XPASS) in the earlier run.
-       @bases=`while read b; do echo $$b; done \
-                 <$(am.test-harness.workdir)/bases \
-                | $(am__list_recheck_tests)` || exit 1; \
+       @bases=`$(am__list_recheck_tests) \
+                 <$(am.test-harness.workdir)/bases` || exit 1; \
 ## Remove newlines and normalize whitespace.
        bases=`echo $$bases`; \
 ## Re-run the relevant tests, without hitting command-line length limits.
-- 
1.7.10.4




reply via email to

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