Imported Upstream version 3.3.0
[platform/upstream/libarchive.git] / libarchive / test / CMakeLists.txt
1 ############################################
2 #
3 # How to build libarchive_test
4 #
5 ############################################
6 IF(ENABLE_TEST)
7   SET(libarchive_test_SOURCES
8     ../../test_utils/test_utils.c
9     main.c
10     read_open_memory.c
11     test.h
12     test_acl_nfs4.c
13     test_acl_pax.c
14     test_acl_platform_nfs4.c
15     test_acl_platform_posix1e.c
16     test_acl_posix1e.c
17     test_acl_text.c
18     test_archive_api_feature.c
19     test_archive_clear_error.c
20     test_archive_cmdline.c
21     test_archive_digest.c
22     test_archive_getdate.c
23     test_archive_match_owner.c
24     test_archive_match_path.c
25     test_archive_match_time.c
26     test_archive_pathmatch.c
27     test_archive_read_add_passphrase.c
28     test_archive_read_close_twice.c
29     test_archive_read_close_twice_open_fd.c
30     test_archive_read_close_twice_open_filename.c
31     test_archive_read_multiple_data_objects.c
32     test_archive_read_next_header_empty.c
33     test_archive_read_next_header_raw.c
34     test_archive_read_open2.c
35     test_archive_read_set_filter_option.c
36     test_archive_read_set_format_option.c
37     test_archive_read_set_option.c
38     test_archive_read_set_options.c
39     test_archive_read_support.c
40     test_archive_set_error.c
41     test_archive_string.c
42     test_archive_string_conversion.c
43     test_archive_write_add_filter_by_name.c
44     test_archive_write_set_filter_option.c
45     test_archive_write_set_format_by_name.c
46     test_archive_write_set_format_filter_by_ext.c
47     test_archive_write_set_format_option.c
48     test_archive_write_set_option.c
49     test_archive_write_set_options.c
50     test_archive_write_set_passphrase.c
51     test_bad_fd.c
52     test_compat_bzip2.c
53     test_compat_cpio.c
54     test_compat_gtar.c
55     test_compat_gzip.c
56     test_compat_lz4.c
57     test_compat_lzip.c
58     test_compat_lzma.c
59     test_compat_lzop.c
60     test_compat_mac.c
61     test_compat_pax_libarchive_2x.c
62     test_compat_perl_archive_tar.c
63     test_compat_plexus_archiver_tar.c
64     test_compat_solaris_pax_sparse.c
65     test_compat_solaris_tar_acl.c
66     test_compat_star_acl.c
67     test_compat_tar_hardlink.c
68     test_compat_uudecode.c
69     test_compat_uudecode_large.c
70     test_compat_xz.c
71     test_compat_zip.c
72     test_empty_write.c
73     test_entry.c
74     test_entry_strmode.c
75     test_extattr_freebsd.c
76     test_filter_count.c
77     test_fuzz.c
78     test_gnutar_filename_encoding.c
79     test_link_resolver.c
80     test_open_failure.c
81     test_open_fd.c
82     test_open_file.c
83     test_open_filename.c
84     test_pax_filename_encoding.c
85     test_read_data_large.c
86     test_read_disk.c
87     test_read_disk_directory_traversals.c
88     test_read_disk_entry_from_file.c
89     test_read_extract.c
90     test_read_file_nonexistent.c
91     test_read_filter_compress.c
92     test_read_filter_grzip.c
93     test_read_filter_lrzip.c
94     test_read_filter_lzop.c
95     test_read_filter_lzop_multiple_parts.c
96     test_read_filter_program.c
97     test_read_filter_program_signature.c
98     test_read_filter_uudecode.c
99     test_read_format_7zip.c
100     test_read_format_7zip_encryption_data.c
101     test_read_format_7zip_encryption_header.c
102     test_read_format_7zip_encryption_partially.c
103     test_read_format_7zip_malformed.c
104     test_read_format_ar.c
105     test_read_format_cab.c
106     test_read_format_cab_filename.c
107     test_read_format_cpio_afio.c
108     test_read_format_cpio_bin.c
109     test_read_format_cpio_bin_Z.c
110     test_read_format_cpio_bin_be.c
111     test_read_format_cpio_bin_bz2.c
112     test_read_format_cpio_bin_gz.c
113     test_read_format_cpio_bin_le.c
114     test_read_format_cpio_bin_lzip.c
115     test_read_format_cpio_bin_lzma.c
116     test_read_format_cpio_bin_xz.c
117     test_read_format_cpio_filename.c
118     test_read_format_cpio_odc.c
119     test_read_format_cpio_svr4_bzip2_rpm.c
120     test_read_format_cpio_svr4_gzip.c
121     test_read_format_cpio_svr4_gzip_rpm.c
122     test_read_format_cpio_svr4c_Z.c
123     test_read_format_empty.c
124     test_read_format_gtar_filename.c
125     test_read_format_gtar_gz.c
126     test_read_format_gtar_lzma.c
127     test_read_format_gtar_sparse.c
128     test_read_format_gtar_sparse_skip_entry.c
129     test_read_format_iso_Z.c
130     test_read_format_iso_multi_extent.c
131     test_read_format_iso_xorriso.c
132     test_read_format_isojoliet_bz2.c
133     test_read_format_isojoliet_long.c
134     test_read_format_isojoliet_rr.c
135     test_read_format_isojoliet_versioned.c
136     test_read_format_isorr_bz2.c
137     test_read_format_isorr_ce.c
138     test_read_format_isorr_new_bz2.c
139     test_read_format_isorr_rr_moved.c
140     test_read_format_isozisofs_bz2.c
141     test_read_format_lha.c
142     test_read_format_lha_bugfix_0.c
143     test_read_format_lha_filename.c
144     test_read_format_mtree.c
145     test_read_format_mtree_crash747.c
146     test_read_format_pax_bz2.c
147     test_read_format_rar.c
148     test_read_format_rar_encryption_data.c
149     test_read_format_rar_encryption_header.c
150     test_read_format_rar_encryption_partially.c
151     test_read_format_rar_invalid1.c
152     test_read_format_raw.c
153     test_read_format_tar.c
154     test_read_format_tar_concatenated.c
155     test_read_format_tar_empty_filename.c
156     test_read_format_tar_empty_pax.c
157     test_read_format_tar_filename.c
158     test_read_format_tbz.c
159     test_read_format_tgz.c
160     test_read_format_tlz.c
161     test_read_format_txz.c
162     test_read_format_tz.c
163     test_read_format_ustar_filename.c
164     test_read_format_warc.c
165     test_read_format_xar.c
166     test_read_format_zip.c
167     test_read_format_zip_comment_stored.c
168     test_read_format_zip_encryption_data.c
169     test_read_format_zip_encryption_header.c
170     test_read_format_zip_encryption_partially.c
171     test_read_format_zip_filename.c
172     test_read_format_zip_high_compression.c
173     test_read_format_zip_jar.c
174     test_read_format_zip_mac_metadata.c
175     test_read_format_zip_malformed.c
176     test_read_format_zip_msdos.c
177     test_read_format_zip_nested.c
178     test_read_format_zip_nofiletype.c
179     test_read_format_zip_padded.c
180     test_read_format_zip_sfx.c
181     test_read_format_zip_traditional_encryption_data.c
182     test_read_format_zip_winzip_aes.c
183     test_read_format_zip_winzip_aes_large.c
184     test_read_format_zip_zip64.c
185     test_read_large.c
186     test_read_pax_schily_xattr.c
187     test_read_pax_truncated.c
188     test_read_position.c
189     test_read_set_format.c
190     test_read_too_many_filters.c
191     test_read_truncated.c
192     test_read_truncated_filter.c
193     test_sparse_basic.c
194     test_tar_filenames.c
195     test_tar_large.c
196     test_ustar_filename_encoding.c
197     test_ustar_filenames.c
198     test_warn_missing_hardlink_target.c
199     test_write_disk.c
200     test_write_disk_appledouble.c
201     test_write_disk_failures.c
202     test_write_disk_hardlink.c
203     test_write_disk_hfs_compression.c
204     test_write_disk_lookup.c
205     test_write_disk_mac_metadata.c
206     test_write_disk_no_hfs_compression.c
207     test_write_disk_perms.c
208     test_write_disk_secure.c
209     test_write_disk_secure744.c
210     test_write_disk_secure745.c
211     test_write_disk_secure746.c
212     test_write_disk_sparse.c
213     test_write_disk_symlink.c
214     test_write_disk_times.c
215     test_write_filter_b64encode.c
216     test_write_filter_bzip2.c
217     test_write_filter_compress.c
218     test_write_filter_gzip.c
219     test_write_filter_gzip_timestamp.c
220     test_write_filter_lrzip.c
221     test_write_filter_lz4.c
222     test_write_filter_lzip.c
223     test_write_filter_lzma.c
224     test_write_filter_lzop.c
225     test_write_filter_program.c
226     test_write_filter_uuencode.c
227     test_write_filter_xz.c
228     test_write_format_7zip.c
229     test_write_format_7zip_empty.c
230     test_write_format_7zip_large.c
231     test_write_format_ar.c
232     test_write_format_cpio.c
233     test_write_format_cpio_empty.c
234     test_write_format_cpio_newc.c
235     test_write_format_cpio_odc.c
236     test_write_format_gnutar.c
237     test_write_format_gnutar_filenames.c
238     test_write_format_iso9660.c
239     test_write_format_iso9660_boot.c
240     test_write_format_iso9660_empty.c
241     test_write_format_iso9660_filename.c
242     test_write_format_iso9660_zisofs.c
243     test_write_format_mtree.c
244     test_write_format_mtree_absolute_path.c
245     test_write_format_mtree_classic.c
246     test_write_format_mtree_classic_indent.c
247     test_write_format_mtree_fflags.c
248     test_write_format_mtree_no_separator.c
249     test_write_format_mtree_quoted_filename.c
250     test_write_format_pax.c
251     test_write_format_raw.c
252     test_write_format_raw_b64.c
253     test_write_format_shar_empty.c
254     test_write_format_tar.c
255     test_write_format_tar_empty.c
256     test_write_format_tar_sparse.c
257     test_write_format_tar_ustar.c
258     test_write_format_tar_v7tar.c
259     test_write_format_warc.c
260     test_write_format_warc_empty.c
261     test_write_format_xar.c
262     test_write_format_xar_empty.c
263     test_write_format_zip.c
264     test_write_format_zip_compression_store.c
265     test_write_format_zip_empty.c
266     test_write_format_zip_empty_zip64.c
267     test_write_format_zip_file.c
268     test_write_format_zip_file_zip64.c
269     test_write_format_zip_large.c
270     test_write_format_zip_zip64.c
271     test_write_open_memory.c
272     test_write_read_format_zip.c
273     test_zip_filename_encoding.c
274   )
275
276   #
277   # Register target
278   #
279   ADD_EXECUTABLE(libarchive_test ${libarchive_test_SOURCES})
280   TARGET_LINK_LIBRARIES(libarchive_test archive_static ${ADDITIONAL_LIBS})
281   SET_PROPERTY(TARGET libarchive_test PROPERTY COMPILE_DEFINITIONS
282     LIBARCHIVE_STATIC LIST_H)
283
284   #
285   # Generate list.h by grepping DEFINE_TEST() lines out of the C sources.
286   #
287   GENERATE_LIST_H(${CMAKE_CURRENT_BINARY_DIR}/list.h
288     ${CMAKE_CURRENT_LIST_FILE} ${libarchive_test_SOURCES})
289   SET_PROPERTY(DIRECTORY APPEND PROPERTY INCLUDE_DIRECTORIES
290     ${CMAKE_CURRENT_BINARY_DIR})
291
292   # list.h has a line DEFINE_TEST(testname) for every
293   # test.  We can use that to define the tests for cmake by
294   # defining a DEFINE_TEST macro and reading list.h in.
295   MACRO (DEFINE_TEST _testname)
296     ADD_TEST(
297       NAME libarchive_${_testname}
298       COMMAND libarchive_test -vv
299                               -r ${CMAKE_CURRENT_SOURCE_DIR}
300                               ${_testname})
301   ENDMACRO (DEFINE_TEST _testname)
302
303   INCLUDE(${CMAKE_CURRENT_BINARY_DIR}/list.h)
304   INCLUDE_DIRECTORIES(${CMAKE_CURRENT_BINARY_DIR})
305   INCLUDE_DIRECTORIES(${PROJECT_SOURCE_DIR}/test_utils)
306
307   # Experimental new test handling
308   ADD_CUSTOM_TARGET(run_libarchive_test
309         COMMAND libarchive_test -r ${CMAKE_CURRENT_SOURCE_DIR} -vv)
310   ADD_DEPENDENCIES(run_all_tests run_libarchive_test)
311 ENDIF(ENABLE_TEST)
312