This website is no longer maintained. Its content may be obsolete. Please visit http://home.cern/ for current CERN information.
How to make a testsuite for Anaphe packages |
Author: Dino Ferrero Merlino
Date: 15 Sept 2001
gmake test "LOCALTEST=1"
# Standard Anaphe makefile include $(LHCXX_REL_DIR)/etc/lhcxx.mk # Special stuff for testing include $(LHCXX_REL_DIR)/etc/test.mk ifdef LOCALTEST C_INCLUDES += -I../../ TEST_LIBS += -L../lib/${OS} -lHepUtilities LIBPATH = `find ../lib -name *.$(SHLIB_EXT)|awk $(AWK_LIBS_PATH)` else C_INCLUDES += -I${LHCXX_REL_DIR}/include TEST_LIBS += -L${LHCXX_REL_DIR}/lib -lHepUtilities endif # Application name, source files on objects SRC = testutil.cpp CutList.cpp APPL = testutil OBJS = $(addprefix $(OS)/, $(SRC:.cpp=.$(OBJ_EXT))) # make APPL the default target all: $(APPL) test: clean all run $(APPL): GNUmakefile $(OBJS) $(C++) $(C_FLAGS) -o $(OS)/$(APPL) $(OBJS) $(TEST_LIBS) \ $(DYNA_LIBS) run: testrun
# All other includes and libraries C_INCLUDES += -I$(LHCXX_REL_DIR)/include TEST_LIBS += -L${LHCXX_REL_DIR}/lib -lCLHEP
ifdef VERBOSE showlibs: @(LD_LIBRARY_PATH=$(LIBPATH)$(LD_LIBRARY_PATH);export LD_LIBRARY_PATH;\ $(LDD) $(OS)/$(APPL)) else showlibs: endif testrun: showlibs @(LD_LIBRARY_PATH=$(LIBPATH)$(LD_LIBRARY_PATH);export LD_LIBRARY_PATH;\ $(OS)/$(APPL))This target prepends the path to local libraries to LD_LIBRARY_PATH (if necessary) and shows the loaded shared libraries if the VERBOSE variable is set.
gmake test cleaning in /afs/cern.ch/user/d/dinofm/hepexplorer/RH61/HepUtilities/test creating platform directory... compiling testutil compiling CutList g++ -I/afs/cern.ch/sw/lhcxx/specific/redhat61/gcc-2.95.2/3.6.3-pre1/include -ansi -pedantic -Wall -Wno-long-long -Wpointer-arith -Wnested-externs -Woverloaded-virtual -Wbad-function-cast -Wconversion -fnonnull-objects -pthread -o Linux/testutil Linux/testutil.o Linux/CutList.o -L/afs/cern.ch/sw/lhcxx/specific/redhat61/gcc-2.95.2/3.6.3-pre1/lib -lHepUtilities -ldl gmake[1]: Entering directory `/afs/cern.ch/project/asddat/hepexplorer/RH61/HepUtilities/test' gmake[1]: Leaving directory `/afs/cern.ch/project/asddat/hepexplorer/RH61/HepUtilities/test' Test 1 : passed Test 2 : passed Test 3 : passed Test 4 : passed Test 5 : passed 2000-Jan-1 0:0:0.0 (GMT) Test 6 : passed
gmake test "LOCALTEST=1" "VERBOSE=1" including /afs/cern.ch/sw/lhcxx/specific/redhat61/gcc-2.95.2/3.6.3-pre1/etc/unix_defaults.mk including /afs/cern.ch/sw/lhcxx/specific/redhat61/gcc-2.95.2/3.6.3-pre1/etc/Linux.mk including /afs/cern.ch/sw/lhcxx/specific/redhat61/gcc-2.95.2/3.6.3-pre1/etc/deps.mk cleaning in /afs/cern.ch/user/d/dinofm/hepexplorer/RH61/HepUtilities/test creating platform directory... compiling testutil g++ -c testutil.cpp -I../../ -ansi -pedantic -Wall -Wno-long-long -Wpointer-arith -Wnested-externs -Woverloaded-virtual -Wbad-function-cast -Wconversion -fnonnull-objects -pthread -o "Linux/testutil.o" compiling CutList g++ -c CutList.cpp -I../../ -ansi -pedantic -Wall -Wno-long-long -Wpointer-arith -Wnested-externs -Woverloaded-virtual -Wbad-function-cast -Wconversion -fnonnull-objects -pthread -o "Linux/CutList.o" g++ -I../../ -ansi -pedantic -Wall -Wno-long-long -Wpointer-arith -Wnested-externs -Woverloaded-virtual -Wbad-function-cast -Wconversion -fnonnull-objects -pthread -o Linux/testutil Linux/testutil.o Linux/CutList.o -L../lib/Linux -lHepUtilities -ldl libHepUtilities.so => ../lib/Linux/libHepUtilities.so (0x2aac0000) libdl.so.2 => /lib/libdl.so.2 (0x2aae5000) libstdc++-libc6.1-2.so.3 => /usr/local/gcc-alt-2.95.2/lib/libstdc++-libc6.1-2.so.3 (0x2aae9000) libm.so.6 => /lib/libm.so.6 (0x2ab31000) libpthread.so.0 => /lib/libpthread.so.0 (0x2ab4e000) libc.so.6 => /lib/libc.so.6 (0x2ab61000) /lib/ld-linux.so.2 => /lib/ld-linux.so.2 (0x2aaab000) gmake[1]: Entering directory `/afs/cern.ch/project/asddat/hepexplorer/RH61/HepUtilities/test' g++ shTest.cpp -c -I../../.. -I. -fPIC -I/afs/cern.ch/sw/lhcxx/specific/redhat61/gcc-2.95.2/HepODBMS/0.3.2.11/include -I/afs/cern.ch/sw/lhcxx/specific/redhat61/gcc-2.95.2/Objectivity/6.1/include -o shTest.o g++ -shared -o shTest.so -ldl \ shTest.o gmake[1]: Leaving directory `/afs/cern.ch/project/asddat/hepexplorer/RH61/HepUtilities/test' Test 1 : passed Test 2 : passed Test 3 : passed Test 4 : passed Test 5 : passed 2000-Jan-1 0:0:0.0 (GMT) Test 6 : passed
ifdef LOCALTEST # prepend local headers (include files from code and utility dirs) C_INCLUDES += `find ../../[cu]* -name *.h|awk $(AWK_INCS_FILTER)` # figure out local libraries TEST_LIBS = `find ../../code/T_ -name *.$(SHLIB_EXT)|awk $(AWK_LIBS_FILTER)` LIBPATH = `find ../../code/T_ -name *.$(SHLIB_EXT)|awk $(AWK_LIBS_PATH)` else # use release libraries TEST_LIBS = -L$(LHCXX_REL_DIR)/lib -lT_Histoxx endifThe first find looks for header files in HTL subdirectories starting with c (code) or u (utility). The output of the filter would be someting like that:
-I../../utility -I../../code/Common/ -I../../code/T_/The second find looks for shared libraries in HTL subdirectory ../../code/T_. The output of the filter would be someting like that:
-L../../code/T_/HTL/Linux/ -lT_HistoxxFinally the third filter would produce a library path that can be prepended to the environment variable LD_LIBRARY_PATH:
../../code/T_/HTL/Linux/: