summaryrefslogtreecommitdiff
path: root/keyutils-1.5.6/tests/keyctl/update/bad-args/runtest.sh
diff options
context:
space:
mode:
Diffstat (limited to 'keyutils-1.5.6/tests/keyctl/update/bad-args/runtest.sh')
-rw-r--r--keyutils-1.5.6/tests/keyctl/update/bad-args/runtest.sh39
1 files changed, 39 insertions, 0 deletions
diff --git a/keyutils-1.5.6/tests/keyctl/update/bad-args/runtest.sh b/keyutils-1.5.6/tests/keyctl/update/bad-args/runtest.sh
new file mode 100644
index 0000000..9d7971a
--- /dev/null
+++ b/keyutils-1.5.6/tests/keyctl/update/bad-args/runtest.sh
@@ -0,0 +1,39 @@
+#!/bin/sh
+
+. ../../../prepare.inc.sh
+. ../../../toolbox.inc.sh
+
+
+# ---- do the actual testing ----
+
+result=PASS
+echo "++++ BEGINNING TEST" >$OUTPUTFILE
+
+# attempt to update the session keyring
+marker "CHECK UPDATE SESSION KEYRING"
+update_key --fail @s a
+expect_error EOPNOTSUPP
+
+# attempt to update an invalid key
+marker "CHECK UPDATE INVALID KEY"
+update_key --fail 0 a
+expect_error EINVAL
+
+# add a user key to the session keyring for us to play with
+marker "ADD USER KEY"
+create_key user wibble stuff @s
+expect_keyid keyid
+
+# remove the key we just added
+marker "UNLINK KEY"
+unlink_key --wait $keyid @s
+
+# it should fail when we attempt to update it
+marker "UPDATE UNLINKED KEY"
+update_key --fail $keyid @s
+expect_error ENOKEY
+
+echo "++++ FINISHED TEST: $result" >>$OUTPUTFILE
+
+# --- then report the results in the database ---
+toolbox_report_result $TEST $result