Skip to content

Commit

Permalink
Fix tests added in libarchive#2284
Browse files Browse the repository at this point in the history
Fixes the case when bzip2, lzma or zstd compressions are not supported.
  • Loading branch information
mmatuska committed Oct 22, 2024
1 parent ea56096 commit 95f081c
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 3 deletions.
6 changes: 5 additions & 1 deletion libarchive/test/test_write_format_zip_compression_bzip2.c
Original file line number Diff line number Diff line change
Expand Up @@ -343,8 +343,12 @@ static void verify_bzip2_contents(const char *buff, size_t used)
archive_read_free(zip_archive);
}

#endif /* HAVE_BZLIB_H */
DEFINE_TEST(test_write_format_zip_compression_bzip2)
{
#ifndef HAVE_BZLIB_H
skipping("bzip2 is not fully supported on this platform");
#else /* HAVE_BZLIB_H */
/* Buffer data */
struct archive *a;
char buff[100000];
Expand Down Expand Up @@ -398,5 +402,5 @@ DEFINE_TEST(test_write_format_zip_compression_bzip2)
dumpfile("constructed.zip", buff, used);

verify_bzip2_contents(buff, used);
#endif /* HAVE_BZLIB_H */
}
#endif
7 changes: 6 additions & 1 deletion libarchive/test/test_write_format_zip_compression_lzmaxz.c
Original file line number Diff line number Diff line change
Expand Up @@ -328,8 +328,12 @@ static void verify_lzma_contents(const char *buff, size_t used)
verify_xz_lzma(buff, used, 14, 0xA);
}

#endif /* HAVE_LZMA_H */
DEFINE_TEST(test_write_format_zip_compression_lzmaxz)
{
#ifndef HAVE_LZMA_H
skipping("lzma is not fully supported on this platform");
#else /* HAVE_LZMA_H */
/* Buffer data */
struct archive *a;
char buff[100000];
Expand Down Expand Up @@ -434,5 +438,6 @@ DEFINE_TEST(test_write_format_zip_compression_lzmaxz)
dumpfile("constructed.zip", buff, used);

verify_xz_contents(buff, used);
#endif /* HAVE_LZMA_H */
}
#endif

7 changes: 6 additions & 1 deletion libarchive/test/test_write_format_zip_compression_zstd.c
Original file line number Diff line number Diff line change
Expand Up @@ -343,8 +343,12 @@ static void verify_zstd_contents(const char *buff, size_t used)
archive_read_free(zip_archive);
}

#endif /* HAVE_ZSTD_H */
DEFINE_TEST(test_write_format_zip_compression_zstd)
{
#ifndef HAVE_ZSTD_H
skipping("zstd is not fully supported on this platform");
#else /* HAVE_ZSTD_H */
/* Buffer data */
struct archive *a;
char buff[100000];
Expand Down Expand Up @@ -401,5 +405,6 @@ DEFINE_TEST(test_write_format_zip_compression_zstd)
dumpfile("constructed.zip", buff, used);

verify_zstd_contents(buff, used);
#endif /* HAVE_ZSTD_H */
}
#endif

0 comments on commit 95f081c

Please sign in to comment.