aboutsummaryrefslogtreecommitdiff
path: root/tests/test_memlimit.c
diff options
context:
space:
mode:
authorJia Tan <jiat0218@gmail.com>2022-10-05 23:54:12 +0800
committerLasse Collin <lasse.collin@tukaani.org>2022-10-06 17:34:27 +0300
commit84963318952064a93bfc52edd6b0ef70593384ee (patch)
treec89b493e4f8c3cde1644c4e2e2810cdf35a358db /tests/test_memlimit.c
parentTests: Include mythread.h in the tests that use MYTHREAD_ENABLED. (diff)
downloadxz-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 'tests/test_memlimit.c')
-rw-r--r--tests/test_memlimit.c16
1 files changed, 15 insertions, 1 deletions
diff --git a/tests/test_memlimit.c b/tests/test_memlimit.c
index b5f91472..4e16903d 100644
--- a/tests/test_memlimit.c
+++ b/tests/test_memlimit.c
@@ -26,6 +26,9 @@ static uint8_t out[8192];
static void
test_memlimit_stream_decoder(void)
{
+#ifndef HAVE_DECODERS
+ assert_skip("Decoder support disabled");
+#else
lzma_stream strm = LZMA_STREAM_INIT;
assert_lzma_ret(lzma_stream_decoder(&strm, MEMLIMIT_TOO_LOW, 0),
LZMA_OK);
@@ -48,6 +51,7 @@ test_memlimit_stream_decoder(void)
assert_lzma_ret(lzma_code(&strm, LZMA_FINISH), LZMA_STREAM_END);
lzma_end(&strm);
+#endif
}
@@ -55,7 +59,9 @@ static void
test_memlimit_stream_decoder_mt(void)
{
#ifndef MYTHREAD_ENABLED
- assert_skip("Threading support disabed");
+ assert_skip("Threading support disabled");
+#elif !defined(HAVE_DECODERS)
+ assert_skip("Decoder support disabled");
#else
lzma_stream strm = LZMA_STREAM_INIT;
lzma_mt mt = {
@@ -90,6 +96,9 @@ test_memlimit_stream_decoder_mt(void)
static void
test_memlimit_alone_decoder(void)
{
+#ifndef HAVE_DECODERS
+ assert_skip("Decoder support disabled");
+#else
size_t alone_size;
uint8_t *alone_buf = tuktest_file_from_srcdir(
"files/good-unknown_size-with_eopm.lzma", &alone_size);
@@ -112,12 +121,16 @@ test_memlimit_alone_decoder(void)
assert_lzma_ret(lzma_code(&strm, LZMA_FINISH), LZMA_STREAM_END);
lzma_end(&strm);
+#endif
}
static void
test_memlimit_auto_decoder(void)
{
+#ifndef HAVE_DECODERS
+ assert_skip("Decoder support disabled");
+#else
lzma_stream strm = LZMA_STREAM_INIT;
assert_lzma_ret(lzma_auto_decoder(&strm, MEMLIMIT_TOO_LOW, 0),
LZMA_OK);
@@ -137,6 +150,7 @@ test_memlimit_auto_decoder(void)
assert_lzma_ret(lzma_code(&strm, LZMA_FINISH), LZMA_STREAM_END);
lzma_end(&strm);
+#endif
}