Subject: Re: bug#9242: distcheck fails when having TEST in sub-directory

From: Stefano Lattarini <[email-masked]>
Date: Fri, 5 Aug 2011 12:22:08 +0200

On Thursday 04 August 2011, Peter Johansson wrote:
> Hello automakers,
Hi Peter.

> I have a non-recursive Makefile.am but keep the tests in sub-directory named
> test. Surprisingly distcheck fails for me with this set up, which to me
> seems to be caused by some VPATH issue.
>
Nope, you've forgotten to tell automake to ditribute your test scripts.
See below.

> Below is a trimmed down test case that fails for me with
> 
> make  check-TESTS
> make[2]: *** No rule to make target `test/foo.test', needed by
> `check-TESTS'.  Stop.
> make[1]: *** [check-am] Error 2
> make: *** [distcheck] Error 1
> 
> 
> cat > configure.ac <<EOF
> AC_INIT([foo], [1])
> AM_INIT_AUTOMAKE([foreign])
> AC_CONFIG_FILES([Makefile])
> AC_OUTPUT
> EOF
> 
> cat > Makefile.am <<EOF
> TEST_EXTENSIONS = .test
>
JFTR: this line is useless for two orthogonal reasons:

  1. you're not using the `parallel-tests' option anywhere, thus
     $(TEST_EXTENSIONS) is never used nor considered (and many other
     nifty features are lost too IMHO);

  2. even if you add `parallel-tests' to AUTOMAKE_OPTIONS, `.test'
     is in the default value of $(TEST_EXTENSIONS) anyway, so there
     is no need to add it explicitly (note that adding it is not
     wrong, only redundant).

> TESTS = test/foo.test
> EOF
You've forgotten to add $(TESTS) to $(EXTRA_DIST) here:

  EXTRA_DIST = $(TESTS)

If you add the above line to your Makefile.am (both the reduced one
and the original one), does you problem disappear?  If yes, I'll
close this bug report.

> mkdir -p test
> cat > test/foo.test <<EOF
> echo hello world
> exit 0
> EOF
> chmod 755 test/foo.test
> 
> autoreconf -ivf
> ./configure
> make all
> make check
> make distcheck
> 
> Is this a bug or am I doing something wrong?
> 
> I'm using Automake 1.11.1
> 
> Thanks,
> Peter
> 

HTH,
  Stefano