Skip to content

Commit 22e2211

Browse files
committed
libarchive: add test suite
Implement the infrastructure generically so the other test suites can eventually be supported, but for now, only add the tests for libarchive proper.
1 parent e891c0a commit 22e2211

File tree

8 files changed

+391
-1
lines changed

8 files changed

+391
-1
lines changed

ci_config.json

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -619,6 +619,13 @@
619619
"windows": false
620620
}
621621
},
622+
"libarchive": {
623+
"alpine_packages": [
624+
"gzip",
625+
"lzop",
626+
"xz"
627+
]
628+
},
622629
"libcap": {
623630
"_comment": "- relies on Linux specific APIs",
624631
"build_on": {

subprojects/packagefiles/libarchive/libarchive/meson.build

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,7 @@ configure_file(
157157

158158
ver_parts = meson.project_version().split('.')
159159
ver_darwin_compat = (ver_parts[1].to_int() + 14).to_string()
160-
libarchive = library(
160+
libarchive_both = both_libraries(
161161
'libarchive',
162162
sources,
163163
include_directories: libinc,
@@ -173,9 +173,18 @@ libarchive = library(
173173
install: true,
174174
)
175175

176+
# default_both_libraries requires Meson >= 1.6
177+
if get_option('default_library') == 'static'
178+
libarchive = libarchive_both.get_static_lib()
179+
else
180+
libarchive = libarchive_both.get_shared_lib()
181+
endif
182+
176183
depinc = include_directories('.')
177184
libarchive_dep = declare_dependency(
178185
include_directories: depinc,
179186
link_with: libarchive,
180187
)
181188
meson.override_dependency('libarchive', libarchive_dep)
189+
190+
subdir('test')
Lines changed: 343 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,343 @@
1+
libarchive_test_sources = files(
2+
'read_open_memory.c',
3+
'test_7zip_filename_encoding.c',
4+
'test_acl_nfs4.c',
5+
'test_acl_pax.c',
6+
'test_acl_platform_nfs4.c',
7+
'test_acl_platform_posix1e.c',
8+
'test_acl_posix1e.c',
9+
'test_acl_text.c',
10+
'test_ar_mode.c',
11+
'test_archive_api_feature.c',
12+
'test_archive_clear_error.c',
13+
'test_archive_cmdline.c',
14+
'test_archive_digest.c',
15+
'test_archive_match_owner.c',
16+
'test_archive_match_path.c',
17+
'test_archive_match_time.c',
18+
'test_archive_parse_date.c',
19+
'test_archive_pathmatch.c',
20+
'test_archive_read.c',
21+
'test_archive_read_add_passphrase.c',
22+
'test_archive_read_close_twice.c',
23+
'test_archive_read_close_twice_open_fd.c',
24+
'test_archive_read_close_twice_open_filename.c',
25+
'test_archive_read_multiple_data_objects.c',
26+
'test_archive_read_next_header_empty.c',
27+
'test_archive_read_next_header_raw.c',
28+
'test_archive_read_open2.c',
29+
'test_archive_read_set_filter_option.c',
30+
'test_archive_read_set_format_option.c',
31+
'test_archive_read_set_option.c',
32+
'test_archive_read_set_options.c',
33+
'test_archive_read_support.c',
34+
'test_archive_set_error.c',
35+
'test_archive_string.c',
36+
'test_archive_string_conversion.c',
37+
'test_archive_write_add_filter_by_name.c',
38+
'test_archive_write_set_filter_option.c',
39+
'test_archive_write_set_format_by_name.c',
40+
'test_archive_write_set_format_filter_by_ext.c',
41+
'test_archive_write_set_format_option.c',
42+
'test_archive_write_set_option.c',
43+
'test_archive_write_set_options.c',
44+
'test_archive_write_set_passphrase.c',
45+
'test_bad_fd.c',
46+
'test_compat_bzip2.c',
47+
'test_compat_cpio.c',
48+
'test_compat_gtar.c',
49+
'test_compat_gtar_large.c',
50+
'test_compat_gzip.c',
51+
'test_compat_lz4.c',
52+
'test_compat_lzip.c',
53+
'test_compat_lzma.c',
54+
'test_compat_lzop.c',
55+
'test_compat_mac.c',
56+
'test_compat_perl_archive_tar.c',
57+
'test_compat_plexus_archiver_tar.c',
58+
'test_compat_solaris_pax_sparse.c',
59+
'test_compat_solaris_tar_acl.c',
60+
'test_compat_star_acl.c',
61+
'test_compat_tar_directory.c',
62+
'test_compat_tar_hardlink.c',
63+
'test_compat_uudecode.c',
64+
'test_compat_uudecode_large.c',
65+
'test_compat_xz.c',
66+
'test_compat_zip.c',
67+
'test_compat_zstd.c',
68+
'test_empty_write.c',
69+
'test_entry.c',
70+
'test_entry_strmode.c',
71+
'test_extattr_freebsd.c',
72+
'test_filter_count.c',
73+
'test_fuzz.c',
74+
'test_gnutar_filename_encoding.c',
75+
'test_link_resolver.c',
76+
'test_open_failure.c',
77+
'test_open_fd.c',
78+
'test_open_file.c',
79+
'test_open_filename.c',
80+
'test_pax_filename_encoding.c',
81+
'test_pax_xattr_header.c',
82+
'test_read_data_large.c',
83+
'test_read_disk.c',
84+
'test_read_disk_directory_traversals.c',
85+
'test_read_disk_entry_from_file.c',
86+
'test_read_extract.c',
87+
'test_read_file_nonexistent.c',
88+
'test_read_filter_compress.c',
89+
'test_read_filter_grzip.c',
90+
'test_read_filter_gzip_recursive.c',
91+
'test_read_filter_lrzip.c',
92+
'test_read_filter_lzop.c',
93+
'test_read_filter_lzop_multiple_parts.c',
94+
'test_read_filter_program.c',
95+
'test_read_filter_program_signature.c',
96+
'test_read_filter_uudecode.c',
97+
'test_read_filter_uudecode_raw.c',
98+
'test_read_format_7zip.c',
99+
'test_read_format_7zip_encryption_data.c',
100+
'test_read_format_7zip_encryption_header.c',
101+
'test_read_format_7zip_encryption_partially.c',
102+
'test_read_format_7zip_issue2765.c',
103+
'test_read_format_7zip_malformed.c',
104+
'test_read_format_7zip_packinfo_digests.c',
105+
'test_read_format_ar.c',
106+
'test_read_format_cab.c',
107+
'test_read_format_cab_filename.c',
108+
'test_read_format_cpio_afio.c',
109+
'test_read_format_cpio_bin.c',
110+
'test_read_format_cpio_bin_Z.c',
111+
'test_read_format_cpio_bin_be.c',
112+
'test_read_format_cpio_bin_bz2.c',
113+
'test_read_format_cpio_bin_gz.c',
114+
'test_read_format_cpio_bin_le.c',
115+
'test_read_format_cpio_bin_lzip.c',
116+
'test_read_format_cpio_bin_lzma.c',
117+
'test_read_format_cpio_bin_xz.c',
118+
'test_read_format_cpio_filename.c',
119+
'test_read_format_cpio_odc.c',
120+
'test_read_format_cpio_svr4_bzip2_rpm.c',
121+
'test_read_format_cpio_svr4_gzip.c',
122+
'test_read_format_cpio_svr4_gzip_rpm.c',
123+
'test_read_format_cpio_svr4c_Z.c',
124+
'test_read_format_empty.c',
125+
'test_read_format_gtar_filename.c',
126+
'test_read_format_gtar_gz.c',
127+
'test_read_format_gtar_lzma.c',
128+
'test_read_format_gtar_redundant_L.c',
129+
'test_read_format_gtar_sparse.c',
130+
'test_read_format_gtar_sparse_length.c',
131+
'test_read_format_gtar_sparse_skip_entry.c',
132+
'test_read_format_huge_rpm.c',
133+
'test_read_format_iso_Z.c',
134+
'test_read_format_iso_multi_extent.c',
135+
'test_read_format_iso_xorriso.c',
136+
'test_read_format_isojoliet_bz2.c',
137+
'test_read_format_isojoliet_long.c',
138+
'test_read_format_isojoliet_rr.c',
139+
'test_read_format_isojoliet_versioned.c',
140+
'test_read_format_isorr_bz2.c',
141+
'test_read_format_isorr_ce.c',
142+
'test_read_format_isorr_new_bz2.c',
143+
'test_read_format_isorr_rr_moved.c',
144+
'test_read_format_isozisofs_bz2.c',
145+
'test_read_format_lha.c',
146+
'test_read_format_lha_bugfix_0.c',
147+
'test_read_format_lha_filename.c',
148+
'test_read_format_lha_filename_utf16.c',
149+
'test_read_format_mtree.c',
150+
'test_read_format_mtree_crash747.c',
151+
'test_read_format_pax_bz2.c',
152+
'test_read_format_rar.c',
153+
'test_read_format_rar5.c',
154+
'test_read_format_rar_encryption.c',
155+
'test_read_format_rar_encryption_data.c',
156+
'test_read_format_rar_encryption_header.c',
157+
'test_read_format_rar_encryption_partially.c',
158+
'test_read_format_rar_filter.c',
159+
'test_read_format_rar_invalid1.c',
160+
'test_read_format_rar_overflow.c',
161+
'test_read_format_raw.c',
162+
'test_read_format_tar.c',
163+
'test_read_format_tar_V_negative_size.c',
164+
'test_read_format_tar_concatenated.c',
165+
'test_read_format_tar_empty_filename.c',
166+
'test_read_format_tar_empty_pax.c',
167+
'test_read_format_tar_empty_with_gnulabel.c',
168+
'test_read_format_tar_filename.c',
169+
'test_read_format_tar_invalid_pax_size.c',
170+
'test_read_format_tar_mac_metadata.c',
171+
'test_read_format_tar_pax_g_large.c',
172+
'test_read_format_tar_pax_large_attr.c',
173+
'test_read_format_tar_pax_negative_time.c',
174+
'test_read_format_tbz.c',
175+
'test_read_format_tgz.c',
176+
'test_read_format_tlz.c',
177+
'test_read_format_txz.c',
178+
'test_read_format_tz.c',
179+
'test_read_format_ustar_filename.c',
180+
'test_read_format_warc.c',
181+
'test_read_format_xar.c',
182+
'test_read_format_xar_doublelink.c',
183+
'test_read_format_zip.c',
184+
'test_read_format_zip_7075_utf8_paths.c',
185+
'test_read_format_zip_comment_stored.c',
186+
'test_read_format_zip_encryption_data.c',
187+
'test_read_format_zip_encryption_header.c',
188+
'test_read_format_zip_encryption_partially.c',
189+
'test_read_format_zip_extra_padding.c',
190+
'test_read_format_zip_filename.c',
191+
'test_read_format_zip_high_compression.c',
192+
'test_read_format_zip_jar.c',
193+
'test_read_format_zip_mac_metadata.c',
194+
'test_read_format_zip_malformed.c',
195+
'test_read_format_zip_msdos.c',
196+
'test_read_format_zip_nested.c',
197+
'test_read_format_zip_nofiletype.c',
198+
'test_read_format_zip_padded.c',
199+
'test_read_format_zip_sfx.c',
200+
'test_read_format_zip_traditional_encryption_data.c',
201+
'test_read_format_zip_winzip_aes.c',
202+
'test_read_format_zip_winzip_aes_large.c',
203+
'test_read_format_zip_with_invalid_traditional_eocd.c',
204+
'test_read_format_zip_zip64.c',
205+
'test_read_large.c',
206+
'test_read_pax_empty_val_no_nl.c',
207+
'test_read_pax_truncated.c',
208+
'test_read_pax_xattr_rht_security_selinux.c',
209+
'test_read_pax_xattr_schily.c',
210+
'test_read_position.c',
211+
'test_read_set_format.c',
212+
'test_read_too_many_filters.c',
213+
'test_read_truncated.c',
214+
'test_read_truncated_filter.c',
215+
'test_short_writes.c',
216+
'test_sparse_basic.c',
217+
'test_tar_filenames.c',
218+
'test_tar_large.c',
219+
'test_ustar_filename_encoding.c',
220+
'test_ustar_filenames.c',
221+
'test_warn_missing_hardlink_target.c',
222+
'test_write_disk.c',
223+
'test_write_disk_appledouble.c',
224+
'test_write_disk_failures.c',
225+
'test_write_disk_fixup.c',
226+
'test_write_disk_hardlink.c',
227+
'test_write_disk_hfs_compression.c',
228+
'test_write_disk_lookup.c',
229+
'test_write_disk_mac_metadata.c',
230+
'test_write_disk_no_hfs_compression.c',
231+
'test_write_disk_perms.c',
232+
'test_write_disk_secure.c',
233+
'test_write_disk_secure744.c',
234+
'test_write_disk_secure745.c',
235+
'test_write_disk_secure746.c',
236+
'test_write_disk_secure_noabsolutepaths.c',
237+
'test_write_disk_sparse.c',
238+
'test_write_disk_symlink.c',
239+
'test_write_disk_times.c',
240+
'test_write_filter_b64encode.c',
241+
'test_write_filter_bzip2.c',
242+
'test_write_filter_compress.c',
243+
'test_write_filter_gzip.c',
244+
'test_write_filter_gzip_timestamp.c',
245+
'test_write_filter_lrzip.c',
246+
'test_write_filter_lz4.c',
247+
'test_write_filter_lzip.c',
248+
'test_write_filter_lzma.c',
249+
'test_write_filter_lzop.c',
250+
'test_write_filter_program.c',
251+
'test_write_filter_uuencode.c',
252+
'test_write_filter_xz.c',
253+
'test_write_filter_zstd.c',
254+
'test_write_format_7zip.c',
255+
'test_write_format_7zip_empty.c',
256+
'test_write_format_7zip_large.c',
257+
'test_write_format_ar.c',
258+
'test_write_format_cpio.c',
259+
'test_write_format_cpio_empty.c',
260+
'test_write_format_cpio_newc.c',
261+
'test_write_format_cpio_odc.c',
262+
'test_write_format_gnutar.c',
263+
'test_write_format_gnutar_filenames.c',
264+
'test_write_format_iso9660.c',
265+
'test_write_format_iso9660_boot.c',
266+
'test_write_format_iso9660_empty.c',
267+
'test_write_format_iso9660_filename.c',
268+
'test_write_format_iso9660_zisofs.c',
269+
'test_write_format_mtree.c',
270+
'test_write_format_mtree_absolute_path.c',
271+
'test_write_format_mtree_classic.c',
272+
'test_write_format_mtree_classic_indent.c',
273+
'test_write_format_mtree_fflags.c',
274+
'test_write_format_mtree_no_separator.c',
275+
'test_write_format_mtree_preset_digests.c',
276+
'test_write_format_mtree_quoted_filename.c',
277+
'test_write_format_pax.c',
278+
'test_write_format_raw.c',
279+
'test_write_format_raw_b64.c',
280+
'test_write_format_shar_empty.c',
281+
'test_write_format_tar.c',
282+
'test_write_format_tar_empty.c',
283+
'test_write_format_tar_sparse.c',
284+
'test_write_format_tar_ustar.c',
285+
'test_write_format_tar_v7tar.c',
286+
'test_write_format_warc.c',
287+
'test_write_format_warc_empty.c',
288+
'test_write_format_xar.c',
289+
'test_write_format_xar_empty.c',
290+
'test_write_format_zip.c',
291+
'test_write_format_zip64_stream.c',
292+
'test_write_format_zip_compression_bzip2.c',
293+
'test_write_format_zip_compression_lzmaxz.c',
294+
'test_write_format_zip_compression_store.c',
295+
'test_write_format_zip_compression_zstd.c',
296+
'test_write_format_zip_empty.c',
297+
'test_write_format_zip_empty_zip64.c',
298+
'test_write_format_zip_entry_size_unset.c',
299+
'test_write_format_zip_file.c',
300+
'test_write_format_zip_file_zip64.c',
301+
'test_write_format_zip_large.c',
302+
'test_write_format_zip_stream.c',
303+
'test_write_format_zip_windows_path.c',
304+
'test_write_format_zip_zip64.c',
305+
'test_write_open_memory.c',
306+
'test_write_read_format_zip.c',
307+
'test_xattr_platform.c',
308+
'test_zip_filename_encoding.c',
309+
)
310+
311+
configure_file(
312+
command: [mklist] + libarchive_test_sources,
313+
capture: true,
314+
output: 'list.h',
315+
)
316+
317+
libarchive_test = executable(
318+
'libarchive_test',
319+
libarchive_test_sources,
320+
test_utils_sources,
321+
c_args: '-DLIBARCHIVE_STATIC',
322+
include_directories: [depinc, test_utils_include],
323+
link_with: libarchive_both.get_static_lib(),
324+
dependencies: deps,
325+
build_by_default: false,
326+
)
327+
328+
if meson.version().version_compare('>=0.62.0')
329+
test(
330+
'libarchive_test',
331+
libarchive_test,
332+
args: ['-r', meson.current_source_dir(), '-v'],
333+
timeout: 600,
334+
verbose: true,
335+
)
336+
else
337+
test(
338+
'libarchive_test',
339+
libarchive_test,
340+
args: ['-r', meson.current_source_dir(), '-v'],
341+
timeout: 600,
342+
)
343+
endif

subprojects/packagefiles/libarchive/meson.build

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -791,6 +791,7 @@ endif
791791

792792
incdirs = include_directories('.')
793793

794+
subdir('test_utils')
794795
subdir('libarchive')
795796

796797
if get_option('progs').length() > 0

0 commit comments

Comments
 (0)