test: handle gracefully if decompressor tools are not installed (#7455)

Fixes: #7441
This commit is contained in:
Lennart Poettering 2017-11-24 14:08:51 +01:00 committed by Zbigniew Jędrzejewski-Szmek
parent cfb56a72ce
commit 698470609c
1 changed files with 8 additions and 1 deletions

View File

@ -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));