Blame Sanity/PID-file-location/runtest.sh

560d35e
#!/bin/bash
560d35e
# vim: dict=/usr/share/beakerlib/dictionary.vim cpt=.,w,b,u,t,i,k
560d35e
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
560d35e
#
560d35e
#   Description: Test for BZ#1974693 (pkcsslotd PIDfile below legacy directory /var/run/)
560d35e
#   Author: Karel Srot <ksrot@redhat.com>
560d35e
#
560d35e
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
560d35e
#
560d35e
#   Copyright (c) 2014 Red Hat, Inc. All rights reserved.
560d35e
#
560d35e
#   This copyrighted material is made available to anyone wishing
560d35e
#   to use, modify, copy, or redistribute it subject to the terms
560d35e
#   and conditions of the GNU General Public License version 2.
560d35e
#
560d35e
#   This program is distributed in the hope that it will be
560d35e
#   useful, but WITHOUT ANY WARRANTY; without even the implied
560d35e
#   warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
560d35e
#   PURPOSE. See the GNU General Public License for more details.
560d35e
#
560d35e
#   You should have received a copy of the GNU General Public
560d35e
#   License along with this program; if not, write to the Free
560d35e
#   Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
560d35e
#   Boston, MA 02110-1301, USA.
560d35e
#
560d35e
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
560d35e
560d35e
# Include Beaker environment
560d35e
. /usr/share/beakerlib/beakerlib.sh || exit 1
560d35e
560d35e
PACKAGE="opencryptoki"
560d35e
UNITFILE="/usr/lib/systemd/system/pkcsslotd.service"
560d35e
560d35e
rlJournalStart
560d35e
    rlPhaseStartSetup
560d35e
        rlAssertRpm $PACKAGE
560d35e
        rlAssertExists $UNITFILE
560d35e
        rlRun "TmpDir=\$(mktemp -d)" 0 "Creating tmp directory"
560d35e
        rlRun "pushd $TmpDir"
560d35e
        rlServiceStop pkcsslotd
560d35e
    rlPhaseEnd
560d35e
560d35e
    rlPhaseStartTest
560d35e
        rlAssertGrep "PIDFile=/run/pkcsslotd.pid" $UNITFILE
560d35e
        rlServiceStart pkcsslotd
560d35e
        rlRun -s "journalctl -u pkcsslotd -S '-10s'"
0bfe651
        #rlAssertGrep "PID File created" $rlRun_LOG
560d35e
        rlAssertGrep "Started Daemon" $rlRun_LOG
560d35e
        rlAssertNotGrep "PIDFile= references a path below legacy directory" $rlRun_LOG
0bfe651
		rlAssertExists /run/pkcsslotd.pid
560d35e
    rlPhaseEnd
560d35e
560d35e
    rlPhaseStartCleanup
560d35e
        rlServiceRestore pkcsslotd
560d35e
        rlRun "popd"
560d35e
        rlRun "rm -r $TmpDir" 0 "Removing tmp directory"
560d35e
    rlPhaseEnd
2622a43
560d35e
rlJournalPrintText
560d35e
rlJournalEnd