[Top][All Lists]

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

Bracketing a "check" target with pre and post actions

From: Bernd Jendrissek
Subject: Bracketing a "check" target with pre and post actions
Date: Mon, 14 Jul 2008 14:49:46 +0200

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?

Arguments in favour of just leaving the data in the base are expressly

I can make a check-local target that sets up the database (essentially
something like psql $(dbname) $(dbuser) -f
$(top_srcdir)/whatever/dump.sql), but how do I tear it down again?
I'd prefer to invoke the test run with "make check", but if this is
impossible I suppose I could make do:

.PHONY: fat-check
fat-check: check
    echo "drop database foo;" |psql postgres $(dbsuperuser)

    echo "create database foo;" |psql postgres $(dbsuperuser)
    psql $(dbname) $(dbuser) -f $(top_srcdir)/whatever/dump.sql


reply via email to

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