[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
running tests under in a tests/ directory
From: |
aaragon |
Subject: |
running tests under in a tests/ directory |
Date: |
Thu, 28 May 2009 20:44:57 -0700 (PDT) |
Hi everyone,
I found a Makefile.am file on the internet to run tests under a tests
folder. The code looks like follows:
In the rootdir/Makefile.am
include m4/aminclude.am
ACLOCAL_AMFLAGS = -I m4
SUBDIRS = yafeq tests
MOSTLYCLEANFILES = $(DX_CLEANFILES)
EXTRA_DIST=autogen.sh $(DX_CONFIG)
# test rule
TSTDIR = tests
check: all
@echo
"-------------------------------------------------------------------"
@echo "Running tests"
@make test -s -C $(TSTDIR)
@echo
"-------------------------------------------------------------------"
Then in the tests/Makefile.am
# this is example-file: tests/Makefile.am
TESTSOURCE = $(wildcard test*.cpp)
TESTOBJS=$(TESTSOURCE:%.cpp=%.o)
TESTEXECS = $(TESTOBJS:%.o=%)
DIFFS=$(TESTOBJS:.o=.diff)
# adding source and verified output files to the distribution
EXTRA_DIST = $(TESTSOURCE) $(TESTOBJS:.o=.verified)
# additional linker and compiler flags
LDFLAGS = -L$(top_srcdir)/yafeq -lyafeq $(LDFLAGS)
CPPFLAGS = -I$(top_srcdir) -I$(top_srcdir)/yafeq
#################################################################
test: $(TESTEXECS) $(DIFFS)
$(TESTEXECS): $(TESTDEPENDFILE) $(TESTOBJS)
@$(CXX) address@hidden $(LDFLAGS) -o $@
%.diff: %
@./$< > $<.lastout
@name=$<; \
name=$${name/test/} ;\
if [ -e $<.verified ] ; then \
if diff -w $<.verified $<.lastout >$@ ; then \
printf " Testing %-40s OK\n" $$name; \
else \
printf " Testing %-40s FAILED\n" $$name;\
echo "----------------------------------------" ;\
echo "Diff for $$name (verified '<', current '>')" ;\
cat $@ ;\
echo "----------------------------------------" ;\
echo "[ If new output is correct: mv $<.lastout
$<.verified ]" ;\
fi ;\
$(RM) $@ ;\
else \
echo "----------------------------------------" ;\
echo "Output of $$name" ;\
cat $<.lastout ;\
echo "----------------------------------------" ;\
echo "WARNING: verified output of $$name is missing." ;\
echo "Please generate a file $<.verified that" ;\
echo "contains the verfied output of $$name."; \
echo "[ If output is correct: mv $<.lastout $<.verified ]" ;\
fi
$(TESTDEPENDFILE):
@$(CXX) $(INCLUDES) -MM $(TESTSOURCES) > $(TESTDEPENDFILE)
-include $(TESTDEPENDFILE)
%.o: %.cpp
@name=$<; \
name=$${name/test/} ;\
printf " Compiling %-38s OK\n" $$name; \
$(CXX) $(INCLUDES) $(CPPFLAGS) -c $<
clean-local:
$(RM) -rf $(TESTOBJS) $(TESTEXECS) $(TESTDEPENDFILE)
$(TESTEXECS:=.lastout)\
$(TESTEXECS:=.diff) *~ $(TESTEXECS:=.exe)
The problem I have, is that when I write a test file (for example
test_T3.cpp), I get:
address@hidden/Documents/workspace/yafeq/tests$mt
Compiling IntegrationRules.cpp OK
BD Software STL Message Decryptor v3.10 for gcc 2/3/4
In file included from testIntegrationRules.cpp:1:
../yafeq/quadrature.hpp:14:36: error: cpputils/map_adaptor.hpp: No such file
or
directory
Now, the file cpputils/map_adaptor.hpp does exist, and I actually have a
test for detecting the cpputils library. I guess the CPPFLAGS that includes
the correct path is not being passed to this piece of code written in the
Makefile.am.
Does anyone know how to fix this?
Thank you all,
aa
--
View this message in context:
http://www.nabble.com/running-tests-under-in-a-tests--directory-tp23773808p23773808.html
Sent from the Gnu - Automake - General mailing list archive at Nabble.com.
- running tests under in a tests/ directory,
aaragon <=