target_sources(liblzma PRIVATE src/liblzma/common/microlzma_decoder.c)
endif()
-if (MICROLZMA_ENCODER OR MICROLZMA_DECODER)
- add_compile_definitions(HAVE_MICROLZMA)
-endif()
-
#############################
# lzip (.lz) format support #
test_index_hash
test_lzip_decoder
test_memlimit
- test_microlzma
test_stream_flags
test_vli
)
+ # MicroLZMA encoder is needed for both encoder and decoder tests.
+ # If MicroLZMA decoder is not configured but LZMA1 decoder is, then
+ # test_microlzma will fail to compile because this configuration is
+ # not possible in the Autotools build, so the test was not made to
+ # support it since it would have required additional changes.
+ if (MICROLZMA_ENCODER AND (MICROLZMA_DECODER
+ OR NOT "lzma1" IN_LIST DECODERS))
+ list(APPEND LIBLZMA_TESTS test_microlzma)
+ endif()
+
foreach(TEST IN LISTS LIBLZMA_TESTS)
add_executable("${TEST}" "tests/${TEST}.c")
for example, erofs-utils.]),
[], [enable_microlzma=yes])
case $enable_microlzma in
- yes)
- AC_DEFINE([HAVE_MICROLZMA], [1],
- [Define to 1 if MicroLZMA support is enabled.])
- AC_MSG_RESULT([yes])
- ;;
- no)
- AC_MSG_RESULT([no])
+ yes | no)
+ AC_MSG_RESULT([$enable_microlzma])
;;
*)
AC_MSG_RESULT([])
test_bcj_exact_size \
test_memlimit \
test_lzip_decoder \
- test_vli \
- test_microlzma
+ test_vli
TESTS = \
test_check \
test_memlimit \
test_lzip_decoder \
test_vli \
- test_microlzma \
test_files.sh \
test_suffix.sh \
test_compress_prepared_bcj_sparc \
test_compress_generated_random \
test_compress_generated_text
+if COND_MICROLZMA
+check_PROGRAMS += test_microlzma
+TESTS += test_microlzma
+endif
+
if COND_SCRIPTS
TESTS += test_scripts.sh
endif
#include "tests.h"
-#ifdef HAVE_MICROLZMA
-
#define BUFFER_SIZE 1024
#ifdef HAVE_ENCODER_LZMA1
lzma_end(&strm);
}
#endif
-#endif
extern int
{
tuktest_start(argc, argv);
-#ifndef HAVE_MICROLZMA
- tuktest_early_skip("MicroLZMA disabled");
+#ifndef HAVE_ENCODER_LZMA1
+ tuktest_early_skip("LZMA1 encoder disabled");
#else
-# ifdef HAVE_ENCODER_LZMA1
tuktest_run(test_encode_options);
tuktest_run(test_encode_basic);
tuktest_run(test_encode_small_out);
tuktest_run(test_encode_actions);
-# endif
-# if defined(HAVE_DECODER_LZMA1) && defined(HAVE_ENCODER_LZMA1)
+ // MicroLZMA decoder tests require the basic encoder functionality.
+# ifdef HAVE_DECODER_LZMA1
goodbye_world_encoded_size = basic_microlzma_encode(goodbye_world,
ARRAY_SIZE(goodbye_world), &goodbye_world_encoded);