|
|
f2052de |
#!/bin/bash
|
|
|
f2052de |
# vim: dict+=/usr/share/beakerlib/dictionary.vim cpt=.,w,b,u,t,i,k
|
|
|
f2052de |
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
|
f2052de |
#
|
|
|
f2052de |
# runtest.sh of /CoreOS/selinux-policy/Sanity/policy-rpm-macros
|
|
|
f2052de |
# Description: Are necessary RPM macros defined for various policy actions?
|
|
|
f2052de |
# Author: Milos Malik <mmalik@redhat.com>
|
|
|
f2052de |
#
|
|
|
f2052de |
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
|
f2052de |
#
|
|
|
f2052de |
# Copyright (c) 2017 Red Hat, Inc.
|
|
|
f2052de |
#
|
|
|
f2052de |
# This copyrighted material is made available to anyone wishing
|
|
|
f2052de |
# to use, modify, copy, or redistribute it subject to the terms
|
|
|
f2052de |
# and conditions of the GNU General Public License version 2.
|
|
|
f2052de |
#
|
|
|
f2052de |
# This program is distributed in the hope that it will be
|
|
|
f2052de |
# useful, but WITHOUT ANY WARRANTY; without even the implied
|
|
|
f2052de |
# warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
|
|
|
f2052de |
# PURPOSE. See the GNU General Public License for more details.
|
|
|
f2052de |
#
|
|
|
f2052de |
# You should have received a copy of the GNU General Public
|
|
|
f2052de |
# License along with this program; if not, write to the Free
|
|
|
f2052de |
# Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
|
|
f2052de |
# Boston, MA 02110-1301, USA.
|
|
|
f2052de |
#
|
|
|
f2052de |
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
|
f2052de |
|
|
|
f2052de |
# Include Beaker environment
|
|
|
f2052de |
. /usr/share/beakerlib/beakerlib.sh || exit 1
|
|
|
f2052de |
|
|
|
f2052de |
PACKAGE="selinux-policy"
|
|
|
f2052de |
MACRO_FILE="/usr/lib/rpm/macros.d/macros.selinux-policy"
|
|
|
f2052de |
|
|
|
f2052de |
rlJournalStart
|
|
|
f2052de |
rlPhaseStartSetup
|
|
|
f2052de |
rlAssertRpm ${PACKAGE}
|
|
|
f2052de |
rlRun "ls -l ${MACRO_FILE}"
|
|
|
f2052de |
rlPhaseEnd
|
|
|
f2052de |
|
|
|
f2052de |
rlPhaseStartTest "Are the macros defined?"
|
|
|
f2052de |
rlRun "grep ^%selinux_modules_install ${MACRO_FILE}"
|
|
|
f2052de |
rlRun "grep ^%selinux_modules_uninstall ${MACRO_FILE}"
|
|
|
f2052de |
rlRun "grep ^%selinux_relabel_pre ${MACRO_FILE}"
|
|
|
f2052de |
rlRun "grep ^%selinux_relabel_post ${MACRO_FILE}"
|
|
|
f2052de |
rlPhaseEnd
|
|
|
f2052de |
|
|
|
f2052de |
rlPhaseStartTest "bz#1415694"
|
|
|
f2052de |
rlRun "grep selinuxenabled ${MACRO_FILE}"
|
|
|
f2052de |
rlRun "grep selinuxenabled ${MACRO_FILE} | grep _sbindir"
|
|
|
f2052de |
rlRun "grep selinuxenabled ${MACRO_FILE} | grep /usr/sbin/" 1
|
|
|
f2052de |
rlPhaseEnd
|
|
|
f2052de |
|
|
|
f2052de |
rlPhaseStartTest "download and prepare the upstream test"
|
|
|
f2052de |
rlRun "git clone https://github.com/fedora-selinux/selinux-policy-macros.git"
|
|
|
f2052de |
rlRun "rm -f selinux-policy-macros/macros.selinux-policy"
|
|
|
f2052de |
rlRun "cp /usr/lib/rpm/macros.d/macros.selinux-policy selinux-policy-macros/"
|
|
|
f2052de |
rlPhaseEnd
|
|
|
f2052de |
|
|
|
f2052de |
pushd selinux-policy-macros
|
|
|
f2052de |
# running an upstream test written by Petr Lautrbach, thanks
|
|
|
f2052de |
./runtest.sh
|
|
|
f2052de |
popd
|
|
|
f2052de |
|
|
|
f2052de |
rlPhaseStartCleanup
|
|
|
f2052de |
rlRun "rm -rf selinux-policy-macros"
|
|
|
f2052de |
rlPhaseEnd
|
|
|
f2052de |
rlJournalPrintText
|
|
|
f2052de |
rlJournalEnd
|
|
|
f2052de |
|