public inbox for git-commits@fedoraproject.org
help / color / mirror / Atom feed
From: Milos Malik <mmalik@redhat.com>
To: git-commits@fedoraproject.org
Subject: [tests/selinux] pr775-checkpolicy-revdeps: Adding the selinux-policy/policy-rpm-macros test
Date: Fri, 11 Sep 2026 13:17:17 GMT	[thread overview]
Message-ID: <178913263795.1.9231919056711257067.tests-selinux-f2052de21aca@fedoraproject.org> (raw)

            A new commit has been pushed.

            Repo   : tests/selinux
            Branch : pr775-checkpolicy-revdeps
            Commit : f2052de21acaf874f3df55057159c665ff218c49
            Author : Milos Malik <mmalik@redhat.com>
            Date   : 2018-07-31T20:46:35+02:00
            Stats  : +146/-0 in 3 file(s)
            URL    : https://src.fedoraproject.org/tests/selinux/c/f2052de21acaf874f3df55057159c665ff218c49?branch=pr775-checkpolicy-revdeps

            Log:
            Adding the selinux-policy/policy-rpm-macros test

The selinux-policy defines various macros that are used by rpm/yum.
This is a wrapper for the selinux-policy-macros test suite located on github.com.

---
diff --git a/selinux-policy/policy-rpm-macros/Makefile b/selinux-policy/policy-rpm-macros/Makefile
new file mode 100644
index 0000000..8b3eb1b
--- /dev/null
+++ b/selinux-policy/policy-rpm-macros/Makefile
@@ -0,0 +1,66 @@
+# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+#
+#   Makefile of /CoreOS/selinux-policy/Sanity/policy-rpm-macros
+#   Description: Are necessary RPM macros defined for various policy actions?
+#   Author: Milos Malik <mmalik@redhat.com>
+#
+# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+#
+#   Copyright (c) 2017 Red Hat, Inc.
+#
+#   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.
+#
+# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+export TEST=/CoreOS/selinux-policy/Sanity/policy-rpm-macros
+export TESTVERSION=1.0
+
+BUILT_FILES=
+
+FILES=$(METADATA) runtest.sh Makefile PURPOSE
+
+.PHONY: all install download clean
+
+run: $(FILES) build
+	./runtest.sh
+
+build: $(BUILT_FILES)
+	test -x runtest.sh || chmod a+x runtest.sh
+
+clean:
+	rm -f *~ $(BUILT_FILES)
+
+include /usr/share/rhts/lib/rhts-make.include
+
+$(METADATA): Makefile
+	@echo "Owner:           Milos Malik <mmalik@redhat.com>" > $(METADATA)
+	@echo "Name:            $(TEST)" >> $(METADATA)
+	@echo "TestVersion:     $(TESTVERSION)" >> $(METADATA)
+	@echo "Path:            $(TEST_DIR)" >> $(METADATA)
+	@echo "Description:     Are necessary RPM macros defined for various policy actions?" >> $(METADATA)
+	@echo "Type:            Sanity" >> $(METADATA)
+	@echo "TestTime:        15m" >> $(METADATA)
+	@echo "RunFor:          selinux-policy" >> $(METADATA)
+	@echo "Requires:        selinux-policy /usr/sbin/semanage" >> $(METADATA)
+	@echo "Priority:        Normal" >> $(METADATA)
+	@echo "License:         GPLv2" >> $(METADATA)
+	@echo "Confidential:    no" >> $(METADATA)
+	@echo "Destructive:     no" >> $(METADATA)
+	@echo "Releases:        -RHEL4 -RHEL6 -RHELClient5 -RHELServer5" >> $(METADATA)
+	@echo "Bug:             1380854" >> $(METADATA) # RHEL-7
+	@echo "Bug:             1415694" >> $(METADATA) # RHEL-7
+
+	rhts-lint $(METADATA)
+

diff --git a/selinux-policy/policy-rpm-macros/PURPOSE b/selinux-policy/policy-rpm-macros/PURPOSE
new file mode 100644
index 0000000..51cb7c0
--- /dev/null
+++ b/selinux-policy/policy-rpm-macros/PURPOSE
@@ -0,0 +1,9 @@
+PURPOSE of /CoreOS/selinux-policy/Sanity/policy-rpm-macros
+Author: Milos Malik <mmalik@redhat.com>
+
+Are necessary RPM macros defined for various policy actions? Are they defined correctly?
+
+More information at:
+ * https://plautrba.fedorapeople.org/blok/Fedora-SELinux-module-packaging.html
+ * https://github.com/fedora-selinux/selinux-policy-macros/blob/master/README.adoc
+

diff --git a/selinux-policy/policy-rpm-macros/runtest.sh b/selinux-policy/policy-rpm-macros/runtest.sh
new file mode 100755
index 0000000..b203b16
--- /dev/null
+++ b/selinux-policy/policy-rpm-macros/runtest.sh
@@ -0,0 +1,71 @@
+#!/bin/bash
+# vim: dict+=/usr/share/beakerlib/dictionary.vim cpt=.,w,b,u,t,i,k
+# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+#
+#   runtest.sh of /CoreOS/selinux-policy/Sanity/policy-rpm-macros
+#   Description: Are necessary RPM macros defined for various policy actions?
+#   Author: Milos Malik <mmalik@redhat.com>
+#
+# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+#
+#   Copyright (c) 2017 Red Hat, Inc.
+#
+#   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/bin/rhts-environment.sh || exit 1
+. /usr/share/beakerlib/beakerlib.sh || exit 1
+
+PACKAGE="selinux-policy"
+MACRO_FILE="/usr/lib/rpm/macros.d/macros.selinux-policy"
+
+rlJournalStart
+    rlPhaseStartSetup
+        rlAssertRpm ${PACKAGE}
+        rlRun "ls -l ${MACRO_FILE}"
+    rlPhaseEnd
+
+    rlPhaseStartTest "Are the macros defined?"
+        rlRun "grep ^%selinux_modules_install ${MACRO_FILE}"
+        rlRun "grep ^%selinux_modules_uninstall ${MACRO_FILE}"
+        rlRun "grep ^%selinux_relabel_pre ${MACRO_FILE}"
+        rlRun "grep ^%selinux_relabel_post ${MACRO_FILE}"
+    rlPhaseEnd
+
+    rlPhaseStartTest "bz#1415694"
+        rlRun "grep selinuxenabled ${MACRO_FILE}"
+        rlRun "grep selinuxenabled ${MACRO_FILE} | grep _sbindir"
+        rlRun "grep selinuxenabled ${MACRO_FILE} | grep /usr/sbin/" 1
+    rlPhaseEnd
+
+    rlPhaseStartTest "download and prepare the upstream test"
+        rlRun "git clone https://github.com/fedora-selinux/selinux-policy-macros.git"
+        rlRun "rm -f selinux-policy-macros/macros.selinux-policy"
+        rlRun "cp /usr/lib/rpm/macros.d/macros.selinux-policy selinux-policy-macros/"
+    rlPhaseEnd
+
+    pushd selinux-policy-macros
+    # running an upstream test written by Petr Lautrbach, thanks
+    ./runtest.sh
+    popd
+
+    rlPhaseStartCleanup
+        rlRun "rm -rf selinux-policy-macros"
+    rlPhaseEnd
+rlJournalPrintText
+rlJournalEnd
+

                 reply	other threads:[~2026-09-11 13:17 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=178913263795.1.9231919056711257067.tests-selinux-f2052de21aca@fedoraproject.org \
    --to=mmalik@redhat.com \
    --cc=git-commits@fedoraproject.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox