From 698470609cf47201101ac0e0cc541f68fb7ee8ba Mon Sep 17 00:00:00 2001 From: Lennart Poettering Date: Fri, 24 Nov 2017 14:08:51 +0100 Subject: [PATCH] test: handle gracefully if decompressor tools are not installed (#7455) Fixes: #7441 --- src/journal/test-compress.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/journal/test-compress.c b/src/journal/test-compress.c index 1b9b186be3..ea1ffcc4af 100644 --- a/src/journal/test-compress.c +++ b/src/journal/test-compress.c @@ -27,6 +27,7 @@ #include "fd-util.h" #include "fileio.h" #include "macro.h" +#include "path-util.h" #include "random-util.h" #include "util.h" @@ -157,9 +158,15 @@ static void test_compress_stream(int compression, char pattern[] = "/tmp/systemd-test.compressed.XXXXXX", pattern2[] = "/tmp/systemd-test.compressed.XXXXXX"; int r; - _cleanup_free_ char *cmd = NULL, *cmd2; + _cleanup_free_ char *cmd = NULL, *cmd2 = NULL; struct stat st = {}; + r = find_binary(cat, NULL); + if (r < 0) { + log_error_errno(r, "Skipping %s, could not find %s binary: %m", __func__, cat); + return; + } + log_debug("/* testing %s compression */", object_compressed_to_string(compression));