-
Notifications
You must be signed in to change notification settings - Fork 1
/
Makefile.am
69 lines (61 loc) · 2.06 KB
/
Makefile.am
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
lib_LTLIBRARIES = libapteryx_schema.la
libapteryx_schema_la_SOURCES = schema.c
if HAVE_LIBXML
libapteryx_schema_la_SOURCES += xml.c
endif
if HAVE_LIBYANG
libapteryx_schema_la_SOURCES += yang.c
endif
if HAVE_LUA
libapteryx_schema_la_SOURCES += lua.c
endif
libapteryx_schema_la_CFLAGS = -D_GNU_SOURCE
if HAVE_LIBXML
libapteryx_schema_la_CFLAGS += -DHAVE_LIBXML @LIBXML_CFLAGS@
endif
if HAVE_LIBYANG
libapteryx_schema_la_CFLAGS += -DHAVE_LIBYANG @LIBYANG_CFLAGS@
endif
if HAVE_LUA
libapteryx_schema_la_CFLAGS += -DHAVE_LUA @LUA_CFLAGS@
endif
libapteryx_schema_la_CFLAGS += @APTERYX_CFLAGS@ @GLIB_CFLAGS@
libapteryx_schema_la_LDFLAGS = -version-info 1:0:0
libapteryx_schema_la_LIBADD =
if HAVE_LIBXML
libapteryx_schema_la_LIBADD += @LIBXML_LIBS@
endif
if HAVE_LIBYANG
libapteryx_schema_la_LIBADD += @LIBYANG_LIBS@
endif
if HAVE_LUA
libapteryx_schema_la_LIBADD += @LUA_LIBS@
endif
libapteryx_schema_la_LIBADD += @APTERYX_LIBS@ @GLIB_LIBS@
include_HEADERS = apteryx-schema.h
pkgconfigdir = $(libdir)/pkgconfig
pkgconfig_DATA = apteryx-schema.pc
if HAVE_TESTS
noinst_PROGRAMS = unittest
unittest_SOURCES = test.c $(libapteryx_schema_la_SOURCES)
unittest_CFLAGS = $(libapteryx_schema_la_CFLAGS) -g -fprofile-arcs -fprofile-dir=gcov -ftest-coverage
unittest_LDADD = $(libapteryx_schema_la_LIBADD)
# TEST_WRAPPER="LD_PRELOAD=.libs/libapteryx_schema.so G_SLICE=always-malloc valgrind --leak-check=full" make test
# TEST_WRAPPER="gdb" make test
# make test TEST_ARGS="-h"
test: libapteryx_schema.la unittest
@echo "Running unit tests"
@if test -e /tmp/apteryxd.pid; then \
kill -TERM `cat /tmp/apteryxd.pid` && sleep 0.1; \
fi; \
rm -f /tmp/apteryxd.pid; \
rm -f /tmp/apteryxd.run; \
apteryxd -b -p /tmp/apteryxd.pid -r /tmp/apteryxd.run && sleep 0.1; \
mkdir -p gcov; \
eval LD_LIBRARY_PATH=/usr/local/lib LUA_CPATH=.libs/?.so $(TEST_WRAPPER) ./unittest $(TEST_ARGS); \
mv *.gcno gcov/ 2> /dev/null; \
lcov -q --capture --directory . --output-file gcov/coverage.info; \
genhtml -q gcov/coverage.info --output-directory gcov; \
kill -TERM `cat /tmp/apteryxd.pid`;
@echo "Tests have been run!"
endif