summaryrefslogtreecommitdiff
path: root/keyutils-1.5.6/tests/keyctl/pupdate
diff options
context:
space:
mode:
Diffstat (limited to 'keyutils-1.5.6/tests/keyctl/pupdate')
-rw-r--r--keyutils-1.5.6/tests/keyctl/pupdate/bad-args/runtest.sh39
-rw-r--r--keyutils-1.5.6/tests/keyctl/pupdate/noargs/runtest.sh23
-rw-r--r--keyutils-1.5.6/tests/keyctl/pupdate/userupdate/runtest.sh38
3 files changed, 100 insertions, 0 deletions
diff --git a/keyutils-1.5.6/tests/keyctl/pupdate/bad-args/runtest.sh b/keyutils-1.5.6/tests/keyctl/pupdate/bad-args/runtest.sh
new file mode 100644
index 0000000..cde245c
--- /dev/null
+++ b/keyutils-1.5.6/tests/keyctl/pupdate/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"
+pupdate_key --fail @s a
+expect_error EOPNOTSUPP
+
+# attempt to update an invalid key
+marker "CHECK UPDATE INVALID KEY"
+pupdate_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"
+pupdate_key --fail $keyid @s
+expect_error ENOKEY
+
+echo "++++ FINISHED TEST: $result" >>$OUTPUTFILE
+
+# --- then report the results in the database ---
+toolbox_report_result $TEST $result
diff --git a/keyutils-1.5.6/tests/keyctl/pupdate/noargs/runtest.sh b/keyutils-1.5.6/tests/keyctl/pupdate/noargs/runtest.sh
new file mode 100644
index 0000000..fb8341f
--- /dev/null
+++ b/keyutils-1.5.6/tests/keyctl/pupdate/noargs/runtest.sh
@@ -0,0 +1,23 @@
+#!/bin/sh
+
+. ../../../prepare.inc.sh
+. ../../../toolbox.inc.sh
+
+
+# ---- do the actual testing ----
+
+result=PASS
+echo "++++ BEGINNING TEST" >$OUTPUTFILE
+
+# check that no arguments fails correctly
+marker "PUPDATE NO ARGS"
+expect_args_error keyctl pupdate
+
+# check that two arguments fail correctly
+marker "PUPDATE TWO ARGS"
+expect_args_error keyctl pupdate yyy xxxx
+
+echo "++++ FINISHED TEST: $result" >>$OUTPUTFILE
+
+# --- then report the results in the database ---
+toolbox_report_result $TEST $result
diff --git a/keyutils-1.5.6/tests/keyctl/pupdate/userupdate/runtest.sh b/keyutils-1.5.6/tests/keyctl/pupdate/userupdate/runtest.sh
new file mode 100644
index 0000000..fa59bc8
--- /dev/null
+++ b/keyutils-1.5.6/tests/keyctl/pupdate/userupdate/runtest.sh
@@ -0,0 +1,38 @@
+#!/bin/sh
+
+. ../../../prepare.inc.sh
+. ../../../toolbox.inc.sh
+
+
+# ---- do the actual testing ----
+
+result=PASS
+echo "++++ BEGINNING TEST" >$OUTPUTFILE
+
+# check that we can add a user key to the session keyring
+marker "ADD USER KEY"
+create_key user wibble stuff @s
+expect_keyid keyid
+
+# read back what we put in it
+marker "PRINT PAYLOAD"
+print_key $keyid
+expect_payload payload "stuff"
+
+# check that we can update a user key
+marker "PUPDATE USER KEY"
+pupdate_key $keyid "lizard"
+
+# read back what we changed it to
+marker "PRINT UPDATED PAYLOAD"
+print_key $keyid
+expect_payload payload "lizard"
+
+# remove the key we added
+marker "UNLINK KEY"
+unlink_key $keyid @s
+
+echo "++++ FINISHED TEST: $result" >>$OUTPUTFILE
+
+# --- then report the results in the database ---
+toolbox_report_result $TEST $result