summaryrefslogtreecommitdiff
path: root/src/test/test-hash.c
diff options
context:
space:
mode:
authorDjalal Harouni <tixxdz@opendz.org>2017-03-05 14:55:48 +0100
committerGitHub <noreply@github.com>2017-03-05 14:55:48 +0100
commit77313738fe0d656e6aa034a501b80def18a43103 (patch)
treef8645239b809b4ff6baadd46b0ecce5bb55bf8f7 /src/test/test-hash.c
parent055c521ad4e9d2f923e9373ac12e214a1e896cc7 (diff)
parent2e914f34eb9a4a56e3eb70dc0b4345588c9016e7 (diff)
Merge pull request #5525 from martinpitt/khash-notsupp
test: skip instead of fail if crypto kmods are not available
Diffstat (limited to 'src/test/test-hash.c')
-rw-r--r--src/test/test-hash.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/src/test/test-hash.c b/src/test/test-hash.c
index 1972b94cfe..02d1cfaee3 100644
--- a/src/test/test-hash.c
+++ b/src/test/test-hash.c
@@ -17,6 +17,8 @@
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"
@@ -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);