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