[Top][All Lists]

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

autotest, automake & non-recursive makes

From: Diab Jerius
Subject: autotest, automake & non-recursive makes
Date: Thu, 26 Sep 2013 12:16:06 -0400

I embarked on a journey yesterday involving automake, autotest, and
non-recursive makes.  I started with the example snippet
provided in the autoconf (v 2.69) manual and ran into a few problems,
which I've kludged around.  Perhaps others have better solutions?

For context, during development I perform multiple, parallel builds
outside of the source tree. The source tree includes the autotools
generated files, but nothing else (it's not equivalent to a final
distribution tree).  Files generated by running configure or make must
end up in the individual build trees or the competing parallel builds
will clobber each other's efforts.

Other than slapping %D% in front of applicable paths, there are a
couple of changes I had to make to the example code.

* The example code writes into $(srcdir), which causes
non-deterministic failures in my environment.

* The generated testsuite executable assumes that it is running in the
same directory as the generated atconfig file, not in the top build
directory.  I kludged around this, but I'm not happy with my solution.

* The code which generates the testsuite executable assumes that
package.m4 is in the current directory (which may not be the case in
non-recursive builds)

I've appended my code to this message; the differences between it and
the example code are

* relevant paths use %D%

* I added %D% to the paths autom4te uses to generate testsuite, so
that it can find %D%/package.m4

* testsuite is run inside of %D%, with a bit of a kludge to find the
testsuite executable when it's not in %D% (e.g. when running
distcheck).  I had to force an absolute path here.

* AUTOTEST_PATH includes %D% in the build tree, as I create test
executables there. I had to force an absolute path, as it seems that
tests are actually run in temporary directories, and I don't know how
to deterministically determine the relative path to the build tree's
test dir.

* atlocal isn't supported; I don't use it (yet), and it added noise;
it's simple to add it back in.

* I had to explicitly clean a few files to make distcheck happy.

Here it is:

# The `:;' works around a Bash 3.2 bug when the output is not writable.
%D%/package.m4: $(top_srcdir)/
    :;{ \
      echo '# Signature of the current package.' && \
      echo 'm4_define([AT_PACKAGE_NAME],' && \
      echo '  [$(PACKAGE_NAME)])' && \
      echo 'm4_define([AT_PACKAGE_TARNAME],' && \
      echo '  [$(PACKAGE_TARNAME)])' && \
      echo 'm4_define([AT_PACKAGE_VERSION],' && \
      echo '  [$(PACKAGE_VERSION)])' && \
      echo 'm4_define([AT_PACKAGE_STRING],' && \
      echo '  [$(PACKAGE_STRING)])' && \
      echo 'm4_define([AT_PACKAGE_BUGREPORT],' && \
      echo '  [$(PACKAGE_BUGREPORT)])'; \
      echo 'm4_define([AT_PACKAGE_URL],' && \
      echo '  [$(PACKAGE_URL)])'; \
    } > $@

EXTRA_DIST += %D%/ %D%/package.m4 %D%/$(TESTSUITE)
DISTCLEANFILES  += %D%/atconfig %D%/testsuite.log

TESTSUITE = testsuite

check-local: %D%/atconfig %D%/$(TESTSUITE)
    cd %D%; \
    if test -f '$(TESTSUITE)' ; then d=; else d='$(abs_top_srcdir)/%D%/' ; fi ;\
    $(SHELL) $$d'$(TESTSUITE)' AUTOTEST_PATH='$(abs_builddir)/%D%'

installcheck-local: %D%/atconfig  %D%/$(TESTSUITE)
    cd %D%; \
    if test -f '$(TESTSUITE)' ; then d=; else d='$(abs_top_srcdir)/%D%/' ; fi ;\
    $(SHELL) $$d'$(TESTSUITE)' AUTOTEST_PATH='$(abs_builddir)/%D%'

    test ! -f '%D%/$(TESTSUITE)' || $(SHELL) '%D%/$(TESTSUITE)' --clean

AUTOM4TE = $(SHELL) $(top_srcdir)/build-aux/missing --run autom4te
AUTOTEST = $(AUTOM4TE) --language=autotest

%D%/$(TESTSUITE): %D%/ %D%/package.m4
    $(AUTOTEST) -I '$(srcdir)' -I '%D%' -o address@hidden address@hidden
    mv address@hidden $@

reply via email to

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