Subject: bug#19961: check-local is kind of like check-hook

From: Shahbaz Youssefi <[email-masked]>
Date: Fri, 27 Feb 2015 17:07:27 +0100

Hi,

The -local and -hook targets are generally used like this:

X: X-local
    # stuff to do X
    $(MAKE) X-hook

That is, X-local is run first, then the automake generated rules do X
and then X-hook is called.

With check-local, the generated Makefile.in looks like this:

check-am: all-am
    $(MAKE) $(AM_MAKEFLAGS) check-TESTS check-local

Now as far as the documentation is concerned, this is valid:

> With the -local targets, there is no particular guarantee of execution order; typically, they are run early, but with parallel make, there is no way to be sure of that.

However, even with not-parallel make, check-local executes after the tests.

To align this with the other -local rules, why not generate it like this?

check-am: all-am check-local
    $(MAKE) $(AM_MAKEFLAGS) check-TESTS

The reason I actually have a problem with the current method is that
it is impossible to perform an action before the check. In my
particular case, my test scripts use test kernel modules. Of course,
automake doesn't have a target like check_KERNELMODULE for example to
automatically build the kernel module before running the tests. So
ideally what I could do is to build the kernel module in check-local.
The way the Makefile.in's are currently generated, this is impossible.

In my case, I had to use all-local to build the test kernel modules,
even if the user is not interested in make check, which is annoying in
the least.

Good day,
Shahbaz

---

P.S. I think it's all very clear, but just for good measure, here is an example:

=================================

configure.ac:

AC_PREREQ([2.68])
AC_INIT([Demo], [0.0], [demo])
AC_CONFIG_AUX_DIR([bin])
AC_CONFIG_MACRO_DIR([m4])

AM_INIT_AUTOMAKE([1.14 -Wall -Werror foreign])

AC_CONFIG_FILES([Makefile])
AC_OUTPUT

=================================

Makefile.am:

ACLOCAL_AMFLAGS = -I m4

check_SCRIPT = test_script

TESTS = $(check_SCRIPT)

check-local:
    @echo "*******************************************"
    @echo "*******************************************"
    @echo "I wanted this to be called before the check"
    @echo "*******************************************"
    @echo "*******************************************"

=================================

test_script:

#! /bin/bash

echo "Running test script"