test/Makefile
author Krista Bennett <krista@pep-project.org>
Thu, 29 Nov 2018 09:01:36 +0100
changeset 3164 5c4b1bd2c638
parent 2975 6814ae868489
child 3166 fe040af3f305
child 3170 5cb1f7917d5a
permissions -rw-r--r--
Small test fixes and changes - now with error summary at end so you can find those pesky tests and their errors
     1 
     2 # Copyright 2017, pEp Foundation
     3 # This file is part of pEpEngine
     4 # This file may be used under the terms of the GNU General Public License version 3
     5 # see LICENSE.txt
     6 
     7 include ../default.conf
     8 
     9 PY_ENV := $(shell command -v python3 2> /dev/null)
    10 
    11 HERE:=$(CURDIR)
    12 TEST_HOME=$(HERE)/pEp_test_home
    13 
    14 TARGET=TestDriver
    15 
    16 SRCS := $(wildcard src/*.cc) $(wildcard src/*/*.cc)
    17 OBJS := $(addsuffix .o,$(basename $(SRCS)))
    18 DEPS := $(OBJS:.o=.d)
    19 
    20 INC_DIRS := ./include /usr/local/include 
    21 INC_FLAGS := $(addprefix -I,$(INC_DIRS)) $(GPGME_INC) $(CPPUNIT_INC)
    22 
    23 LDFLAGS += -L/usr/local/lib
    24 
    25 CFLAGS += -Wno-deprecated
    26 CXXFLAGS += -Wno-deprecated
    27 
    28 LDFLAGS+= $(ETPAN_LIB) $(CPPUNIT_LIB) -L../asn.1 -L../src
    29 LDLIBS+= -letpan -lpEpEngine -lstdc++ -lasn1
    30 
    31 ifeq ($(BUILD_FOR),Linux)
    32 	LDLIBS+= -luuid
    33 endif
    34 
    35 ifeq ($(OPENPGP),NETPGP)
    36 	LDLIBS+= -lnetpgp
    37 ifeq ($(BUILD_FOR),Linux)
    38 	LDLIBS+= -ltre
    39 endif
    40 endif
    41 
    42 ifdef SQLITE3_FROM_OS
    43 	LDLIBS+= -lsqlite3
    44 endif
    45 
    46 ifeq ($(shell uname),Darwin)
    47 	LIBPATH=DYLD_LIBRARY_PATH
    48 	LLDB_BIN=/Applications/Xcode.app/Contents/Developer/usr/bin/lldb
    49 else
    50 	LIBPATH=LD_LIBRARY_PATH
    51 	LLDB_BIN=lldb
    52 endif
    53 
    54 LDLIBS += -lcpptest
    55 
    56 
    57 # Create a list of the extra library paths for the loader. I do not assume that the engine (and its dependencies) are installed for testing.
    58 # Note that += can not be used here, as it changes the amount of whitespace
    59 EXTRA_LIB_PATHS=../src:
    60 ifdef ETPAN_LIB
    61 	EXTRA_LIB_PATHS:=$(EXTRA_LIB_PATHS)$(patsubst -L%,%,$(ETPAN_LIB)):
    62 endif
    63 ifdef GPGME_LIB
    64 	EXTRA_LIB_PATHS:=$(EXTRA_LIB_PATHS)$(patsubst -L%,%,$(GPGME_LIB)):
    65 endif
    66 ifdef NETPGP_LIB
    67 	EXTRA_LIB_PATHS:=$(EXTRA_LIB_PATHS)$(patsubst -L%,%,$(NETPGP_LIB)):
    68 endif
    69 
    70 # Remove trailing ':'
    71 EXTRA_LIB_PATHS:=$(EXTRA_LIB_PATHS::=)
    72 
    73 CFLAGS:=$(filter-out -DNDEBUG,$(CFLAGS))
    74 ifneq ($(MAKECMDGOALS),clean)
    75 	ifneq (,$(findstring -DNDEBUG,$(CFLAGS)))
    76 		$(error The macro NDEBUG must not be defined for test compilation.)
    77 	endif
    78 endif
    79 
    80 CXXFLAGS:=$(filter-out -DNDEBUG,$(CXXFLAGS))
    81 ifneq ($(MAKECMDGOALS),clean)
    82 	ifneq (,$(findstring -DNDEBUG,$(CXXFLAGS)))
    83 		$(error The macro NDEBUG must not be defined for test compilation.)
    84 	endif
    85 endif
    86 
    87 CPPFLAGS += $(INC_FLAGS) -MMD -MP
    88 
    89 all: suitemaker $(TARGET) test_home_ scripts
    90 	
    91 $(TARGET): $(OBJS)
    92 	$(CXX) $(CPPFLAGS) $(LDFLAGS) $(OBJS) $(LDFLAGS) $(LDLIBS) -o $@
    93 
    94 .PHONY: suitemaker
    95 suitemaker:
    96 ifndef PY_ENV
    97 	@echo "WARNING: Can't find python3 - this is fine unless you're adding test suites. If so, please install python3."
    98 else
    99 ifndef EXCLUDE
   100 	$(PY_ENV) gensuitemaker.py
   101 else
   102 	# Comma-separated list, no spaces
   103 	$(PY_ENV) gensuitemaker.py --exclude=$(EXCLUDE)
   104 endif
   105 endif
   106 		
   107 .PHONY: test_home_
   108 test_home_: 
   109 	
   110 
   111 .PHONY: scripts
   112 scripts: 
   113 ifdef PY_ENV
   114 	$(PY_ENV) genscripts.py
   115 endif
   116 
   117 .PHONY: test
   118 test: all
   119 	$(TEST_DEBUGGER) ./$(TARGET)
   120 	
   121 .PHONY: clean
   122 clean:
   123 	$(RM) $(TARGET) $(OBJS) $(DEPS)
   124 	$(RM) $(HERE)/*Tests
   125 
   126 
   127 
   128 -include $(DEPS)
   129