TEST: Make search/valid aware that the behaviour of the kernel changed
The kernel changed its behaviour with regard to the error code it returns when
the first key a search found was revoked and no valid key was found. It used
to return ENOKEY and now returns EKEYREVOKED.
Signed-off-by: David Howells <dhowells@redhat.com>
diff --git a/tests/keyctl/search/valid/runtest.sh b/tests/keyctl/search/valid/runtest.sh
index 2deafc0..746ffa2 100644
--- a/tests/keyctl/search/valid/runtest.sh
+++ b/tests/keyctl/search/valid/runtest.sh
@@ -161,7 +161,20 @@
# revoking the key should make the key unavailable
revoke_key $keyid2
search_for_key --fail $keyringid user lizard
-expect_error EKEYREVOKED
+kver=`uname -r`
+case $kver in
+ *.el7*)
+ expect_error EKEYREVOKED
+ ;;
+ *)
+ if version_less_than `uname -r` 3.13
+ then
+ expect_error ENOKEY
+ else
+ expect_error EKEYREVOKED
+ fi
+ ;;
+esac
# remove the keyrings we added
marker "UNLINK KEYRING"