X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?p=elogind.git;a=blobdiff_plain;f=src%2Ftest%2Ftest-hash.c;fp=src%2Ftest%2Ftest-hash.c;h=02d1cfaee30a3d19e5672571625417683d3b929f;hp=1972b94cfe89ad617f5b7da153b9d684e2b4127a;hb=efe1fc6ff9c90b61bcc0cf341ff327c8e465ec1b;hpb=1595204336031d6f2b5e77ce50d87bf0d8281da6 diff --git a/src/test/test-hash.c b/src/test/test-hash.c index 1972b94cf..02d1cfaee 100644 --- a/src/test/test-hash.c +++ b/src/test/test-hash.c @@ -17,6 +17,8 @@ along with systemd; If not, see . ***/ +#include + #include "alloc-util.h" #include "log.h" #include "string-util.h" @@ -25,12 +27,18 @@ int main(int argc, char *argv[]) { _cleanup_(khash_unrefp) khash *h = NULL, *copy = NULL; _cleanup_free_ char *s = NULL; + int r; log_set_max_level(LOG_DEBUG); assert_se(khash_new(&h, NULL) == -EINVAL); assert_se(khash_new(&h, "") == -EINVAL); - assert_se(khash_new(&h, "foobar") == -EOPNOTSUPP); + r = khash_new(&h, "foobar"); + if (r == -EAFNOSUPPORT) { + puts("khash not supported on this kernel, skipping"); + return EXIT_TEST_SKIP; + } + assert_se(r == -EOPNOTSUPP); assert_se(khash_new(&h, "sha256") >= 0); assert_se(khash_get_size(h) == 32);