3 SRCTOP= ${.CURDIR:H:H:H}
4 TESTSDIR= ${TESTSBASE}/lib/libarchive
6 LIBARCHIVEDIR= ${SRCTOP}/contrib/libarchive
8 ATF_TESTS_SH+= functional_test
12 PROGS+= libarchive_test
14 CFLAGS+= -I${.CURDIR:H} -I${.OBJDIR}
15 CFLAGS+= -I${LIBARCHIVEDIR}/libarchive -I${LIBARCHIVEDIR}/test_utils
16 CFLAGS+= -DHAVE_LIBLZMA=1 -DHAVE_LZMA_H=1
18 # Uncomment to link against dmalloc
19 #LDADD+= -L/usr/local/lib -ldmalloc
20 #CFLAGS+= -I/usr/local/include -DUSE_DMALLOC
22 .PATH: ${LIBARCHIVEDIR}/libarchive/test
24 test_acl_freebsd_nfs4.c \
25 test_acl_freebsd_posix1e.c \
29 test_archive_api_feature.c \
30 test_archive_clear_error.c \
31 test_archive_cmdline.c \
32 test_archive_crypto.c \
33 test_archive_getdate.c \
34 test_archive_match_time.c \
35 test_archive_match_owner.c \
36 test_archive_match_path.c \
37 test_archive_pathmatch.c \
38 test_archive_read_close_twice.c \
39 test_archive_read_close_twice_open_fd.c \
40 test_archive_read_close_twice_open_filename.c \
41 test_archive_read_multiple_data_objects.c \
42 test_archive_read_next_header_empty.c \
43 test_archive_read_next_header_raw.c \
44 test_archive_read_open2.c \
45 test_archive_read_set_filter_option.c \
46 test_archive_read_set_format_option.c \
47 test_archive_read_set_option.c \
48 test_archive_read_set_options.c \
49 test_archive_read_support.c \
50 test_archive_set_error.c \
51 test_archive_string.c \
52 test_archive_string_conversion.c \
53 test_archive_write_add_filter_by_name.c \
54 test_archive_write_set_filter_option.c \
55 test_archive_write_set_format_by_name.c \
56 test_archive_write_set_format_option.c \
57 test_archive_write_set_option.c \
58 test_archive_write_set_options.c \
68 test_compat_pax_libarchive_2x.c \
69 test_compat_solaris_tar_acl.c \
70 test_compat_solaris_pax_sparse.c \
71 test_compat_tar_hardlink.c \
72 test_compat_uudecode.c \
77 test_entry_strmode.c \
78 test_extattr_freebsd.c \
81 test_gnutar_filename_encoding.c \
82 test_link_resolver.c \
86 test_open_filename.c \
87 test_pax_filename_encoding.c \
88 test_read_data_large.c \
90 test_read_disk_directory_traversals.c \
91 test_read_disk_entry_from_file.c \
93 test_read_file_nonexistent.c \
94 test_read_filter_grzip.c \
95 test_read_filter_lrzip.c \
96 test_read_filter_lzop.c \
97 test_read_filter_lzop_multiple_parts.c \
98 test_read_filter_program.c \
99 test_read_filter_program_signature.c \
100 test_read_filter_uudecode.c \
101 test_read_format_7zip.c \
102 test_read_format_ar.c \
103 test_read_format_cab.c \
104 test_read_format_cab_filename.c \
105 test_read_format_cpio_afio.c \
106 test_read_format_cpio_bin.c \
107 test_read_format_cpio_bin_Z.c \
108 test_read_format_cpio_bin_be.c \
109 test_read_format_cpio_bin_bz2.c \
110 test_read_format_cpio_bin_gz.c \
111 test_read_format_cpio_bin_lzip.c \
112 test_read_format_cpio_bin_lzma.c \
113 test_read_format_cpio_bin_xz.c \
114 test_read_format_cpio_filename.c \
115 test_read_format_cpio_odc.c \
116 test_read_format_cpio_svr4_gzip.c \
117 test_read_format_cpio_svr4c_Z.c \
118 test_read_format_cpio_svr4_bzip2_rpm.c \
119 test_read_format_cpio_svr4_gzip_rpm.c \
120 test_read_format_empty.c \
121 test_read_format_gtar_filename.c \
122 test_read_format_gtar_gz.c \
123 test_read_format_gtar_lzma.c \
124 test_read_format_gtar_sparse.c \
125 test_read_format_gtar_sparse_skip_entry.c \
126 test_read_format_iso_Z.c \
127 test_read_format_iso_multi_extent.c \
128 test_read_format_iso_xorriso.c \
129 test_read_format_isorr_rr_moved.c \
130 test_read_format_isojoliet_bz2.c \
131 test_read_format_isojoliet_long.c \
132 test_read_format_isojoliet_rr.c \
133 test_read_format_isojoliet_versioned.c \
134 test_read_format_isorr_bz2.c \
135 test_read_format_isorr_ce.c \
136 test_read_format_isorr_new_bz2.c \
137 test_read_format_isozisofs_bz2.c \
138 test_read_format_lha.c \
139 test_read_format_lha_filename.c \
140 test_read_format_mtree.c \
141 test_read_format_pax_bz2.c \
142 test_read_format_rar.c \
143 test_read_format_raw.c \
144 test_read_format_tar.c \
145 test_read_format_tar_empty_filename.c \
146 test_read_format_tar_filename.c \
147 test_read_format_tbz.c \
148 test_read_format_tgz.c \
149 test_read_format_tlz.c \
150 test_read_format_txz.c \
151 test_read_format_tz.c \
152 test_read_format_ustar_filename.c \
153 test_read_format_xar.c \
154 test_read_format_zip.c \
155 test_read_format_zip_comment_stored.c \
156 test_read_format_zip_filename.c \
157 test_read_format_zip_mac_metadata.c \
158 test_read_format_zip_sfx.c \
160 test_read_pax_truncated.c \
161 test_read_position.c \
162 test_read_set_format.c \
163 test_read_truncated.c \
164 test_read_truncated_filter.c \
165 test_sparse_basic.c \
166 test_tar_filenames.c \
168 test_ustar_filenames.c \
169 test_ustar_filename_encoding.c \
171 test_write_disk_appledouble.c \
172 test_write_disk_failures.c \
173 test_write_disk_hardlink.c \
174 test_write_disk_hfs_compression.c \
175 test_write_disk_lookup.c \
176 test_write_disk_mac_metadata.c \
177 test_write_disk_no_hfs_compression.c \
178 test_write_disk_perms.c \
179 test_write_disk_secure.c \
180 test_write_disk_sparse.c \
181 test_write_disk_symlink.c \
182 test_write_disk_times.c \
183 test_write_filter_b64encode.c \
184 test_write_filter_bzip2.c \
185 test_write_filter_compress.c \
186 test_write_filter_gzip.c \
187 test_write_filter_gzip_timestamp.c \
188 test_write_filter_lrzip.c \
189 test_write_filter_lzip.c \
190 test_write_filter_lzma.c \
191 test_write_filter_lzop.c \
192 test_write_filter_program.c \
193 test_write_filter_uuencode.c \
194 test_write_filter_xz.c \
195 test_write_format_7zip.c \
196 test_write_format_7zip_empty.c \
197 test_write_format_7zip_large.c \
198 test_write_format_ar.c \
199 test_write_format_cpio.c \
200 test_write_format_cpio_empty.c \
201 test_write_format_cpio_newc.c \
202 test_write_format_cpio_odc.c \
203 test_write_format_gnutar.c \
204 test_write_format_iso9660.c \
205 test_write_format_iso9660_boot.c \
206 test_write_format_iso9660_empty.c \
207 test_write_format_iso9660_filename.c \
208 test_write_format_iso9660_zisofs.c \
209 test_write_format_mtree.c \
210 test_write_format_mtree_absolute_path.c \
211 test_write_format_mtree_classic.c \
212 test_write_format_mtree_classic_indent.c \
213 test_write_format_mtree_fflags.c \
214 test_write_format_mtree_no_separator.c \
215 test_write_format_mtree_quoted_filename.c \
216 test_write_format_pax.c \
217 test_write_format_shar_empty.c \
218 test_write_format_tar.c \
219 test_write_format_tar_empty.c \
220 test_write_format_tar_sparse.c \
221 test_write_format_tar_ustar.c \
222 test_write_format_tar_v7tar.c \
223 test_write_format_xar.c \
224 test_write_format_xar_empty.c \
225 test_write_format_zip.c \
226 test_write_format_zip_empty.c \
227 test_write_format_zip_no_compression.c \
228 test_write_zip_set_compression_store.c \
229 test_write_open_memory.c \
230 test_zip_filename_encoding.c
232 # Deterministic failures:
233 # Crashes with SIGBUS
234 BROKEN_TESTS+= test_archive_rmd160
235 # Fails with `libarchive/test/test_archive_crypto.c:121: md != actualmd`
236 BROKEN_TESTS+= test_archive_sha384
237 # Fails with `test_compat_pax_libarchive_2x.c:122: ARCHIVE_WARN != archive_read_next_header(a, &ae)`
238 BROKEN_TESTS+= test_compat_pax_libarchive_2x
239 # Fails with `test_read_disk_directory_traversals.c:1094: File at has atime 886622, 1443306049 seconds ago`
240 BROKEN_TESTS+= test_read_disk_directory_traversals
242 # Non-deterministic failures:
243 # (Times out?) [and] crashes
244 BROKEN_TESTS+= test_fuzz_rar
246 # Build the test program.
247 SRCS.libarchive_test= \
252 DPSRCS.libarchive_test= \
255 DPADD.libarchive_test= ${LIBARCHIVE}
256 LDADD.libarchive_test= -larchive
258 .PATH: ${LIBARCHIVEDIR}/test_utils
259 SRCS.libarchive_test+= test_utils.c
261 # list.h is just a list of all tests, as indicated by DEFINE_TEST macro lines
262 list.h: ${TESTS_SRCS} Makefile
263 @(cd ${LIBARCHIVEDIR}/libarchive/test && \
264 grep -h DEFINE_TEST ${.ALLSRC:N*Makefile} | \
265 egrep -v '${BROKEN_TESTS:tW:C/ /|/g}') > ${.TARGET}.tmp
266 @mv ${.TARGET}.tmp ${.TARGET}
268 CLEANFILES+= list.h list.h.tmp
271 FILES+= test_acl_pax.tar.uu
272 FILES+= test_archive_string_conversion.txt.Z.uu
273 FILES+= test_compat_bzip2_1.tbz.uu
274 FILES+= test_compat_bzip2_2.tbz.uu
275 FILES+= test_compat_cpio_1.cpio.uu
276 FILES+= test_compat_gtar_1.tar.uu
277 FILES+= test_compat_gzip_1.tgz.uu
278 FILES+= test_compat_gzip_2.tgz.uu
279 FILES+= test_compat_lzip_1.tlz.uu
280 FILES+= test_compat_lzip_2.tlz.uu
281 FILES+= test_compat_lzma_1.tlz.uu
282 FILES+= test_compat_lzma_2.tlz.uu
283 FILES+= test_compat_lzma_3.tlz.uu
284 FILES+= test_compat_lzop_1.tar.lzo.uu
285 FILES+= test_compat_lzop_2.tar.lzo.uu
286 FILES+= test_compat_lzop_3.tar.lzo.uu
287 FILES+= test_compat_mac-1.tar.Z.uu
288 FILES+= test_compat_mac-2.tar.Z.uu
289 FILES+= test_compat_pax_libarchive_2x.tar.Z.uu
290 FILES+= test_compat_solaris_pax_sparse_1.pax.Z.uu
291 FILES+= test_compat_solaris_pax_sparse_2.pax.Z.uu
292 FILES+= test_compat_solaris_tar_acl.tar.uu
293 FILES+= test_compat_tar_hardlink_1.tar.uu
294 FILES+= test_compat_xz_1.txz.uu
295 FILES+= test_compat_zip_1.zip.uu
296 FILES+= test_compat_zip_2.zip.uu
297 FILES+= test_compat_zip_3.zip.uu
298 FILES+= test_compat_zip_4.zip.uu
299 FILES+= test_compat_zip_5.zip.uu
300 FILES+= test_compat_zip_6.zip.uu
301 FILES+= test_compat_zip_7.xps.uu
302 FILES+= test_fuzz.cab.uu
303 FILES+= test_fuzz.lzh.uu
304 FILES+= test_fuzz_1.iso.Z.uu
305 FILES+= test_pax_filename_encoding.tar.uu
306 FILES+= test_rar_multivolume_multiple_files.part1.rar.uu
307 FILES+= test_rar_multivolume_multiple_files.part2.rar.uu
308 FILES+= test_rar_multivolume_multiple_files.part3.rar.uu
309 FILES+= test_rar_multivolume_multiple_files.part4.rar.uu
310 FILES+= test_rar_multivolume_multiple_files.part5.rar.uu
311 FILES+= test_rar_multivolume_multiple_files.part6.rar.uu
312 FILES+= test_rar_multivolume_single_file.part1.rar.uu
313 FILES+= test_rar_multivolume_single_file.part2.rar.uu
314 FILES+= test_rar_multivolume_single_file.part3.rar.uu
315 FILES+= test_rar_multivolume_uncompressed_files.part01.rar.uu
316 FILES+= test_rar_multivolume_uncompressed_files.part02.rar.uu
317 FILES+= test_rar_multivolume_uncompressed_files.part03.rar.uu
318 FILES+= test_rar_multivolume_uncompressed_files.part04.rar.uu
319 FILES+= test_rar_multivolume_uncompressed_files.part05.rar.uu
320 FILES+= test_rar_multivolume_uncompressed_files.part06.rar.uu
321 FILES+= test_rar_multivolume_uncompressed_files.part07.rar.uu
322 FILES+= test_rar_multivolume_uncompressed_files.part08.rar.uu
323 FILES+= test_rar_multivolume_uncompressed_files.part09.rar.uu
324 FILES+= test_rar_multivolume_uncompressed_files.part10.rar.uu
325 FILES+= test_read_filter_grzip.tar.grz.uu
326 FILES+= test_read_filter_lrzip.tar.lrz.uu
327 FILES+= test_read_filter_lzop.tar.lzo.uu
328 FILES+= test_read_filter_lzop_multiple_parts.tar.lzo.uu
329 FILES+= test_read_format_7zip_bcj2_bzip2.7z.uu
330 FILES+= test_read_format_7zip_bcj2_copy_1.7z.uu
331 FILES+= test_read_format_7zip_bcj2_copy_2.7z.uu
332 FILES+= test_read_format_7zip_bcj2_copy_lzma.7z.uu
333 FILES+= test_read_format_7zip_bcj2_deflate.7z.uu
334 FILES+= test_read_format_7zip_bcj2_lzma1_1.7z.uu
335 FILES+= test_read_format_7zip_bcj2_lzma1_2.7z.uu
336 FILES+= test_read_format_7zip_bcj2_lzma2_1.7z.uu
337 FILES+= test_read_format_7zip_bcj2_lzma2_2.7z.uu
338 FILES+= test_read_format_7zip_bcj_bzip2.7z.uu
339 FILES+= test_read_format_7zip_bcj_copy.7z.uu
340 FILES+= test_read_format_7zip_bcj_deflate.7z.uu
341 FILES+= test_read_format_7zip_bcj_lzma1.7z.uu
342 FILES+= test_read_format_7zip_bcj_lzma2.7z.uu
343 FILES+= test_read_format_7zip_bzip2.7z.uu
344 FILES+= test_read_format_7zip_copy.7z.uu
345 FILES+= test_read_format_7zip_copy_2.7z.uu
346 FILES+= test_read_format_7zip_deflate.7z.uu
347 FILES+= test_read_format_7zip_delta_lzma1.7z.uu
348 FILES+= test_read_format_7zip_delta_lzma2.7z.uu
349 FILES+= test_read_format_7zip_empty_archive.7z.uu
350 FILES+= test_read_format_7zip_empty_file.7z.uu
351 FILES+= test_read_format_7zip_lzma1.7z.uu
352 FILES+= test_read_format_7zip_lzma1_2.7z.uu
353 FILES+= test_read_format_7zip_lzma1_lzma2.7z.uu
354 FILES+= test_read_format_7zip_lzma2.7z.uu
355 FILES+= test_read_format_7zip_ppmd.7z.uu
356 FILES+= test_read_format_7zip_symbolic_name.7z.uu
357 FILES+= test_read_format_ar.ar.uu
358 FILES+= test_read_format_cab_1.cab.uu
359 FILES+= test_read_format_cab_2.cab.uu
360 FILES+= test_read_format_cab_3.cab.uu
361 FILES+= test_read_format_cab_filename_cp932.cab.uu
362 FILES+= test_read_format_cpio_bin_be.cpio.uu
363 FILES+= test_read_format_cpio_filename_cp866.cpio.uu
364 FILES+= test_read_format_cpio_filename_eucjp.cpio.uu
365 FILES+= test_read_format_cpio_filename_koi8r.cpio.uu
366 FILES+= test_read_format_cpio_filename_utf8_jp.cpio.uu
367 FILES+= test_read_format_cpio_filename_utf8_ru.cpio.uu
368 FILES+= test_read_format_cpio_svr4_bzip2_rpm.rpm.uu
369 FILES+= test_read_format_cpio_svr4_gzip_rpm.rpm.uu
370 FILES+= test_read_format_gtar_filename_cp866.tar.Z.uu
371 FILES+= test_read_format_gtar_filename_eucjp.tar.Z.uu
372 FILES+= test_read_format_gtar_filename_koi8r.tar.Z.uu
373 FILES+= test_read_format_gtar_sparse_1_13.tar.uu
374 FILES+= test_read_format_gtar_sparse_1_17.tar.uu
375 FILES+= test_read_format_gtar_sparse_1_17_posix00.tar.uu
376 FILES+= test_read_format_gtar_sparse_1_17_posix01.tar.uu
377 FILES+= test_read_format_gtar_sparse_1_17_posix10.tar.uu
378 FILES+= test_read_format_gtar_sparse_1_17_posix10_modified.tar.uu
379 FILES+= test_read_format_gtar_sparse_skip_entry.tar.Z.uu
380 FILES+= test_read_format_iso.iso.Z.uu
381 FILES+= test_read_format_iso_2.iso.Z.uu
382 FILES+= test_read_format_iso_joliet.iso.Z.uu
383 FILES+= test_read_format_iso_joliet_by_nero.iso.Z.uu
384 FILES+= test_read_format_iso_joliet_long.iso.Z.uu
385 FILES+= test_read_format_iso_joliet_rockridge.iso.Z.uu
386 FILES+= test_read_format_iso_multi_extent.iso.Z.uu
387 FILES+= test_read_format_iso_rockridge.iso.Z.uu
388 FILES+= test_read_format_iso_rockridge_ce.iso.Z.uu
389 FILES+= test_read_format_iso_rockridge_new.iso.Z.uu
390 FILES+= test_read_format_iso_rockridge_rr_moved.iso.Z.uu
391 FILES+= test_read_format_iso_xorriso.iso.Z.uu
392 FILES+= test_read_format_iso_zisofs.iso.Z.uu
393 FILES+= test_read_format_lha_filename_cp932.lzh.uu
394 FILES+= test_read_format_lha_header0.lzh.uu
395 FILES+= test_read_format_lha_header1.lzh.uu
396 FILES+= test_read_format_lha_header2.lzh.uu
397 FILES+= test_read_format_lha_header3.lzh.uu
398 FILES+= test_read_format_lha_lh0.lzh.uu
399 FILES+= test_read_format_lha_lh6.lzh.uu
400 FILES+= test_read_format_lha_lh7.lzh.uu
401 FILES+= test_read_format_lha_withjunk.lzh.uu
402 FILES+= test_read_format_mtree.mtree.uu
403 FILES+= test_read_format_mtree_nomagic.mtree.uu
404 FILES+= test_read_format_mtree_nomagic2.mtree.uu
405 FILES+= test_read_format_mtree_nomagic3.mtree.uu
406 FILES+= test_read_format_rar.rar.uu
407 FILES+= test_read_format_rar_binary_data.rar.uu
408 FILES+= test_read_format_rar_compress_best.rar.uu
409 FILES+= test_read_format_rar_compress_normal.rar.uu
410 FILES+= test_read_format_rar_multi_lzss_blocks.rar.uu
411 FILES+= test_read_format_rar_multivolume.part0001.rar.uu
412 FILES+= test_read_format_rar_multivolume.part0002.rar.uu
413 FILES+= test_read_format_rar_multivolume.part0003.rar.uu
414 FILES+= test_read_format_rar_multivolume.part0004.rar.uu
415 FILES+= test_read_format_rar_noeof.rar.uu
416 FILES+= test_read_format_rar_ppmd_lzss_conversion.rar.uu
417 FILES+= test_read_format_rar_sfx.exe.uu
418 FILES+= test_read_format_rar_subblock.rar.uu
419 FILES+= test_read_format_rar_unicode.rar.uu
420 FILES+= test_read_format_rar_windows.rar.uu
421 FILES+= test_read_format_raw.data.Z.uu
422 FILES+= test_read_format_raw.data.uu
423 FILES+= test_read_format_tar_empty_filename.tar.uu
424 FILES+= test_read_format_tar_filename_koi8r.tar.Z.uu
425 FILES+= test_read_format_ustar_filename_cp866.tar.Z.uu
426 FILES+= test_read_format_ustar_filename_eucjp.tar.Z.uu
427 FILES+= test_read_format_ustar_filename_koi8r.tar.Z.uu
428 FILES+= test_read_format_zip.zip.uu
429 FILES+= test_read_format_zip_comment_stored_1.zip.uu
430 FILES+= test_read_format_zip_comment_stored_2.zip.uu
431 FILES+= test_read_format_zip_filename_cp866.zip.uu
432 FILES+= test_read_format_zip_filename_cp932.zip.uu
433 FILES+= test_read_format_zip_filename_koi8r.zip.uu
434 FILES+= test_read_format_zip_filename_utf8_jp.zip.uu
435 FILES+= test_read_format_zip_filename_utf8_ru.zip.uu
436 FILES+= test_read_format_zip_filename_utf8_ru2.zip.uu
437 FILES+= test_read_format_zip_length_at_end.zip.uu
438 FILES+= test_read_format_zip_mac_metadata.zip.uu
439 FILES+= test_read_format_zip_sfx.uu
440 FILES+= test_read_format_zip_symlink.zip.uu
441 FILES+= test_read_format_zip_ux.zip.uu
442 FILES+= test_read_large_splitted_rar_aa.uu
443 FILES+= test_read_large_splitted_rar_ab.uu
444 FILES+= test_read_large_splitted_rar_ac.uu
445 FILES+= test_read_large_splitted_rar_ad.uu
446 FILES+= test_read_large_splitted_rar_ae.uu
447 FILES+= test_read_splitted_rar_aa.uu
448 FILES+= test_read_splitted_rar_ab.uu
449 FILES+= test_read_splitted_rar_ac.uu
450 FILES+= test_read_splitted_rar_ad.uu
451 FILES+= test_splitted_rar_seek_support_aa.uu
452 FILES+= test_splitted_rar_seek_support_ab.uu
453 FILES+= test_splitted_rar_seek_support_ac.uu
454 FILES+= test_write_disk_appledouble.cpio.gz.uu
455 FILES+= test_write_disk_hfs_compression.tgz.uu
456 FILES+= test_write_disk_mac_metadata.tar.gz.uu
457 FILES+= test_write_disk_no_hfs_compression.tgz.uu
459 .include <bsd.test.mk>