diff --git a/Regression/bz612274-Opencryptoki-session-object-performance-degradation/main.fmf b/Regression/bz612274-Opencryptoki-session-object-performance-degradation/main.fmf new file mode 100644 index 0000000..d195647 --- /dev/null +++ b/Regression/bz612274-Opencryptoki-session-object-performance-degradation/main.fmf @@ -0,0 +1,38 @@ +summary: Tests if overall performance of cryptographic operations degrades exponentially + with the number of objects per token or open sessions per process +description: | + Test Case Relevancy: + arch = ia64: False +contact: Karel Srot +component: +- openCryptoki +test: ./runtest.sh +framework: beakerlib +recommend: +- opencryptoki +- opencryptoki-swtok +- gcc +- automake +- libtool +- openssl-devel +- expect +- trousers-devel +- yum-utils +- bzip2 +- rpm-build +- libica-devel +duration: 20m +enabled: true +tag: +- TIPpass_Security +- Tier3 +- Tier3security +- rhel8-buildroot +- rhel9-buildroot +tier: '3' +link: +- relates: https://bugzilla.redhat.com/show_bug.cgi?id=612274 +- relates: https://bugzilla.redhat.com/show_bug.cgi?id=627560 +extra-nitrate: TC#0075518 +extra-summary: /CoreOS/openCryptoki/Regression/bz612274-Opencryptoki-session-object-performance-degradation +extra-task: /CoreOS/openCryptoki/Regression/bz612274-Opencryptoki-session-object-performance-degradation diff --git a/Regression/bz612274-Opencryptoki-session-object-performance-degradation/runtest.sh b/Regression/bz612274-Opencryptoki-session-object-performance-degradation/runtest.sh new file mode 100755 index 0000000..b34ab63 --- /dev/null +++ b/Regression/bz612274-Opencryptoki-session-object-performance-degradation/runtest.sh @@ -0,0 +1,88 @@ +#!/bin/bash +# vim: dict=/usr/share/beakerlib/dictionary.vim cpt=.,w,b,u,t,i,k +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +# +# runtest.sh of /CoreOS/openCryptoki/Regression/bz612274-Opencryptoki-session-object-performance-degradation +# Description: Tests if overall performance of cryptographic operations degrades exponentially with the number of objects per token or open sessions per process +# Author: Miroslav Vadkerti +# +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +# +# Copyright (c) 2010 Red Hat, Inc. All rights reserved. +# +# This copyrighted material is made available to anyone wishing +# to use, modify, copy, or redistribute it subject to the terms +# and conditions of the GNU General Public License version 2. +# +# This program is distributed in the hope that it will be +# useful, but WITHOUT ANY WARRANTY; without even the implied +# warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR +# PURPOSE. See the GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public +# License along with this program; if not, write to the Free +# Software Foundation, Inc., 51 Franklin Street, Fifth Floor, +# Boston, MA 02110-1301, USA. +# +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +# Include rhts environment +. /usr/share/beakerlib/beakerlib.sh || exit 1 + +PACKAGE="opencryptoki" +PACKAGES="gcc automake libtool openssl-devel expect trousers-devel" +TMPDIR=`mktemp -d` +TMP=`mktemp` +SRC="src.tbz" + +rlJournalStart + rlPhaseStartSetup + rlAssertRpm $PACKAGE + for PKG in $PACKAGES; do + rlAssertRpm $PKG + done + PKGVER=`rpm -q --qf '%{VERSION}' opencryptoki` + rlServiceStart "pkcsslotd" + # use always software slot + # SLOT=$(($(pkcsconf -s | grep -B1 Soft | grep -o '#[0-9]' | tr -d '#')-1)) + SLOT=$(pkcsconf -s | egrep -B1 '(Soft|Linux)' | grep -o '#[0-9]' | tr -d '#') + rlLog "Using slot $SLOT" + rlRun "pushd ." + rlRun "cd $TMPDIR" + rlFetchSrcForInstalled opencryptoki + rlRun "yum-builddep -y opencryptoki*src.rpm" + rlRun "rpm -i opencryptoki*src.rpm" + + # opencryptoki version >= 3.11.0 needs to enable building test cases during the pkg build + rlRun "sed -i 's/^%configure /%configure --enable-testcases /' ~/rpmbuild/SPECS/opencryptoki.spec" + rlRun "rpmbuild -bp ~/rpmbuild/SPECS/opencryptoki.spec" 0 "Preparing builddir" + TESTDIR=`ls -d ~/rpmbuild/BUILD/opencryptoki*/testcases` + rlRun "pushd . && cd $TESTDIR" + rlRun "sed -i 's/50000/10000/g' pkcs11/sess_perf.c" 0 "Adjusting testcase" + rlRun "rpmbuild -bc --short-circuit ~/rpmbuild/SPECS/opencryptoki.spec" 0 "Building opencryptoki files" + popd + rlPhaseEnd + + rlPhaseStartTest + cd $TESTDIR + if [ -d driver ]; then + rlRun "cd driver" + rlRun "./sess_perf_tests -slot $SLOT | tee $TMP" + else + rlRun "cd pkcs11" + rlRun "./sess_bench -slot $SLOT | tee $TMP" + fi + rlRun "cat $TMP | grep CKR" 1 "Checking for errors" + # Count the number occurrences when performance test time exceeds >10ms + # In buggy version this will happen a lot and the performance will degrade. + # The count (3) currently tested may need more adjustment. + COUNT=$(cat $TMP | grep Time | egrep -c '[0-9][0-9]+') + rlAssertGreater "Checking performance" 3 $COUNT + rlPhaseEnd + + rlPhaseStartCleanup + rlRun "popd" + rlRun "rm -rf $TMPDIR $TMP" + rlPhaseEnd +rlJournalPrintText +rlJournalEnd