public inbox for git-commits@fedoraproject.org
help / color / mirror / Atom feed
* [tests/selinux] pr775-checkpolicy-revdeps: Adding the selinux-policy/policy-rpm-macros test
@ 2026-09-11 13:17 Milos Malik
  0 siblings, 0 replies; only message in thread
From: Milos Malik @ 2026-09-11 13:17 UTC (permalink / raw)
  To: git-commits

            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
+

^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2026-09-11 13:17 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-09-11 13:17 [tests/selinux] pr775-checkpolicy-revdeps: Adding the selinux-policy/policy-rpm-macros test Milos Malik

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox