GNU bug report logs - #19961
check-local is kind of like check-hook

Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.

Package: automake; Reported by: Shahbaz Youssefi <shabbyx@HIDDEN>; dated Fri, 27 Feb 2015 16:59:02 UTC; Maintainer for automake is bug-automake@HIDDEN.

Message received at 19961 <at> debbugs.gnu.org:


Received: (at 19961) by debbugs.gnu.org; 2 Mar 2015 12:17:21 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Mon Mar 02 07:17:21 2015
Received: from localhost ([127.0.0.1]:33886 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.80)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1YSPHl-0007Dz-0f
	for submit <at> debbugs.gnu.org; Mon, 02 Mar 2015 07:17:21 -0500
Received: from mail-lb0-f176.google.com ([209.85.217.176]:45232)
 by debbugs.gnu.org with esmtp (Exim 4.80)
 (envelope-from <shabbyx@HIDDEN>) id 1YSPHi-0007Dh-7O
 for 19961 <at> debbugs.gnu.org; Mon, 02 Mar 2015 07:17:19 -0500
Received: by lbiz12 with SMTP id z12so1628430lbi.12
 for <19961 <at> debbugs.gnu.org>; Mon, 02 Mar 2015 04:17:12 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113;
 h=mime-version:in-reply-to:references:date:message-id:subject:from:to
 :cc:content-type;
 bh=+m8F4MWX8SNbxf3Pnt4T6SZ/l+SKBVC2dv61nDwxs84=;
 b=zyS5TDw3dPPzmv8JOIUhaz8K5z0brGBbeLmxd7k04w6Eq/0NQL8CVVotYLwqBL/TqI
 RuuXc27pAIWRWxd5mbOVt9ZMAkrS4WeOGzRBpURtnCODbryh6wXC9qC+7bVg9eibgjLJ
 4bQxaQNMMA91CHLcwXw9AgWraNdl8iUR6lar9yzkZPwFVEQdQKj20U7IgiZ1b7SKZTgG
 FBasR6yzFOJjKykDyaIRLjE9EeRKwDB7xDKAsw27HDLEtxnqI36Ebm6XT3mqwSs201NL
 yo8Z2ggkoR/Rj0+wNtV5/GtvfWOBmNZYS94TOnlJ2UhIBpc/3AOO3BhUsBzJ1arcFJko
 A+Cw==
MIME-Version: 1.0
X-Received: by 10.112.146.66 with SMTP id ta2mr24538965lbb.0.1425298632301;
 Mon, 02 Mar 2015 04:17:12 -0800 (PST)
Received: by 10.112.73.4 with HTTP; Mon, 2 Mar 2015 04:17:12 -0800 (PST)
In-Reply-To: <54F39E41.4020504@HIDDEN>
References: <CALeOzZ_mc6PP5YiRYJzC_J=YdsbSsz+rEWE6LfTxkEW7dJgSwA@HIDDEN>
 <54F39E41.4020504@HIDDEN>
Date: Mon, 2 Mar 2015 13:17:12 +0100
Message-ID: <CALeOzZ9M2tyG-sK69gM4MUW6mSxyAUuJqACLHjaXoz1=Gfg3eA@HIDDEN>
Subject: Re: bug#19961: check-local is kind of like check-hook
From: Shahbaz Youssefi <shabbyx@HIDDEN>
To: Peter Johansson <trojkan@HIDDEN>
Content-Type: text/plain; charset=UTF-8
X-Spam-Score: -0.7 (/)
X-Debbugs-Envelope-To: 19961
Cc: 19961 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.15
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -0.7 (/)

On Mon, Mar 2, 2015 at 12:18 AM, Peter Johansson <trojkan@HIDDEN> wrote:
> On 02/28/2015 02:07 AM, Shahbaz Youssefi wrote:
>>
>> 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
>
> I think it would be a mistake to change this rule. Some projects might rely
> on the fact that 'check-local' depends on 'all-am' and 'check-local' might
> e.g. run some of the programs built within 'all-am'.
>

Fair enough. Wouldn't something like this address that issue?

check-local: all-am

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

>
> With my Automake the rule looks like:
>
> check-am: all-am
>     $(MAKE) $(AM_MAKEFLAGS) $(check_SCRIPTS) $(check_DATA)
>     $(MAKE) $(AM_MAKEFLAGS) check-TESTS check-local
>
> so you could move your check_kernelmodule into check_DATA with something
> like (untested)
>
> check_DATA = kernelmodule.timestamp
>
> kernelmodule.timestamp:
>     @echo "*******************************************"
>     @echo "*******************************************"
>     @echo "I want this to be called before the check"
>     @echo "*******************************************"
>     @echo "*******************************************"
>

Ok, I haven't seen check_DATA before (is that new in Automake 1.15?).
This could be a solution of course, although a bit strange, since the
kernel module is not really "data".

I do have a related suggestion nevertheless. You see, no matter how
many scenarios you think about, there is always some use-case that's
going to be desired by someone but is unforeseen. Why not just create
a general rule? My suggestion is to have for each target X, the
following two targets:

- X-pre is guaranteed to run before X
- X-post is guaranteed to run after X

This way, regardless of the target, anyone with whatever strange,
foreseen or unforeseen scenario, can use these two to extend the
operation of the target.

Kampai,
Shahbaz




Information forwarded to bug-automake@HIDDEN:
bug#19961; Package automake. Full text available.

Message received at 19961 <at> debbugs.gnu.org:


Received: (at 19961) by debbugs.gnu.org; 1 Mar 2015 23:18:39 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sun Mar 01 18:18:39 2015
Received: from localhost ([127.0.0.1]:33648 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.80)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1YSD8A-0003wb-F8
	for submit <at> debbugs.gnu.org; Sun, 01 Mar 2015 18:18:39 -0500
Received: from mail-pa0-f51.google.com ([209.85.220.51]:35186)
 by debbugs.gnu.org with esmtp (Exim 4.80)
 (envelope-from <trojkan@HIDDEN>) id 1YSD87-0003wN-Mm
 for 19961 <at> debbugs.gnu.org; Sun, 01 Mar 2015 18:18:36 -0500
Received: by pabli10 with SMTP id li10so9141534pab.2
 for <19961 <at> debbugs.gnu.org>; Sun, 01 Mar 2015 15:18:29 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113;
 h=message-id:date:from:user-agent:mime-version:to:cc:subject
 :references:in-reply-to:content-type:content-transfer-encoding;
 bh=jxv2Sfb6pAb6Yr3IohXrlWSYp3U7ZzPA/9DGmbM6ftA=;
 b=XkIuhi7o+q8LDSRrspwrReFdje4z7MDscXOUCCiX4sMi6f5d/Z3imG5QWg4b9OGWiK
 akbSusaSCzl//75gr4G8ZL8WsU1iFpVcyf41IrfI7QfXI4eA7uDeayH1Kw6tUAMOLnWc
 DYgMd/aGlFiH+6k56PaA62Ej4jaAjvuUO/DNp5vD5Wjf2p9YDvOoHvfp5pFKCVWx6GAk
 qVBE0oWkxzcRcwNlaRRge9MTUVoSDDk7AXoDQ3TTQfMfXv8WTgaKEFsAxM5MOLAvJJGA
 X71hYKjAIQ9ZlGD7Usn0a21rFFrPFVeYNK4iHyduwZGaFLt7QVqbVqPPbYpCWHCabW/a
 mMrg==
X-Received: by 10.68.211.228 with SMTP id nf4mr42400481pbc.66.1425251909722;
 Sun, 01 Mar 2015 15:18:29 -0800 (PST)
Received: from [10.3.81.47] (gateway.qimr.edu.au. [152.98.8.1])
 by mx.google.com with ESMTPSA id rr9sm10014641pbc.39.2015.03.01.15.18.27
 (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128);
 Sun, 01 Mar 2015 15:18:28 -0800 (PST)
Message-ID: <54F39E41.4020504@HIDDEN>
Date: Mon, 02 Mar 2015 09:18:25 +1000
From: Peter Johansson <trojkan@HIDDEN>
User-Agent: Mozilla/5.0 (X11; Linux x86_64;
 rv:24.0) Gecko/20100101 Thunderbird/24.8.0
MIME-Version: 1.0
To: Shahbaz Youssefi <shabbyx@HIDDEN>
Subject: Re: bug#19961: check-local is kind of like check-hook
References: <CALeOzZ_mc6PP5YiRYJzC_J=YdsbSsz+rEWE6LfTxkEW7dJgSwA@HIDDEN>
In-Reply-To: <CALeOzZ_mc6PP5YiRYJzC_J=YdsbSsz+rEWE6LfTxkEW7dJgSwA@HIDDEN>
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
X-Spam-Score: -0.7 (/)
X-Debbugs-Envelope-To: 19961
Cc: 19961 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.15
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -0.7 (/)

On 02/28/2015 02:07 AM, Shahbaz Youssefi wrote:
> 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

I think it would be a mistake to change this rule. Some projects might 
rely on the fact that 'check-local' depends on 'all-am' and 
'check-local' might e.g. run some of the programs built within 'all-am'.


>
> 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.

With my Automake the rule looks like:

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

so you could move your check_kernelmodule into check_DATA with something 
like (untested)

check_DATA = kernelmodule.timestamp

kernelmodule.timestamp:
     @echo "*******************************************"
     @echo "*******************************************"
     @echo "I want this to be called before the check"
     @echo "*******************************************"
     @echo "*******************************************"





Cheers,
Peter

-- 
Peter Johansson





Information forwarded to bug-automake@HIDDEN:
bug#19961; Package automake. Full text available.

Message received at submit <at> debbugs.gnu.org:


Received: (at submit) by debbugs.gnu.org; 27 Feb 2015 16:58:13 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Fri Feb 27 11:58:13 2015
Received: from localhost ([127.0.0.1]:60147 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.80)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1YROEv-0007NP-5Q
	for submit <at> debbugs.gnu.org; Fri, 27 Feb 2015 11:58:13 -0500
Received: from eggs.gnu.org ([208.118.235.92]:52351)
 by debbugs.gnu.org with esmtp (Exim 4.80)
 (envelope-from <shabbyx@HIDDEN>) id 1YRNS1-0006CK-66
 for submit <at> debbugs.gnu.org; Fri, 27 Feb 2015 11:07:41 -0500
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
 (envelope-from <shabbyx@HIDDEN>) id 1YRNRr-0007gM-Ta
 for submit <at> debbugs.gnu.org; Fri, 27 Feb 2015 11:07:32 -0500
X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org
X-Spam-Level: 
X-Spam-Status: No, score=0.8 required=5.0 tests=BAYES_50,FREEMAIL_FROM,
 T_DKIM_INVALID autolearn=disabled version=3.3.2
Received: from lists.gnu.org ([2001:4830:134:3::11]:40429)
 by eggs.gnu.org with esmtp (Exim 4.71)
 (envelope-from <shabbyx@HIDDEN>) id 1YRNRr-0007g3-RN
 for submit <at> debbugs.gnu.org; Fri, 27 Feb 2015 11:07:31 -0500
Received: from eggs.gnu.org ([2001:4830:134:3::10]:54041)
 by lists.gnu.org with esmtp (Exim 4.71)
 (envelope-from <shabbyx@HIDDEN>) id 1YRNRq-0002kp-Su
 for bug-automake@HIDDEN; Fri, 27 Feb 2015 11:07:31 -0500
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
 (envelope-from <shabbyx@HIDDEN>) id 1YRNRp-0007er-Sq
 for bug-automake@HIDDEN; Fri, 27 Feb 2015 11:07:30 -0500
Received: from mail-lb0-x229.google.com ([2a00:1450:4010:c04::229]:33014)
 by eggs.gnu.org with esmtp (Exim 4.71)
 (envelope-from <shabbyx@HIDDEN>) id 1YRNRp-0007eE-LF
 for bug-automake@HIDDEN; Fri, 27 Feb 2015 11:07:29 -0500
Received: by lbvp9 with SMTP id p9so18277052lbv.0
 for <bug-automake@HIDDEN>; Fri, 27 Feb 2015 08:07:28 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113;
 h=mime-version:date:message-id:subject:from:to:content-type;
 bh=9EJTFM3l896sGGdiIzC90fajNTH1x76Bo+kQpR2ML/w=;
 b=HIAID0rZVgTXHq/OesyV5OfzwAFKEhW40Zn2Y6KmnfsHp/RIS698X2SnMChOSK26jo
 XlfM1KaymtacPs0b/3Ax96IBc7c6DrEvvp734W9hhj6K3P+HeGXVE7iQ/uq8ZIVfgyRF
 9QjBTXtSdWJDrGp3ciVxg4UVb+CnifC3N6ulMfNAN/tyuQy6J/EWq0SBvGWFjrDL5fJB
 zYgJSSU80/GqhoJi1Vpsk+OEqdxny7AUsLE8D6jqoY8FIgkUeEefcHyNxoOPI4h8F+1Q
 W40Jhs95ceWi0SAldQhb6gpy8kHwe0qYv+4Nl3sGKXcTg/A/QxfVi1fKsTyosHOV4v7v
 LThw==
MIME-Version: 1.0
X-Received: by 10.152.10.98 with SMTP id h2mr13217613lab.18.1425053248008;
 Fri, 27 Feb 2015 08:07:28 -0800 (PST)
Received: by 10.112.73.4 with HTTP; Fri, 27 Feb 2015 08:07:27 -0800 (PST)
Date: Fri, 27 Feb 2015 17:07:27 +0100
Message-ID: <CALeOzZ_mc6PP5YiRYJzC_J=YdsbSsz+rEWE6LfTxkEW7dJgSwA@HIDDEN>
Subject: check-local is kind of like check-hook
From: Shahbaz Youssefi <shabbyx@HIDDEN>
To: bug-automake@HIDDEN
Content-Type: text/plain; charset=UTF-8
X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address
 (bad octet value).
X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address
 (bad octet value).
X-Received-From: 2001:4830:134:3::11
X-Spam-Score: -4.0 (----)
X-Debbugs-Envelope-To: submit
X-Mailman-Approved-At: Fri, 27 Feb 2015 11:58:11 -0500
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.15
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -4.0 (----)

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"




Acknowledgement sent to Shahbaz Youssefi <shabbyx@HIDDEN>:
New bug report received and forwarded. Copy sent to bug-automake@HIDDEN. Full text available.
Report forwarded to bug-automake@HIDDEN:
bug#19961; Package automake. Full text available.
Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.
Last modified: Mon, 2 Mar 2015 12:30:02 UTC

GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997 nCipher Corporation Ltd, 1994-97 Ian Jackson.