chiark / gitweb /
test-sizeof: print the size of an enum
[elogind.git] / src / test / test-hash.c
index 74bd33c0d5a8786879102bf56cac5a6fe6fc67e6..02d1cfaee30a3d19e5672571625417683d3b929f 100644 (file)
@@ -1,22 +1,24 @@
 /***
-  This file is part of elogind.
+  This file is part of systemd.
 
   Copyright 2016 Lennart Poettering
 
-  elogind is free software; you can redistribute it and/or modify it
+  systemd is free software; you can redistribute it and/or modify it
   under the terms of the GNU Lesser General Public License as published by
   the Free Software Foundation; either version 2.1 of the License, or
   (at your option) any later version.
 
-  elogind is distributed in the hope that it will be useful, but
+  systemd is distributed in the hope that it will be useful, but
   WITHOUT ANY WARRANTY; without even the implied warranty of
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
   Lesser General Public License for more details.
 
   You should have received a copy of the GNU Lesser General Public License
-  along with elogind; If not, see <http://www.gnu.org/licenses/>.
+  along with systemd; If not, see <http://www.gnu.org/licenses/>.
 ***/
 
+#include <stdio.h>
+
 #include "alloc-util.h"
 #include "log.h"
 #include "string-util.h"
 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);