From 92d624d02f281558cd82914b58d003b76cbc344f Mon Sep 17 00:00:00 2001 From: Karel Srot Date: Tue, 27 Apr 2021 16:05:13 +0200 Subject: [PATCH] added lock-files-are-persistent-across-system-reboot --- .../main.fmf | 28 ++++++++ .../runtest.sh | 70 +++++++++++++++++++ 2 files changed, 98 insertions(+) create mode 100644 Sanity/lock-files-are-persistent-across-system-reboot/main.fmf create mode 100755 Sanity/lock-files-are-persistent-across-system-reboot/runtest.sh diff --git a/Sanity/lock-files-are-persistent-across-system-reboot/main.fmf b/Sanity/lock-files-are-persistent-across-system-reboot/main.fmf new file mode 100644 index 0000000..e957fbb --- /dev/null +++ b/Sanity/lock-files-are-persistent-across-system-reboot/main.fmf @@ -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 +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 diff --git a/Sanity/lock-files-are-persistent-across-system-reboot/runtest.sh b/Sanity/lock-files-are-persistent-across-system-reboot/runtest.sh new file mode 100755 index 0000000..1b1fafa --- /dev/null +++ b/Sanity/lock-files-are-persistent-across-system-reboot/runtest.sh @@ -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 +# +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +# +# 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