# CppUnit settings
#
# $Revision: 884 $
# $Date: 2006-11-16 10:39:08 -0800 (Thu, 16 Nov 2006) $

BUILDUSER ?= @BUILDUSER@
BUILDNUMBER ?= @BUILDNUMBER@
TESTRUNNER ?= @TESTRUNNER@

TESTSRCS := $(wildcard tests/Test*.cpp)

# Set up the rules for building the test executable and running it.
all_and_buildtest: all buildtest

ifeq ($(origin TEST_TARGETS),undefined)
TEST_TARGETS = cppunittest
endif

# Set the default argument to 'timedrun' to 2 minutes, which keeps
# cppunit testrunners from hanging. I increased this to 2 minutes 
# because the erunner test (for example) just takes longer than
# 1 minute at this point on all machines I tried it on... so let's
# use a timeout that will generally allow our tests to work.

TIMEDRUN ?= timedrun
TIMEDRUN_TIMEOUT ?= 120

# Options to the testrunner program.
TESTARGS ?= -kv

# Run the tests
test: $(TEST_TARGETS)

cppunittest: buildtest
ifneq ($(TIMEDRUN),)
	$(LDLIB_OVERRIDE) $(TIMEDRUN) $(TIMEDRUN_TIMEOUT) ./testrunner$(EXE_EXT) $(TESTARGS)
else
	$(LDLIB_OVERRIDE) ./testrunner$(EXE_EXT) $(TESTARGS)
endif

buildtest: $(TESTRUNNER)
