aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid Howells <dhowells@redhat.com>2013-11-28 14:25:00 +0000
committerDavid Howells <dhowells@redhat.com>2013-11-28 14:25:00 +0000
commit8b4ae963ed92523aea18dfbb8cab3f4979e13bd1 (patch)
tree7670954503256ca993b76dcbac9ce51c327f6c66
parent325844a2ddc42ed0e6d95359abc94730d745e45f (diff)
downloadkeyutils-8b4ae963ed92523aea18dfbb8cab3f4979e13bd1.tar.gz
TEST: Test for RHBZ 1033467
Test for the problem reported in: https://bugzilla.redhat.com/show_bug.cgi?id=1033467 whereby 17 keyrings added into another, previously empty keyring cause a number of bugs to appear (since the kernel patch to expand keyring capacity). Signed-off-by: David Howells <dhowells@redhat.com>
-rw-r--r--tests/Makefile2
-rw-r--r--tests/bugzillas/bz1033467/runtest.sh67
2 files changed, 68 insertions, 1 deletions
diff --git a/tests/Makefile b/tests/Makefile
index fe5b4df..a31c00a 100644
--- a/tests/Makefile
+++ b/tests/Makefile
@@ -45,7 +45,7 @@ build: $(BUILT_FILES)
clean:
rm -f *~ *.rpm $(BUILT_FILES)
- find keyctl -name test.out -delete
+ find * -name test.out -delete
# You may need to add other targets e.g. to build executables from source code
# Add them here:
diff --git a/tests/bugzillas/bz1033467/runtest.sh b/tests/bugzillas/bz1033467/runtest.sh
new file mode 100644
index 0000000..cf3b5eb
--- /dev/null
+++ b/tests/bugzillas/bz1033467/runtest.sh
@@ -0,0 +1,67 @@
+#!/bin/sh
+
+# Test for https://bugzilla.redhat.com/show_bug.cgi?id=1033467
+
+. ../../prepare.inc.sh
+. ../../toolbox.inc.sh
+
+
+# ---- do the actual testing ----
+
+result=PASS
+echo "++++ BEGINNING TEST" >$OUTPUTFILE
+
+# create a keyring and attach it to the session keyring
+marker "ADD SANDBOX KEYRING"
+create_keyring sandbox @s
+expect_keyid sandbox
+
+# create a bunch of nested keyrings in the sandbox
+marker "ADD NESTED KEYRINGS"
+for ((i=0; i<=16; i++))
+do
+ create_keyring ring$i $sandbox
+ expect_keyid tmp
+done
+
+# create a key in each of those keyrings
+marker "ADD KEYS"
+keys=""
+for ((i=0; i<=16; i++))
+do
+ create_key user a$i a %:ring$i
+ expect_keyid id
+ keys="$keys $id"
+done
+
+# search for the added keys, beginning at sandbox and exercising the nesting
+marker "SEARCH KEYS"
+keys2=""
+for ((i=0; i<=16; i++))
+do
+ search_for_key $sandbox user a$i
+ expect_keyid id
+ keys2="$keys2 $id"
+done
+
+marker "COMPARE KEY LISTS"
+if [ "$keys" != "$keys2" ]
+then
+ echo "Key lists differ" >>$OUTPUTFILE
+ echo List 1: "\"$keys\"" >>$OUTPUTFILE
+ echo List 2: "\"$keys2\"" >>$OUTPUTFILE
+ failed
+fi
+
+# search for some unadded keys and make sure we get an error
+marker "SEARCH MISSES"
+for ((i=17; i<=20; i++))
+do
+ search_for_key --fail $sandbox user a$i
+ expect_error ENOKEY
+done
+
+echo "++++ FINISHED TEST: $result" >>$OUTPUTFILE
+
+# --- then report the results in the database ---
+toolbox_report_result $TEST $result