Subject: Re: bug#14561: TESTS set from patsubst result in unterminated variable reference

From: Stefano Lattarini <[email-masked]>
Date: Sat, 08 Jun 2013 11:56:50 +0200

retitle GNU make specific stuff cannot be used in RHS of "TESTS =" 14561
retitle GNU make specific stuff cannot be used in RHS of "TESTS =" 13771
forcemerge 13771 14561
stop

On 06/05/2013 09:22 PM, Marko Lindqvist wrote:
>  This was found originally when trying to use automake-1.13 (including
> attempt with 1.13.3) for gtk-engines-2.20.2, but I've tried to produce
> minimum Makefile.am to reproduce the problem (attached).
>
>  When variable TESTS gets assigned result from patsubst -function,
> running make for resulting Makefile errors with:
> Makefile:592: *** unterminated variable reference.  Stop.
> 
> 
>  Attached testcase includes minimum configure.ac and Makefile.am and
> separate ./run.sh script to produce rest of the files and to run make.
> 
> 
This is basically a duplicated of bug#13771, so I'm merging this
report with that one.

The bottom line is that this is a long-standing limitation of the
parallel testsuite harness: Automake needs to analyze the contents
of TESTS statically (at automake runtime), so GNU make special
builtins or user-defined functions cannot be used in the TESTS
definition (automake doesn't grasp them).

You can work around this by wrapping your GNU make specific stuff
into a configure substitution, which will be left alone by automake;
e.g.:

  # In configure.ac:
  AC_SUBST([auto_find_tests], ['$(sort $(wildcard *.test))'])

  # In Makefile.am:
  TESTS = @auto_find_tests@

Note that, in order for this to work correctly in all situations,
you should only use tests whose suffix is listed in TESTS_EXTENSIONS
(if that variable is not explicitly defined, it's default value
is ".test").  That's because, missing such extension(s), automake
cannot generate generic suffix rules to create the '.trs' and
'.log' files the testsuite harness relies upon.

HTH,
  Stefano