Makefile.am 5.03 KB
Newer Older
1 2 3
SUBDIRS = .

AM_CPPFLAGS = -I$(top_builddir)/src/lib -I$(top_srcdir)/src/lib
4
AM_CPPFLAGS += $(BOOST_INCLUDES)
5
AM_CXXFLAGS = $(B10_CXXFLAGS)
6 7
AM_LDADD    =
AM_LDFLAGS  =
8 9

if USE_STATIC_LINK
10
AM_LDFLAGS += -static
11 12 13 14
endif

CLEANFILES = *.gcno *.gcda

15
EXTRA_DIST = log_test_messages.mes
16 17 18
BUILT_SOURCES = log_test_messages.h log_test_messages.cc
log_test_messages.h log_test_messages.cc: log_test_messages.mes
	$(AM_V_GEN) $(top_builddir)/src/lib/log/compiler/message $(top_srcdir)/src/lib/log/tests/log_test_messages.mes
19

20 21
CLEANFILES += log_test_messages.h log_test_messages.cc

22 23 24 25
noinst_PROGRAMS = logger_example
logger_example_SOURCES = logger_example.cc
logger_example_CPPFLAGS = $(AM_CPPFLAGS)
logger_example_LDFLAGS = $(AM_LDFLAGS)
Jelte Jansen's avatar
Jelte Jansen committed
26
logger_example_LDADD  = $(top_builddir)/src/lib/log/liblog.la
27
logger_example_LDADD += $(top_builddir)/src/lib/util/libutil.la
28
logger_example_LDADD += $(top_builddir)/src/lib/exceptions/libb10-exceptions.la
Jelte Jansen's avatar
Jelte Jansen committed
29
logger_example_LDADD += $(AM_LDADD) $(LOG4CPLUS_LIBS)
30 31 32 33 34

noinst_PROGRAMS += init_logger_test
init_logger_test_SOURCES = init_logger_test.cc
init_logger_test_CPPFLAGS = $(AM_CPPFLAGS)
init_logger_test_LDFLAGS = $(AM_LDFLAGS)
Jelte Jansen's avatar
Jelte Jansen committed
35
init_logger_test_LDADD  = $(top_builddir)/src/lib/log/liblog.la
36
init_logger_test_LDADD += $(top_builddir)/src/lib/util/libutil.la
37
init_logger_test_LDADD += $(top_builddir)/src/lib/exceptions/libb10-exceptions.la
Jelte Jansen's avatar
Jelte Jansen committed
38
init_logger_test_LDADD += $(AM_LDADD) $(LOG4CPLUS_LIBS)
39

40 41
noinst_PROGRAMS += logger_lock_test
logger_lock_test_SOURCES = logger_lock_test.cc
42
nodist_logger_lock_test_SOURCES = log_test_messages.cc log_test_messages.h
43 44 45 46
logger_lock_test_CPPFLAGS = $(AM_CPPFLAGS)
logger_lock_test_LDFLAGS = $(AM_LDFLAGS)
logger_lock_test_LDADD  = $(top_builddir)/src/lib/log/liblog.la
logger_lock_test_LDADD += $(top_builddir)/src/lib/util/libutil.la
47
logger_lock_test_LDADD += $(top_builddir)/src/lib/exceptions/libb10-exceptions.la
48 49
logger_lock_test_LDADD += $(AM_LDADD) $(LOG4CPLUS_LIBS)

50
TESTS_ENVIRONMENT = \
51
	$(LIBTOOL) --mode=execute $(VALGRIND_COMMAND)
52

53
if HAVE_GTEST
54
TESTS =
55 56 57 58

# Define the flags used in each set of tests
if USE_CLANGPP
# Workaround unused variables tcout and tcerr in log4cplus's streams.h.
59
AM_CXXFLAGS += -Wno-unused-variable
60
endif
61 62
AM_CPPFLAGS += $(GTEST_INCLUDES) $(LOG4CPLUS_INCLUDES)
AM_LDFLAGS  += $(GTEST_LDFLAGS)
63

64
AM_LDADD += $(top_builddir)/src/lib/util/libutil.la
65 66
AM_LDADD += $(top_builddir)/src/lib/log/liblog.la
AM_LDADD += $(top_builddir)/src/lib/util/unittests/libutil_unittests.la
67
AM_LDADD += $(top_builddir)/src/lib/exceptions/libb10-exceptions.la
68
AM_LDADD += $(top_builddir)/src/lib/util/unittests/libutil_unittests.la
69
AM_LDADD += $(GTEST_LDADD)
70 71

# Set of unit tests for the general logging classes
72
TESTS += run_unittests
73 74
run_unittests_SOURCES  = run_unittests.cc
run_unittests_SOURCES += log_formatter_unittest.cc
75
run_unittests_SOURCES += logger_level_impl_unittest.cc
76
run_unittests_SOURCES += logger_level_unittest.cc
Stephen Morris's avatar
Stephen Morris committed
77
run_unittests_SOURCES += logger_manager_unittest.cc
78
run_unittests_SOURCES += logger_name_unittest.cc
79
run_unittests_SOURCES += logger_support_unittest.cc
80
run_unittests_SOURCES += logger_unittest.cc
81
run_unittests_SOURCES += logger_specification_unittest.cc
82 83 84
run_unittests_SOURCES += message_dictionary_unittest.cc
run_unittests_SOURCES += message_reader_unittest.cc
run_unittests_SOURCES += output_option_unittest.cc
85
nodist_run_unittests_SOURCES = log_test_messages.cc log_test_messages.h
86

87 88 89 90
run_unittests_CPPFLAGS = $(AM_CPPFLAGS)
run_unittests_CXXFLAGS = $(AM_CXXFLAGS)
run_unittests_LDADD    = $(AM_LDADD)
run_unittests_LDFLAGS  = $(AM_LDFLAGS)
91 92 93 94 95 96 97 98 99 100

# logging initialization tests.  These are put in separate programs to
# ensure that the initialization status at the start of each test is known,
# and to prevent circumstances where the execution of one test affects the
# starting conditions of the next.
TESTS += initializer_unittests_1
initializer_unittests_1_SOURCES  = run_initializer_unittests.cc
initializer_unittests_1_SOURCES += message_initializer_1_unittest.cc
initializer_unittests_1_SOURCES += message_initializer_1a_unittest.cc

101 102 103 104
initializer_unittests_1_CPPFLAGS = $(AM_CPPFLAGS)
initializer_unittests_1_CXXFLAGS = $(AM_CXXFLAGS)
initializer_unittests_1_LDADD    = $(AM_LDADD)
initializer_unittests_1_LDFLAGS  = $(AM_LDFLAGS)
105 106 107 108 109

TESTS += initializer_unittests_2
initializer_unittests_2_SOURCES  = run_initializer_unittests.cc
initializer_unittests_2_SOURCES += message_initializer_2_unittest.cc

110 111 112 113
initializer_unittests_2_CPPFLAGS = $(AM_CPPFLAGS)
initializer_unittests_2_CXXFLAGS = $(AM_CXXFLAGS)
initializer_unittests_2_LDADD    = $(AM_LDADD)
initializer_unittests_2_LDFLAGS  = $(AM_LDFLAGS)
114

115
noinst_PROGRAMS += $(TESTS)
116
endif
117

118 119 120 121 122
# Additional test using the shell.  These are principally tests
# where the global logging environment is affected, and where the
# output needs to be compared with stored output (where "cut" and
# "diff" are useful utilities).

123
check-local:
124
	$(SHELL) $(abs_builddir)/console_test.sh
125
	$(SHELL) $(abs_builddir)/destination_test.sh
126
	$(SHELL) $(abs_builddir)/init_logger_test.sh
127
	$(SHELL) $(abs_builddir)/local_file_test.sh
128
	$(SHELL) $(abs_builddir)/logger_lock_test.sh
129
	$(SHELL) $(abs_builddir)/severity_test.sh