diff options
author | Jia Tan <jiat0218@gmail.com> | 2022-10-05 23:54:12 +0800 |
---|---|---|
committer | Lasse Collin <lasse.collin@tukaani.org> | 2022-10-06 17:34:27 +0300 |
commit | 84963318952064a93bfc52edd6b0ef70593384ee (patch) | |
tree | c89b493e4f8c3cde1644c4e2e2810cdf35a358db /tests/test_bcj_exact_size.c | |
parent | Tests: Include mythread.h in the tests that use MYTHREAD_ENABLED. (diff) | |
download | xz-84963318952064a93bfc52edd6b0ef70593384ee.tar.xz |
Tests: Fix compilation issues.
test_bcj_exact_size, test_check, test_hardware, and test_index will
all now compile and skip properly if encoders or decoders are disabled.
Also fixed a small typo (disabed -> disabled).
Thanks to Sebastian Andrzej Siewior.
Diffstat (limited to '')
-rw-r--r-- | tests/test_bcj_exact_size.c | 20 |
1 files changed, 14 insertions, 6 deletions
diff --git a/tests/test_bcj_exact_size.c b/tests/test_bcj_exact_size.c index 39b34c3d..0115ca60 100644 --- a/tests/test_bcj_exact_size.c +++ b/tests/test_bcj_exact_size.c @@ -18,6 +18,15 @@ static void test_exact_size(void) { +#if !defined(HAVE_ENCODERS) || !defined(HAVE_DECODERS) + assert_skip("Encoder or decoder support disabled"); +#else + if (!lzma_filter_encoder_is_supported(LZMA_FILTER_POWERPC) + || !lzma_filter_decoder_is_supported( + LZMA_FILTER_POWERPC)) + assert_skip("PowerPC BCJ encoder and/or decoder " + "is disabled"); + // Something to be compressed const uint8_t in[16] = "0123456789ABCDEF"; @@ -71,12 +80,16 @@ test_exact_size(void) if (strm.total_out < sizeof(in)) strm.avail_out = 1; } +#endif } static void test_empty_block(void) { +#ifndef HAVE_DECODERS + assert_skip("Decoder support disabled"); +#else // An empty file with one Block using PowerPC BCJ and LZMA2. size_t in_size; uint8_t *empty_bcj_lzma2 = tuktest_file_from_srcdir( @@ -92,6 +105,7 @@ test_empty_block(void) LZMA_OK); assert_uint_eq(in_pos, in_size); assert_uint_eq(out_pos, 0); +#endif } @@ -100,12 +114,6 @@ main(int argc, char **argv) { tuktest_start(argc, argv); - if (!lzma_filter_encoder_is_supported(LZMA_FILTER_POWERPC) - || !lzma_filter_decoder_is_supported( - LZMA_FILTER_POWERPC)) - tuktest_early_skip("PowerPC BCJ encoder and/or decoder " - "is disabled"); - tuktest_run(test_exact_size); tuktest_run(test_empty_block); |