From: Zbigniew Jędrzejewski-Szmek Date: Fri, 7 Apr 2017 13:28:50 +0000 (-0400) Subject: test-compress*: silence warning about unused definitions when w/o both xz and lz4 X-Git-Tag: v234~306^2~8 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=ccc717fa5c05b3f26c37fe6c87e88674de2642c8;p=platform%2Fupstream%2Fsystemd.git 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. --- diff --git a/src/journal/test-compress-benchmark.c b/src/journal/test-compress-benchmark.c index 6f6d714..4fb93de 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 44a2cf5..92108a8 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 }