aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid Howells <dhowells@redhat.com>2015-12-21 13:57:20 +0000
committerDavid Howells <dhowells@redhat.com>2015-12-21 15:28:57 +0000
commit806621f9f3e5b56cd85d9972fd1348051a9911c8 (patch)
tree63489de1f3ba0c00271f21767aaafda28b304bac
parent767a9256af05e98d8d838fba444f175b7273de70 (diff)
downloadkeyutils-806621f9f3e5b56cd85d9972fd1348051a9911c8.tar.gz
TEST: Maximum description length is limited in more recent kernels
The maximum description size (maxdesclen) in the upstream kernel has been limited to 4095 plus a NUL char from v3.18 onwards and now this has been backported to RHEL-6 from kernel release 589 and onwards. Limit the maxdesc string when an appropriate kernel is detected. Signed-off-by: David Howells <dhowells@redhat.com>
-rw-r--r--tests/toolbox.inc.sh18
1 files changed, 15 insertions, 3 deletions
diff --git a/tests/toolbox.inc.sh b/tests/toolbox.inc.sh
index 88608a3..e1ec033 100644
--- a/tests/toolbox.inc.sh
+++ b/tests/toolbox.inc.sh
@@ -29,9 +29,21 @@ maxtypelen=31
maxtype=`for ((i=0; i<$((maxtypelen)); i++)); do echo -n a; done`
PAGE_SIZE=`getconf PAGESIZE`
-maxdesclen=$((PAGE_SIZE - 1))
-maxdesc=`for ((i=0; i<$((maxdesclen)); i++)); do echo -n a; done`
-maxcall=$maxdesc
+pagelen=$((PAGE_SIZE - 1))
+fullpage=`for ((i=0; i<$((pagelen)); i++)); do echo -n a; done`
+string4095=`for ((i=0; i<4095; i++)); do echo -n a; done`
+
+if kernel_at_or_later_than 3.18
+then
+ maxdesc=$string4095
+elif [ $OSDIST = RHEL ] && kernel_at_or_later_than 2.6.32-589.el6
+then
+ maxdesc=$string4095
+else
+ maxdesc=$fullpage
+fi
+
+maxcall=$fullpage
maxsquota=`grep '^ *0': /proc/key-users | sed s@.*/@@`