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
krista@2637
     1
damiano@1960
     2
# Copyright 2017, pEp Foundation
damiano@1958
     3
# This file is part of pEpEngine
damiano@1958
     4
# This file may be used under the terms of the GNU General Public License version 3
vb@1513
     5
# see LICENSE.txt
vb@1513
     6
damiano@2210
     7
include ../default.conf
vb@2
     8
krista@2645
     9
PY_ENV := $(shell command -v python3 2> /dev/null)
krista@2642
    10
krista@2637
    11
HERE:=$(CURDIR)
krista@2639
    12
TEST_HOME=$(HERE)/pEp_test_home
damiano@1970
    13
krista@2638
    14
TARGET=TestDriver
krista@2638
    15
krista@2639
    16
SRCS := $(wildcard src/*.cc) $(wildcard src/*/*.cc)
krista@2637
    17
OBJS := $(addsuffix .o,$(basename $(SRCS)))
krista@2637
    18
DEPS := $(OBJS:.o=.d)
krista@2637
    19
vb@2749
    20
INC_DIRS := ./include /usr/local/include 
damiano@2975
    21
INC_FLAGS := $(addprefix -I,$(INC_DIRS)) $(GPGME_INC) $(CPPUNIT_INC)
krista@2637
    22
krista@2637
    23
LDFLAGS += -L/usr/local/lib
krista@2637
    24
krista@2637
    25
CFLAGS += -Wno-deprecated
krista@2637
    26
CXXFLAGS += -Wno-deprecated
damiano@1970
    27
damiano@2975
    28
LDFLAGS+= $(ETPAN_LIB) $(CPPUNIT_LIB) -L../asn.1 -L../src
damiano@1970
    29
LDLIBS+= -letpan -lpEpEngine -lstdc++ -lasn1
damiano@1970
    30
krista@1989
    31
ifeq ($(BUILD_FOR),Linux)
krista@2637
    32
	LDLIBS+= -luuid
Edouard@178
    33
endif
Edouard@178
    34
damiano@1972
    35
ifeq ($(OPENPGP),NETPGP)
krista@2637
    36
	LDLIBS+= -lnetpgp
krista@3164
    37
ifeq ($(BUILD_FOR),Linux)
krista@3164
    38
	LDLIBS+= -ltre
krista@3164
    39
endif
edouard@1939
    40
endif
edouard@1939
    41
damiano@2002
    42
ifdef SQLITE3_FROM_OS
krista@2637
    43
	LDLIBS+= -lsqlite3
damiano@2002
    44
endif
damiano@2002
    45
damiano@1970
    46
ifeq ($(shell uname),Darwin)
krista@2637
    47
	LIBPATH=DYLD_LIBRARY_PATH
krista@2637
    48
	LLDB_BIN=/Applications/Xcode.app/Contents/Developer/usr/bin/lldb
damiano@1970
    49
else
krista@2637
    50
	LIBPATH=LD_LIBRARY_PATH
krista@2637
    51
	LLDB_BIN=lldb
damiano@1970
    52
endif
damiano@1970
    53
krista@2637
    54
LDLIBS += -lcpptest
krista@2637
    55
krista@2637
    56
damiano@1972
    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.
damiano@1970
    58
# Note that += can not be used here, as it changes the amount of whitespace
damiano@1970
    59
EXTRA_LIB_PATHS=../src:
damiano@1970
    60
ifdef ETPAN_LIB
krista@2637
    61
	EXTRA_LIB_PATHS:=$(EXTRA_LIB_PATHS)$(patsubst -L%,%,$(ETPAN_LIB)):
damiano@1970
    62
endif
damiano@1970
    63
ifdef GPGME_LIB
krista@2637
    64
	EXTRA_LIB_PATHS:=$(EXTRA_LIB_PATHS)$(patsubst -L%,%,$(GPGME_LIB)):
damiano@1970
    65
endif
damiano@1970
    66
ifdef NETPGP_LIB
krista@2637
    67
	EXTRA_LIB_PATHS:=$(EXTRA_LIB_PATHS)$(patsubst -L%,%,$(NETPGP_LIB)):
damiano@1970
    68
endif
krista@2637
    69
damiano@1970
    70
# Remove trailing ':'
damiano@1970
    71
EXTRA_LIB_PATHS:=$(EXTRA_LIB_PATHS::=)
damiano@1970
    72
damiano@2074
    73
CFLAGS:=$(filter-out -DNDEBUG,$(CFLAGS))
damiano@2063
    74
ifneq ($(MAKECMDGOALS),clean)
krista@2637
    75
	ifneq (,$(findstring -DNDEBUG,$(CFLAGS)))
krista@2637
    76
		$(error The macro NDEBUG must not be defined for test compilation.)
krista@2637
    77
	endif
damiano@2062
    78
endif
damiano@2062
    79
damiano@2075
    80
CXXFLAGS:=$(filter-out -DNDEBUG,$(CXXFLAGS))
damiano@2075
    81
ifneq ($(MAKECMDGOALS),clean)
krista@2637
    82
	ifneq (,$(findstring -DNDEBUG,$(CXXFLAGS)))
krista@2637
    83
		$(error The macro NDEBUG must not be defined for test compilation.)
krista@2637
    84
	endif
damiano@2075
    85
endif
damiano@2075
    86
krista@2637
    87
CPPFLAGS += $(INC_FLAGS) -MMD -MP
roker@1659
    88
krista@2696
    89
all: suitemaker $(TARGET) test_home_ scripts
krista@2639
    90
	
krista@2637
    91
$(TARGET): $(OBJS)
krista@2639
    92
	$(CXX) $(CPPFLAGS) $(LDFLAGS) $(OBJS) $(LDFLAGS) $(LDLIBS) -o $@
edouard@1844
    93
krista@2642
    94
.PHONY: suitemaker
krista@2642
    95
suitemaker:
krista@2642
    96
ifndef PY_ENV
krista@2642
    97
	@echo "WARNING: Can't find python3 - this is fine unless you're adding test suites. If so, please install python3."
krista@2642
    98
else
krista@2941
    99
ifndef EXCLUDE
krista@2642
   100
	$(PY_ENV) gensuitemaker.py
krista@2941
   101
else
krista@2941
   102
	# Comma-separated list, no spaces
krista@2941
   103
	$(PY_ENV) gensuitemaker.py --exclude=$(EXCLUDE)
krista@2941
   104
endif
krista@2642
   105
endif
krista@2642
   106
		
krista@2639
   107
.PHONY: test_home_
krista@2639
   108
test_home_: 
krista@2696
   109
	
krista@2696
   110
vb@2750
   111
.PHONY: scripts
krista@2696
   112
scripts: 
krista@2696
   113
ifdef PY_ENV
krista@2696
   114
	$(PY_ENV) genscripts.py
krista@2696
   115
endif
krista@2639
   116
krista@2639
   117
.PHONY: test
krista@2639
   118
test: all
vb@2750
   119
	$(TEST_DEBUGGER) ./$(TARGET)
krista@2639
   120
	
damiano@1970
   121
.PHONY: clean
vb@2
   122
clean:
krista@2637
   123
	$(RM) $(TARGET) $(OBJS) $(DEPS)
krista@2696
   124
	$(RM) $(HERE)/*Tests
vb@2
   125
krista@2639
   126
krista@2639
   127
krista@2637
   128
-include $(DEPS)
krista@2639
   129