automake-patches
[Top][All Lists]
Advanced

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

Re: parallel-tests: avoid command-line length limit issue.


From: Ralf Wildenhues
Subject: Re: parallel-tests: avoid command-line length limit issue.
Date: Tue, 7 Sep 2010 22:25:59 +0200
User-agent: Mutt/1.5.20 (2010-04-22)

* Stefano Lattarini wrote on Tue, Sep 07, 2010 at 11:23:11AM CEST:
> > diff --git a/lib/am/check.am b/lib/am/check.am
> > index c612b22..b79201f 100644
> > --- a/lib/am/check.am
> > +++ b/lib/am/check.am
> > @@ -236,10 +236,10 @@ check-TESTS:
> >  ## we rely on .PHONY to work portably.
> >     @test -z "$(TEST_SUITE_LOG)" || rm -f $(TEST_SUITE_LOG)
> >     @list='$(TEST_LOGS)';                                           \
> > -   list=`for f in $$list; do                                       \
> > -     test .log = $$f || echo $$f;                                  \
> > -   done | tr '\012\015' '  '`;                                     \
> > -   $(MAKE) $(AM_MAKEFLAGS) $(TEST_SUITE_LOG) TEST_LOGS="$$list"
> > +   { echo "TEST_LOGS = \\";                                        \
> > +     for f in $$list; do test .log = $$f || echo "$$f \\"; done;   \
> > +   } | sed '$$s/\\$$//'                                            \
> > +     | $(MAKE) -f %MAKEFILE% -f - $(AM_MAKEFLAGS) $(TEST_SUITE_LOG)

> This new code is by no means obvious to me (well, it is now that you have
> explained and motivated it ;-).  What about adding a proper comment to it?
> Do you want me to (try to) do that, or will you take care of it yourself?

First off, while the patch fixes the new problem, it also re-exposes the
GNU make 3.80 bug that trailing whitespace is expanded to '.log',
because the override line is read only after the
  $(TEST_SUITE_LOG): $(TEST_LOGS)

line is parsed, and prerequisites (unlike variables inside recipe
commands) are expanded right away.  Which was why the code was so
complex in the first place.

So we're back to square one.  We could try some more elaborate scheme
that munges the whole makefile through sed in some manner, but that
seems ugly and fragile as well, as below (the first sed script is not
portable yet either, due to ';' inside {...}).  Any better suggestions?

(and yes, commenting is probably prudent, too ...)

Thanks,
Ralf

    parallel-tests: ensure TEST_LOGS is overridden early enough.

    * lib/am/check.am: It is not sufficient to override TEST_LOGS at
    the end of the Makefile, as the $(TEST_SUITE_LOG) dependency
    statement will already have been parsed by then, opening up the
    GNU make 3.80 bug again.  Instead, create a new makefile on the
    fly, placing the new definition right before the $(TEST_SUITE_LOG)
    rule.

diff --git a/lib/am/check.am b/lib/am/check.am
index e97b81d..61548c8 100644
--- a/lib/am/check.am
+++ b/lib/am/check.am
@@ -226,10 +226,12 @@ check-TESTS:
 ## we rely on .PHONY to work portably.
        @test -z "$(TEST_SUITE_LOG)" || rm -f $(TEST_SUITE_LOG)
        @list='$(TEST_LOGS)';                                           \
-       { echo "TEST_LOGS = \\";                                        \
+       { sed '/^\$$(TEST_SUITE_LOG): \$$(TEST_LOGS)/{s/.*//;q;}' %MAKEFILE%; \
+         { echo "TEST_LOGS = \\";                                      \
          for f in $$list; do test .log = $$f || echo "$$f \\"; done;   \
-       } | sed '$$s/\\$$//'                                            \
-         | $(MAKE) -f %MAKEFILE% -f - $(AM_MAKEFLAGS) $(TEST_SUITE_LOG)
+         } | sed '$$s/\\$$//';                                         \
+         sed -n '/^\$$(TEST_SUITE_LOG): \$$(TEST_LOGS)/,$$p' %MAKEFILE%;       
\
+       } | $(MAKE) -f - $(AM_MAKEFLAGS) $(TEST_SUITE_LOG)
 
 AM_RECURSIVE_TARGETS += check
 



reply via email to

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