summaryrefslogtreecommitdiff
path: root/src/platform/tests/Makefile.am
blob: b94e12e6064c19879030befc7f7e726cf0bec817 (plain)
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
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
AM_CPPFLAGS = \
	-I${top_srcdir} \
	-I${top_srcdir}/include \
	-I${top_builddir}/include \
	-I${top_srcdir}/src \
	-I${top_builddir}/src \
	-I${top_srcdir}/src/logging \
	-I${top_srcdir}/libnm-util \
	-I${top_builddir}/libnm-util \
	-I${srcdir}/.. \
	-DNM_VERSION_MAX_ALLOWED=NM_VERSION_NEXT_STABLE \
	$(GLIB_CFLAGS) \
	$(GUDEV_CFLAGS) \
	$(LIBNL_CFLAGS)

PLATFORM_SOURCES = \
	../nm-platform.c \
	../nm-fake-platform.c \
	../nm-linux-platform.c
TEST_SOURCES = $(PLATFORM_SOURCES) test-common.c test-common.h
AM_CFLAGS = $(CODE_COVERAGE_CFLAGS)
AM_LDFLAGS = $(GLIB_LIBS) $(GUDEV_LIBS) $(LIBNL_LIBS) $(CODE_COVERAGE_LDFLAGS)
PLATFORM_LDADD = \
	$(top_builddir)/src/libNetworkManager.la

@GNOME_CODE_COVERAGE_RULES@

noinst_PROGRAMS = \
	dump \
	monitor \
	platform \
	test-link-fake \
	test-link-linux \
	test-address-fake \
	test-address-linux \
	test-route-fake \
	test-route-linux \
	test-cleanup-fake \
	test-cleanup-linux

EXTRA_DIST = test-common.h

monitor_SOURCES = monitor.c $(PLATFORM_SOURCES)
monitor_LDADD = $(PLATFORM_LDADD)

dump_SOURCES = dump.c $(PLATFORM_SOURCES)
dump_LDADD = $(PLATFORM_LDADD)

platform_SOURCES = platform.c $(PLATFORM_SOURCES)
platform_LDADD = $(PLATFORM_LDADD)

test_link_fake_SOURCES = test-link.c $(TEST_SOURCES)
test_link_fake_CPPFLAGS = \
	$(AM_CPPFLAGS) \
	-DSETUP=nm_fake_platform_setup \
	-DKERNEL_HACKS=0
test_link_fake_LDADD = $(PLATFORM_LDADD)

test_link_linux_SOURCES = test-link.c $(TEST_SOURCES)
test_link_linux_CPPFLAGS = \
	$(AM_CPPFLAGS) \
	-DSETUP=nm_linux_platform_setup \
	-DKERNEL_HACKS=1
test_link_linux_LDADD = $(PLATFORM_LDADD)

test_address_fake_SOURCES = test-address.c $(TEST_SOURCES)
test_address_fake_CPPFLAGS = \
	$(AM_CPPFLAGS) \
	-DSETUP=nm_fake_platform_setup \
	-DKERNEL_HACKS=0
test_address_fake_LDADD = $(PLATFORM_LDADD)

test_address_linux_SOURCES = test-address.c $(TEST_SOURCES)
test_address_linux_CPPFLAGS = \
	$(AM_CPPFLAGS) \
	-DSETUP=nm_linux_platform_setup \
	-DKERNEL_HACKS=1
test_address_linux_LDADD = $(PLATFORM_LDADD)

test_route_fake_SOURCES = test-route.c $(TEST_SOURCES)
test_route_fake_CPPFLAGS = \
	$(AM_CPPFLAGS) \
	-DSETUP=nm_fake_platform_setup \
	-DKERNEL_HACKS=0
test_route_fake_LDADD = $(PLATFORM_LDADD)

test_route_linux_SOURCES = test-route.c $(TEST_SOURCES)
test_route_linux_CPPFLAGS = \
	$(AM_CPPFLAGS) \
	-DSETUP=nm_linux_platform_setup \
	-DKERNEL_HACKS=1
test_route_linux_LDADD = $(PLATFORM_LDADD)

test_cleanup_fake_SOURCES = test-cleanup.c $(TEST_SOURCES)
test_cleanup_fake_CPPFLAGS = \
	$(AM_CPPFLAGS) \
	-DSETUP=nm_fake_platform_setup \
	-DKERNEL_HACKS=0
test_cleanup_fake_LDADD = $(PLATFORM_LDADD)

test_cleanup_linux_SOURCES = test-cleanup.c $(TEST_SOURCES)
test_cleanup_linux_CPPFLAGS = \
	$(AM_CPPFLAGS) \
	-DSETUP=nm_linux_platform_setup \
	-DKERNEL_HACKS=1
test_cleanup_linux_LDADD = $(PLATFORM_LDADD)

# Unfortunately, we cannot run nm-linux-platform-test as an automatic test
# program by default, as it requires root access and modifies kernel
# configuration.
#
# However, we can check whether the fake platform fakes platform behavior
# correctly.

@VALGRIND_RULES@
USERTESTS = test-link-fake test-address-fake test-route-fake test-cleanup-fake
ROOTTESTS = test-link-linux test-address-linux test-route-linux test-cleanup-linux

# If explicitly enabled, we can run the root tests
if RUN_ROOT_TESTS
TESTS = $(USERTESTS) $(ROOTTESTS)
else
TESTS = $(USERTESTS)
endif