automake
[Top][All Lists]
Advanced

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

Re: Bracketing a "check" target with pre and post actions


From: Bernd Jendrissek
Subject: Re: Bracketing a "check" target with pre and post actions
Date: Mon, 21 Jul 2008 13:31:46 +0200

On Sun, Jul 20, 2008 at 9:32 PM, Ralf Wildenhues <address@hidden> wrote:
> * Bernd Jendrissek wrote on Mon, Jul 14, 2008 at 02:49:46PM CEST:
>> I need to run my testsuite against a PostgreSQL database that I want
>> predictably populated with data straight from the source tree, so that
>> code version 17 gets tested against data version 17.  How can I teach
>> automake to set up the database before running the testsuite, and to
>> clean it up afterwards?
>
>> .PHONY: fat-check
>> fat-check: check
>>     echo "drop database foo;" |psql postgres $(dbsuperuser)
>>
>> check-local:
>>     echo "create database foo;" |psql postgres $(dbsuperuser)
>>     psql $(dbname) $(dbuser) -f $(top_srcdir)/whatever/dump.sql
>
> Why not do it all in check-local?
>
> check-local:
>    echo "create database foo;" |psql postgres $(dbsuperuser)
>    psql $(dbname) $(dbuser) -f $(top_srcdir)/whatever/dump.sql
>    echo "drop database foo;" |psql postgres $(dbsuperuser)

In the end I did that, since I'm now no longer bracketing 'make check'
but dropping the database just before populating it again.  (It helps
to do post-mortem analysis of test failures.)  So I didn't need
anything to run after 'check'.  Just had to add a dependency:

check-local: check

so that the database setup would happen before the testsuite ran.

> Or do you have a TESTS=... testsuite, rather than the second command
> being your testsuite?

I have both TESTS = ... and AM_INIT_AUTOMAKE(dejagnu).  If by "second
command" you mean "psql ... dump.sql", no, that's just to populate the
database for the program that runs as a dejagnu "tool" test.

Thanks for the response




reply via email to

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