added lock-files-are-persistent-across-system-reboot

This commit is contained in:
Karel Srot 2021-04-27 16:05:13 +02:00
commit 92d624d02f
2 changed files with 98 additions and 0 deletions

View file

@ -0,0 +1,28 @@
summary: Test for BZ#1054442 (lock files are not persistent after system reboot)
description: |
Bug summary: lock files are not persistent after system reboot even though the lock files are entered in tmpfiles.d (opencryptoki)
Bugzilla link: https://bugzilla.redhat.com/show_bug.cgi?id=1054442
contact: Karel Srot <ksrot@redhat.com>
component:
- opencryptoki
test: ./runtest.sh
framework: beakerlib
recommend:
- opencryptoki
- opencryptoki-swtok
- opencryptoki-tpmtok
- opencryptoki-icsftok
- opencryptoki-icatok
- opencryptoki-ccatok
duration: 15m
enabled: true
tag:
- TIPpass_FIPS
- TIPpass_Security
- TierCandidatesPASS
- notier
link:
- relates: https://bugzilla.redhat.com/show_bug.cgi?id=1054442
extra-nitrate: TC#0336748
extra-summary: /CoreOS/opencryptoki/Regression/bz1054442-lock-files-are-not-persistent-after-system-reboot
extra-task: /CoreOS/opencryptoki/Regression/bz1054442-lock-files-are-not-persistent-after-system-reboot

View file

@ -0,0 +1,70 @@
#!/bin/bash
# vim: dict=/usr/share/beakerlib/dictionary.vim cpt=.,w,b,u,t,i,k
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#
# runtest.sh of /CoreOS/opencryptoki/Regression/bz1054442-lock-files-are-not-persistent-after-system-reboot
# Description: Test for BZ#1054442 (lock files are not persistent after system reboot)
# Author: Karel Srot <ksrot@redhat.com>
#
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#
# Copyright (c) 2014 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 Beaker environment
. /usr/share/beakerlib/beakerlib.sh || exit 1
PACKAGE="opencryptoki"
rlJournalStart
rlPhaseStartSetup
rlAssertRpm $PACKAGE
rlRun "TmpDir=\$(mktemp -d)" 0 "Creating tmp directory"
rlRun "pushd $TmpDir"
rlServiceStart pkcsslotd
rlPhaseEnd
rlPhaseStartTest
if arch | grep s390; then
SUBDIRS="ccatok icsf lite swtok"
else
SUBDIRS="icsf swtok"
fi
rlIsRHEL '<=8' && SUBDIRS="$SUBDIRS tpm"
for DIR in $SUBDIRS; do
rlAssertExists /var/lib/opencryptoki/$DIR
done
for DIR in $SUBDIRS; do
rlAssertExists /var/lock/opencryptoki/$DIR
done
rlAssertExists /var/lock/opencryptoki/LCK..APIlock
if [ ! -f /bz1054442-rebooted ]; then
touch /bz1054442-rebooted
rlRun "/usr/bin/rhts-reboot"
else
rlRun "rm /bz1054442-rebooted"
fi
rlPhaseEnd
rlPhaseStartCleanup
rlServiceRestore pkcsslotd
rlRun "popd"
rlRun "rm -r $TmpDir" 0 "Removing tmp directory"
rlPhaseEnd
rlJournalPrintText
rlJournalEnd