aboutsummaryrefslogtreecommitdiff
path: root/tests/test_index.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_index.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_index.c')
-rw-r--r--tests/test_index.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/tests/test_index.c b/tests/test_index.c
index d9e63dd0..31b958d5 100644
--- a/tests/test_index.c
+++ b/tests/test_index.c
@@ -211,6 +211,7 @@ test_read(lzma_index *i)
static void
test_code(lzma_index *i)
{
+#if defined(HAVE_ENCODERS) && defined(HAVE_DECODERS)
const size_t alloc_size = 128 * 1024;
uint8_t *buf = malloc(alloc_size);
expect(buf != NULL);
@@ -275,6 +276,9 @@ test_code(lzma_index *i)
lzma_index_end(d, NULL);
free(buf);
+#else
+ (void)i;
+#endif
}
@@ -633,6 +637,7 @@ test_locate(void)
static void
test_corrupt(void)
{
+#if defined(HAVE_ENCODERS) && defined(HAVE_DECODERS)
const size_t alloc_size = 128 * 1024;
uint8_t *buf = malloc(alloc_size);
expect(buf != NULL);
@@ -668,6 +673,7 @@ test_corrupt(void)
lzma_end(&strm);
free(buf);
+#endif
}