xref: /freebsd/contrib/ntp/sntp/tests/Makefile.am (revision 3fc36ee018bb836bd1796067cf4ef8683f166ebc)
1NULL =
2BUILT_SOURCES =
3EXTRA_PROGRAMS =
4
5CLEANFILES =			\
6	debug-output-lfp-bin	\
7	debug-output-lfp-dec	\
8	debug-output-pkt	\
9	kod-output-blank	\
10	kod-output-multiple	\
11	kod-output-single	\
12	testLogfile.log		\
13	testLogfile2.log	\
14	$(NULL)
15
16DISTCLEANFILES =		\
17	kod-output-blank	\
18	kod-output-single 	\
19	kod-output-multiple	\
20	testLogfile.log		\
21	testLogfile2.log	\
22	$(NULL)
23
24std_unity_list =					\
25	$(srcdir)/../unity/auto/generate_test_runner.rb	\
26	$(NULL)
27
28run_unity =	cd $(srcdir) && ruby ../unity/auto/generate_test_runner.rb
29
30# Use EXTRA_PROGRAMS for test files that are under development but
31# not production-ready
32#EXTRA_PROGRAMS +=		test-packetHandling test-packetProcessing
33
34check_PROGRAMS =			\
35	test-crypto			\
36	test-keyFile			\
37	test-log			\
38	test-networking			\
39	test-packetHandling		\
40	test-packetProcessing		\
41	test-utilities			\
42	$(NULL)
43
44if BUILD_TEST_KODDATABASE
45check_PROGRAMS += test-kodDatabase
46endif
47
48if BUILD_TEST_KODFILE
49check_PROGRAMS += test-kodFile
50endif
51
52noinst_HEADERS =		\
53	sntptest.h		\
54	$(NULL)
55
56dist_check_SCRIPTS =	tests-runner
57
58EXTRA_DIST =				\
59	data/debug-input-lfp-bin	\
60	data/debug-input-lfp-dec	\
61	data/debug-input-pkt		\
62	data/key-test-ascii		\
63	data/key-test-comments		\
64	data/key-test-empty		\
65	data/key-test-hex		\
66	data/key-test-invalid-hex	\
67	data/kod-expected-multiple	\
68	data/kod-expected-single	\
69	data/kod-test-blanks		\
70	data/kod-test-correct		\
71	data/kod-test-empty		\
72	$(NULL)
73
74CLEANFILES +=				\
75	data/kod-output-multiple	\
76	data/kod-output-single		\
77	data/debug-output-pkt		\
78	data/debug-output-lfp-dec	\
79	data/kod-output-blank		\
80	data/debug-output-lfp-bin	\
81	$(NULL)
82
83#split into LDADD and tests_LDADD?
84base_LDADD =					\
85	../libsntp.a				\
86	$(LIBOPTS_LDADD)			\
87	$(LDADD_LIBEVENT)			\
88	$(top_builddir)/../libntp/libntp.a	\
89	$(LDADD_LIBNTP)				\
90	$(LDADD_NTP)				\
91	$(NULL)
92
93LDADD =						\
94	$(base_LDADD)				\
95	$(top_builddir)/unity/libunity.a	\
96	$(LIBM)					\
97	$(NULL)
98
99AM_CFLAGS  = $(CFLAGS_NTP)
100
101AM_CPPFLAGS  = $(SNTP_INCS)
102AM_CPPFLAGS += -I$(srcdir)/..
103AM_CPPFLAGS += -I$(top_srcdir)/../tests
104AM_CPPFLAGS += $(LIBOPTS_CFLAGS)
105AM_CPPFLAGS += $(CPPFLAGS_LIBEVENT)
106AM_CPPFLAGS += $(CPPFLAGS_NTP)
107AM_CPPFLAGS += -DUNITY_INCLUDE_CONFIG_H
108#AM_CPPFLAGS += -I$(top_srcdir)/sntp/unity
109AM_CPPFLAGS += -I$(top_srcdir)/unity
110
111AM_LDFLAGS = $(LDFLAGS_NTP)
112
113BUILT_SOURCES +=				\
114	$(srcdir)/run-crypto.c			\
115	$(srcdir)/run-keyFile.c			\
116	$(srcdir)/run-kodDatabase.c		\
117	$(srcdir)/run-kodFile.c			\
118	$(srcdir)/run-networking.c		\
119	$(srcdir)/run-packetHandling.c		\
120	$(srcdir)/run-packetProcessing.c	\
121	$(srcdir)/run-utilities.c		\
122	$(NULL)
123
124test_networking_SOURCES =		\
125	networking.c			\
126	run-networking.c		\
127	$(top_builddir)/version.c	\
128	$(NULL)
129
130test_packetHandling_SOURCES =		\
131	packetHandling.c		\
132	run-packetHandling.c		\
133	$(top_builddir)/version.c	\
134	$(NULL)
135
136test_kodDatabase_SOURCES =		\
137	kodDatabase.c			\
138	run-kodDatabase.c		\
139	$(top_builddir)/version.c	\
140	$(NULL)
141
142test_keyFile_SOURCES =			\
143	fileHandlingTest.c		\
144	keyFile.c			\
145	run-keyFile.c			\
146	$(top_builddir)/version.c	\
147	$(NULL)
148
149test_kodFile_SOURCES =			\
150	fileHandlingTest.c		\
151	kodFile.c			\
152	run-kodFile.c			\
153	$(top_builddir)/version.c	\
154	$(NULL)
155
156test_packetProcessing_SOURCES =		\
157	packetProcessing.c		\
158	run-packetProcessing.c		\
159	sntptest.c			\
160	$(NULL)
161
162test_utilities_SOURCES =		\
163	fileHandlingTest.c		\
164	utilities.c			\
165	run-utilities.c			\
166	$(NULL)
167
168test_crypto_CFLAGS =			\
169	$(CFLAGS_LIBEVENT)		\
170	$(AM_CFLAGS)			\
171	$(NULL)
172
173test_crypto_SOURCES =			\
174	crypto.c			\
175	run-crypto.c			\
176	$(top_builddir)/version.c	\
177	$(NULL)
178
179test_log_SOURCES =			\
180	t-log.c			\
181	run-t-log.c			\
182	$(top_builddir)/version.c	\
183	$(NULL)
184
185
186$(srcdir)/run-kodFile.c: $(srcdir)/kodFile.c $(std_unity_list)
187	$(run_unity) kodFile.c run-kodFile.c
188
189$(srcdir)/run-keyFile.c: $(srcdir)/keyFile.c $(std_unity_list)
190	$(run_unity) keyFile.c run-keyFile.c
191
192$(srcdir)/run-kodDatabase.c: $(srcdir)/kodDatabase.c $(std_unity_list)
193	$(run_unity) kodDatabase.c run-kodDatabase.c
194
195$(srcdir)/run-networking.c: $(srcdir)/networking.c $(std_unity_list)
196	$(run_unity) networking.c run-networking.c
197
198$(srcdir)/run-packetProcessing.c: $(srcdir)/packetProcessing.c $(std_unity_list)
199	$(run_unity) packetProcessing.c run-packetProcessing.c
200
201$(srcdir)/run-packetHandling.c: $(srcdir)/packetHandling.c $(std_unity_list)
202	$(run_unity) packetHandling.c run-packetHandling.c
203
204$(srcdir)/run-utilities.c: $(srcdir)/utilities.c $(std_unity_list)
205	$(run_unity) utilities.c run-utilities.c
206
207$(srcdir)/run-crypto.c: $(srcdir)/crypto.c $(std_unity_list)
208	$(run_unity) crypto.c run-crypto.c
209
210$(srcdir)/run-t-log.c: $(srcdir)/t-log.c $(std_unity_list)
211	$(run_unity) t-log.c run-t-log.c
212
213
214#$(srcdir)/../version.c: $(srcdir)/../version.c
215#	gcc -o version.o ../version.c
216
217TESTS =
218
219if !NTP_CROSSCOMPILE
220TESTS += $(check_PROGRAMS)
221endif
222#if !NTP_CROSSCOMPILE
223#TESTS += tests-runner
224#endif
225
226## ensure ../libsntp.a is built
227
228BUILT_SOURCES	+= check-libsntp
229CLEANFILES	+= check-libsntp
230
231check-libsntp: ../libsntp.a
232	@echo stamp > $@
233
234../libsntp.a:
235	cd .. && $(MAKE) $(AM_MAKEFLAGS) libsntp.a
236
237## check-libntp.mf - automake fragment
238## slightly adapted for deeper directory
239
240BUILT_SOURCES	+= check-libntp check-libunity
241CLEANFILES	+= check-libntp	check-libunity
242
243check-libntp: ../../libntp/libntp.a
244	@echo stamp > $@
245
246../../libntp/libntp.a:
247	cd ../../libntp && $(MAKE) $(AM_MAKEFLAGS) libntp.a
248
249check-libunity: ../unity/libunity.a
250	@echo stamp > $@
251
252../unity/libunity.a:
253	cd ../unity && $(MAKE) $(AM_MAKEFLAGS) libunity.a
254
255include $(top_srcdir)/depsver.mf
256include $(top_srcdir)/includes.mf
257