summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2017-04-07 09:28:50 -0400
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2017-04-19 19:27:01 -0400
commitccc717fa5c05b3f26c37fe6c87e88674de2642c8 (patch)
treeea5f42ee33e587242bf022b5b1bc29a44bf6bf80
parent86cebca72ba9ddb5dc6e6a2723f08a3881f3fbe3 (diff)
test-compress*: silence warning about unused definitions when w/o both xz and lz4
I think it's nice to mark the test as skipped instead of omitting it entirely, hence #ifdefs in the code instead of excluding the test in Makefile.am/meson.build.
-rw-r--r--src/journal/test-compress-benchmark.c7
-rw-r--r--src/journal/test-compress.c6
2 files changed, 13 insertions, 0 deletions
diff --git a/src/journal/test-compress-benchmark.c b/src/journal/test-compress-benchmark.c
index 6f6d71435d..4fb93ded73 100644
--- a/src/journal/test-compress-benchmark.c
+++ b/src/journal/test-compress-benchmark.c
@@ -30,6 +30,8 @@ typedef int (compress_t)(const void *src, uint64_t src_size, void *dst,
typedef int (decompress_t)(const void *src, uint64_t src_size,
void **dst, size_t *dst_alloc_size, size_t* dst_size, size_t dst_max);
+#if defined(HAVE_XZ) || defined(HAVE_LZ4)
+
static usec_t arg_duration = 2 * USEC_PER_SEC;
static size_t arg_start;
@@ -151,8 +153,10 @@ static void test_compress_decompress(const char* label, const char* type,
100 - compressed * 100. / total,
skipped);
}
+#endif
int main(int argc, char *argv[]) {
+#if defined(HAVE_XZ) || defined(HAVE_LZ4)
const char *i;
log_set_max_level(LOG_INFO);
@@ -177,4 +181,7 @@ int main(int argc, char *argv[]) {
#endif
}
return 0;
+#else
+ return EXIT_TEST_SKIP;
+#endif
}
diff --git a/src/journal/test-compress.c b/src/journal/test-compress.c
index 44a2cf5217..92108a84b3 100644
--- a/src/journal/test-compress.c
+++ b/src/journal/test-compress.c
@@ -54,6 +54,7 @@ typedef int (decompress_sw_t)(const void *src, uint64_t src_size,
typedef int (compress_stream_t)(int fdf, int fdt, uint64_t max_bytes);
typedef int (decompress_stream_t)(int fdf, int fdt, uint64_t max_size);
+#if defined(HAVE_XZ) || defined(HAVE_LZ4)
static void test_compress_decompress(int compression,
compress_blob_t compress,
decompress_blob_t decompress,
@@ -203,6 +204,7 @@ static void test_compress_stream(int compression,
assert_se(unlink(pattern) == 0);
assert_se(unlink(pattern2) == 0);
}
+#endif
#ifdef HAVE_LZ4
static void test_lz4_decompress_partial(void) {
@@ -247,6 +249,7 @@ static void test_lz4_decompress_partial(void) {
#endif
int main(int argc, char *argv[]) {
+#if defined(HAVE_XZ) || defined(HAVE_LZ4)
const char text[] =
"text\0foofoofoofoo AAAA aaaaaaaaa ghost busters barbarbar FFF"
"foofoofoofoo AAAA aaaaaaaaa ghost busters barbarbar FFF";
@@ -312,4 +315,7 @@ int main(int argc, char *argv[]) {
#endif
return 0;
+#else
+ return EXIT_TEST_SKIP;
+#endif
}