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