/ tests / Makefile.autosetup
Makefile.autosetup
  1  include @builddir@/mk/defs.mk
  2  
  3  TESTS=	\
  4  	checksum \
  5  	deps_formula \
  6  	merge \
  7  	packing \
  8  	pkg_add_dir_to_del \
  9  	pkg_cpe \
 10  	pkg_printf \
 11  	pkg_validation \
 12  	pkg_osvf \
 13  	pkg \
 14  	plist \
 15  	lua \
 16  	ssh \
 17  	utils \
 18  	metalog \
 19  	vec \
 20  	pkg_elf \
 21  	hash \
 22  	shlibs \
 23  	kv
 24  
 25  TESTS_SH= \
 26  	frontend/audit.sh \
 27  	frontend/pkg.sh \
 28  	frontend/add.sh \
 29  	frontend/alias.sh \
 30  	frontend/annotate.sh \
 31  	frontend/autoremove.sh \
 32  	frontend/autoupgrade.sh \
 33  	frontend/check.sh \
 34  	frontend/config.sh \
 35  	frontend/configmerge.sh \
 36  	frontend/conflicts.sh \
 37  	frontend/conflicts-multirepo.sh \
 38  	frontend/create.sh \
 39  	frontend/create-parsebin.sh \
 40  	frontend/delete.sh \
 41  	frontend/extract.sh \
 42  	frontend/fetch.sh \
 43  	frontend/install.sh \
 44  	frontend/jpeg.sh \
 45  	frontend/key.sh \
 46  	frontend/lock.sh \
 47  	frontend/messages.sh \
 48  	frontend/multipleprovider.sh \
 49  	frontend/packagesplit.sh \
 50  	frontend/packagemerge.sh \
 51  	frontend/php-pr.sh \
 52  	frontend/pubkey.sh \
 53  	frontend/query.sh \
 54  	frontend/register.sh \
 55  	frontend/repo.sh \
 56  	frontend/rquery.sh \
 57  	frontend/requires.sh \
 58  	frontend/rootdir.sh \
 59  	frontend/rubypuppet.sh \
 60  	frontend/search.sh \
 61  	frontend/set.sh \
 62  	frontend/version.sh \
 63  	frontend/vital.sh \
 64  	frontend/which.sh \
 65  	frontend/unregister.sh \
 66  	frontend/update.sh \
 67  	frontend/updating.sh \
 68  	frontend/upgrade.sh \
 69  	frontend/issue1374.sh \
 70  	frontend/issue1425.sh \
 71  	frontend/issue1440.sh \
 72  	frontend/issue1445.sh \
 73  	frontend/fingerprint.sh \
 74  	frontend/lua.sh \
 75  	frontend/shellscript.sh \
 76  	frontend/clean.sh \
 77  	frontend/backup_lib.sh \
 78  	frontend/abi.sh \
 79  	frontend/http.sh \
 80  	frontend/triggers.sh \
 81  	frontend/info.sh \
 82  	frontend/force_reinstall_shlib.sh
 83  
 84  #
 85  # These files are mostly simple binaries obtained from
 86  # int main(void) { return 0; }
 87  #
 88  # The freebsd-*.bin files are copies of /usr/bin/uname from official
 89  # 14.1 release artifacts for the given architecture.
 90  
 91  
 92  TESTS_SHELL_BINS= \
 93  	frontend/dfly.bin \
 94  	frontend/freebsd-aarch64.bin \
 95  	frontend/freebsd-amd64.bin \
 96  	frontend/freebsd-armv6.bin \
 97  	frontend/freebsd-armv7.bin \
 98  	frontend/freebsd-i386.bin \
 99  	frontend/freebsd-powerpc.bin \
100  	frontend/freebsd-powerpc64.bin \
101  	frontend/freebsd-powerpc64le.bin \
102  	frontend/freebsd-riscv64.bin \
103  	frontend/linux.bin \
104  	frontend/macos.bin \
105  	frontend/macos106.bin \
106  	frontend/macos150.bin \
107  	frontend/macosfat.bin \
108  	frontend/macosfatlib.bin \
109  	frontend/libtestfbsd.so.1 \
110  	frontend/libtest2fbsd.so.1 \
111  	frontend/libfoo.so.1
112  
113  lua_OBJS=	lib/lua.o
114  merge_OBJS=	lib/merge.o
115  plist_OBJS=	lib/plist.o
116  checksum_OBJS=	lib/checksum.o
117  pkg_printf_OBJS=	lib/pkg_printf_test.o \
118  			lib/pkg_printf.o
119  deps_formula_OBJS=	lib/deps_formula.o
120  pkg_add_dir_to_del_OBJS=	lib/pkg_add_dir_to_del.o
121  pkg_cpe_OBJS=	lib/pkg_cpe.o
122  pkg_validation_OBJS=	lib/pkg_validation.o
123  packing_OBJS=	lib/packing.o
124  ssh_OBJS=	lib/ssh.o
125  utils_OBJS=	lib/utils.o
126  metalog_OBJS=	lib/metalog.o
127  vec_OBJS=	lib/vec.o
128  pkg_elf_OBJS=	lib/pkg_elf.o
129  hash_OBJS=	lib/hash.o
130  shlibs_OBJS=	lib/shlibs.o
131  kv_OBJS=	lib/kv.o
132  pkg_OBJS=	lib/pkg.o
133  pkg_osvf_OBJS=	lib/pkg_osvf.o
134  
135  SRCS=	\
136  	$(packing_OBJS:.o=.c) \
137  	$(merge_OBJS:.o=.c) \
138  	$(plist_OBJS:.o=.c) \
139  	$(lua_OBJS:.o=.c) \
140  	$(checksum_OBJS:.o=.c) \
141  	$(pkg_printf_OBJS:.o=.c) \
142  	$(deps_formula_OBJS:.o=.c) \
143  	$(pkg_add_dir_to_del_OBJS:.o=.c) \
144  	$(pkg_cpe_OBJS:.o=.c) \
145  	$(pkg_validation_OBJS:.o=.c) \
146  	$(pkg_osvf_OBJS:.o=.c) \
147  	$(ssh_OBJS:.o=.c) \
148  	$(utils_OBJS:.o=.c) \
149  	$(metalog_OBJS:.o=.c) \
150  	$(vec_OBJS:.o=.c) \
151  	$(pkg_elf_OBJS:.o=.c) \
152  	$(hash_OBJS:.o=.c) \
153  	$(shlibs_OBJS:.o=.c) \
154  	$(kv_OBJS:.o=.c) \
155  	$(pkg_OBJS:.o=.c)
156  
157  include $(MK)/common.mk
158  
159  TESTS_SHELL=	$(TESTS_SH:.sh=)
160  
161  LOCAL_CFLAGS=	-I$(top_srcdir)/compat \
162  		-I$(top_srcdir)/external/libucl/include \
163  		-I$(top_srcdir)/external/uthash \
164  		-I$(top_srcdir)/external/include \
165  		-I$(top_srcdir)/external/sqlite \
166  		-I$(top_srcdir)/external/lua/src \
167  		-I$(top_srcdir)/libpkg \
168  		-I$(top_builddir)/ \
169  		-I$(top_builddir)/libpkg \
170  		@PKG_ATF_C_CFLAGS@ \
171  		-DTESTING \
172  		-DTESTING_TOP_DIR="\"@abs_top_srcdir@/tests\""
173  
174  LIBS=	\
175  	-L$(top_builddir)/libpkg -lpkg_flat \
176  	-lm \
177  	@EXTRA_LIBS@
178  
179  @if HAVE_PKG_LIBARCHIVE
180  CFLAGS+=	@PKG_LIBARCHIVE_CFLAGS@
181  LIBS+=	@PKG_LIBARCHIVE_LDFLAGS@ @PKG_LIBARCHIVE_LIBS@
182  @else
183  LIBS+=	-L/usr/lib -larchive -lbz2 -lz -llzma
184  @endif
185  OTHER_LIBS=	-pthread
186  @if HAVE_LIBUTIL
187  OTHER_LIBS+=	-lutil
188  @endif
189  @if HAVE_LIBFTS
190  OTHER_LIBS+=	-lfts
191  @endif
192  @if HAVE_LIBDL
193  OTHER_LIBS+=	-ldl
194  @endif
195  @if PKG_OPENSSL_LIBS
196  CFLAGS+=	@PKG_OPENSSL_CFLAGS@
197  LIBS+=	@PKG_OPENSSL_LDFLAGS@ @PKG_OPENSSL_LIBS@
198  @else
199  OTHER_LIBS+=	-lssl -lcrypto
200  @endif
201  
202  
203  # Hack to determine we are on osx
204  @if pkgos_darwin
205  OTHER_LIBS+=	-lresolv
206  @endif
207  
208  LOCAL_LDFLAGS=	$(LIBS) $(OTHER_LIBS)
209  LOCAL_LDFLAGS+=	@PKG_ATF_C_LDFLAGS@ @PKG_ATF_C_LIBS@
210  
211  VPATH=	$(top_srcdir)/tests
212  
213  all: $(TESTS) Kyuafile ${TESTS_SHELL} $(TESTS_SHELL_BINS) frontend/Kyuafile
214  
215  $(TESTS): $(OBJS) $(top_builddir)/libpkg/libpkg_flat.a
216  	$(CC) -o $@ $($@_OBJS) $(LDFLAGS) $(LOCAL_LDFLAGS)
217  
218  lib/pkg_printf.c: $(top_srcdir)/libpkg/pkg_printf.c
219  	cp $(top_srcdir)/libpkg/pkg_printf.c $@
220  
221  .sh:
222  	install -m 755 $< $@
223  
224  clean:
225  	rm -f lib/pkg_printf.c $(OBJS) $(TESTS) $(TESTS_SHELL) $(TESTS_SHELL_BINS) Kyuafile frontend/Kyuafile
226  
227  Kyuafile: $(TESTS)
228  	@echo "Generating $@"
229  	@echo 'syntax(2)' > $@
230  	@echo 'test_suite("pkg")' >> $@
231  	@for p in $(TESTS); do \
232  		echo "atf_test_program{name='$$p'}" >> $@ ; \
233  	done
234  	@echo 'include("frontend/Kyuafile")' >> $@
235  
236  frontend/Kyuafile: $(TESTS_SHELL) $(TESTS_SHELL_BINS)
237  	@echo "Generating $@"
238  	@echo 'syntax(2)' > $@
239  	@echo 'test_suite("pkg")' >> $@
240  	@for p in $(TESTS_SHELL); do \
241  		echo "atf_test_program{name='$${p##*/}'}" >> $@ ; \
242  	done