summaryrefslogtreecommitdiff
path: root/src/test
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2018-02-26 13:46:58 +0100
committerSven Eden <yamakuzure@gmx.net>2018-05-30 07:59:07 +0200
commit12a619f9e6840e8242e41586498cbd39f067f052 (patch)
tree0dfff6a0aec30503a1adf99ece075c34a8b507ba /src/test
parent746dd725294bda772acdfb819feb60015bddec4f (diff)
khash: try to detect broken AF_ALG support in centos kernels
Fixes: #8278
Diffstat (limited to 'src/test')
-rw-r--r--src/test/test-hash.c9
-rw-r--r--src/test/test-id128.c4
2 files changed, 8 insertions, 5 deletions
diff --git a/src/test/test-hash.c b/src/test/test-hash.c
index a08771abb..0d627a425 100644
--- a/src/test/test-hash.c
+++ b/src/test/test-hash.c
@@ -35,12 +35,15 @@ int main(int argc, char *argv[]) {
assert_se(khash_new(&h, NULL) == -EINVAL);
assert_se(khash_new(&h, "") == -EINVAL);
- r = khash_new(&h, "foobar");
- if (r == -EAFNOSUPPORT) {
+
+ r = khash_supported();
+ assert_se(r >= 0);
+ if (r == 0) {
puts("khash not supported on this kernel, skipping");
return EXIT_TEST_SKIP;
}
- assert_se(r == -EOPNOTSUPP);
+
+ assert_se(khash_new(&h, "foobar") == -EOPNOTSUPP); /* undefined hash function */
assert_se(khash_new(&h, "sha256") >= 0);
assert_se(khash_get_size(h) == 32);
diff --git a/src/test/test-id128.c b/src/test/test-id128.c
index b7fca1540..dba728376 100644
--- a/src/test/test-id128.c
+++ b/src/test/test-id128.c
@@ -156,9 +156,9 @@ int main(int argc, char *argv[]) {
assert_se(sd_id128_equal(id, id2));
r = sd_id128_get_machine_app_specific(SD_ID128_MAKE(f0,3d,aa,eb,1c,33,4b,43,a7,32,17,29,44,bf,77,2e), &id);
- if (r == -EAFNOSUPPORT) {
+ if (r == -EOPNOTSUPP)
log_info("khash not supported on this kernel, skipping sd_id128_get_machine_app_specific() checks");
- } else {
+ else {
assert_se(r >= 0);
assert_se(sd_id128_get_machine_app_specific(SD_ID128_MAKE(f0,3d,aa,eb,1c,33,4b,43,a7,32,17,29,44,bf,77,2e), &id2) >= 0);
assert_se(sd_id128_equal(id, id2));