summaryrefslogtreecommitdiff
path: root/keyutils-1.5.6/tests/keyctl/session
diff options
context:
space:
mode:
authorLorry Tar Creator <lorry-tar-importer@baserock.org>2013-08-29 22:05:30 +0000
committer <>2013-09-19 12:35:38 +0000
commit20f3885d80d6b4eda72b35a8d219a722310274fd (patch)
tree6e2bd9f23d3c17447065dd681774d52c67bb683d /keyutils-1.5.6/tests/keyctl/session
downloadkeyutils-tarball-20f3885d80d6b4eda72b35a8d219a722310274fd.tar.gz
Imported from /home/lorry/working-area/delta_keyutils-tarball/keyutils-1.5.6.tar.bz2.HEADkeyutils-1.5.6masterbaserock/morph
Diffstat (limited to 'keyutils-1.5.6/tests/keyctl/session')
-rw-r--r--keyutils-1.5.6/tests/keyctl/session/bad-args/runtest.sh25
-rw-r--r--keyutils-1.5.6/tests/keyctl/session/valid/runtest.sh42
2 files changed, 67 insertions, 0 deletions
diff --git a/keyutils-1.5.6/tests/keyctl/session/bad-args/runtest.sh b/keyutils-1.5.6/tests/keyctl/session/bad-args/runtest.sh
new file mode 100644
index 0000000..e3b6f71
--- /dev/null
+++ b/keyutils-1.5.6/tests/keyctl/session/bad-args/runtest.sh
@@ -0,0 +1,25 @@
+#!/bin/sh
+
+. ../../../prepare.inc.sh
+. ../../../toolbox.inc.sh
+
+
+# ---- do the actual testing ----
+
+result=PASS
+echo "++++ BEGINNING TEST" >$OUTPUTFILE
+
+# check that an empty keyring name fails correctly
+marker "SESSION WITH EMPTY KEYRING NAME"
+new_session --fail ""
+expect_error EINVAL
+
+# check that an overlong keyring name fails correctly
+marker "SESSION WITH OVERLONG KEYRING NAME"
+new_session --fail a$maxdesc
+expect_error EINVAL
+
+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/session/valid/runtest.sh b/keyutils-1.5.6/tests/keyctl/session/valid/runtest.sh
new file mode 100644
index 0000000..172343a
--- /dev/null
+++ b/keyutils-1.5.6/tests/keyctl/session/valid/runtest.sh
@@ -0,0 +1,42 @@
+#!/bin/sh
+
+. ../../../prepare.inc.sh
+. ../../../toolbox.inc.sh
+
+
+# ---- do the actual testing ----
+
+result=PASS
+echo "++++ BEGINNING TEST" >$OUTPUTFILE
+
+# describe the keyring created for an anonymous session
+if [ $OSDIST = RHEL -a $OSRELEASE -le 5 ]
+then
+ marker "ANON SESSION"
+ new_session - keyctl rdescribe @s "@"
+ expect_key_rdesc rdesc "keyring@.*@.*@.*@_ses[^@]*\$"
+
+ # check the session keyring ID is shown
+ seskeyring="`tail -2 $OUTPUTFILE | head -1`"
+ if ! expr "$seskeyring" : "Joined session keyring: [0-9]*" >&/dev/null
+ then
+ failed
+ fi
+fi
+
+# describe the keyring created for a named session
+marker "NAMED SESSION"
+new_session qwerty keyctl rdescribe @s "@"
+expect_key_rdesc rdesc "keyring@.*@.*@.*@qwerty"
+
+# check the session keyring ID is shown
+seskeyring="`tail -2 $OUTPUTFILE | head -1`"
+if ! expr "$seskeyring" : "Joined session keyring: [0-9]*" >&/dev/null
+then
+ failed
+fi
+
+echo "++++ FINISHED TEST: $result" >>$OUTPUTFILE
+
+# --- then report the results in the database ---
+toolbox_report_result $TEST $result