public inbox for git-commits@fedoraproject.org
help / color / mirror / Atom feed
* [tests/selinux] pr775-checkpolicy-revdeps: libselinux: Add new test for crond and container-selinux
@ 2026-09-11 13:18 Vit Mojzis
  0 siblings, 0 replies; only message in thread
From: Vit Mojzis @ 2026-09-11 13:18 UTC (permalink / raw)
  To: git-commits

            A new commit has been pushed.

            Repo   : tests/selinux
            Branch : pr775-checkpolicy-revdeps
            Commit : 0d078147d516b7abbf6c03aca9fb45bdbd0ef415
            Author : Vit Mojzis <vmojzis@redhat.com>
            Date   : 2020-09-28T21:09:30+02:00
            Stats  : +140/-0 in 4 file(s)
            URL    : https://src.fedoraproject.org/tests/selinux/c/0d078147d516b7abbf6c03aca9fb45bdbd0ef415?branch=pr775-checkpolicy-revdeps

            Log:
            libselinux: Add new test for crond and container-selinux

Verify that crond works properly with container-selinux installed.

---
diff --git a/libselinux/container-selinux_crond/Makefile b/libselinux/container-selinux_crond/Makefile
new file mode 100644
index 0000000..7a05428
--- /dev/null
+++ b/libselinux/container-selinux_crond/Makefile
@@ -0,0 +1,66 @@
+# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+#
+#   Makefile of /CoreOS/libselinux/Regression/container-selinux_crond
+#   Description: Does installing container-selinux break crond?
+#   Author:  Vit Mojzis <vmojzis@redhat.com>
+#
+# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+#
+#   Copyright (c) 2020 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.
+#
+# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+export TEST=/CoreOS/libselinux/Regression/container-selinux_crond
+export TESTVERSION=1.0
+
+BUILT_FILES=
+
+FILES=$(METADATA) runtest.sh Makefile
+
+.PHONY: all install download clean
+
+run: $(FILES) build
+	./runtest.sh
+
+build: $(BUILT_FILES)
+	chmod a+x runtest.sh
+	chcon -t bin_t runtest.sh
+
+clean:
+	rm -f *~ $(BUILT_FILES)
+
+include /usr/share/rhts/lib/rhts-make.include
+
+$(METADATA): Makefile
+	@echo "Owner:           Vit Mojzis <vmojzis@redhat.com>" > $(METADATA)
+	@echo "Name:            $(TEST)" >> $(METADATA)
+	@echo "TestVersion:     $(TESTVERSION)" >> $(METADATA)
+	@echo "Path:            $(TEST_DIR)" >> $(METADATA)
+	@echo "Description:     Does installing container-selinux break crond?" >> $(METADATA)
+	@echo "Type:            Regression" >> $(METADATA)
+	@echo "TestTime:        10m" >> $(METADATA)
+	@echo "RunFor:          libselinux" >> $(METADATA)
+	@echo "Requires:        cronie container-selinux libselinux-utils policycoreutils" >> $(METADATA)
+	@echo "Priority:        Normal" >> $(METADATA)
+	@echo "License:         GPLv2" >> $(METADATA)
+	@echo "Confidential:    no" >> $(METADATA)
+	@echo "Destructive:     no" >> $(METADATA)
+	@echo "Releases:        -RHEL4 -RHEL5 -RHEL6 -RHEL7" >> $(METADATA)
+	@echo "Bug:             1862823" >> $(METADATA) # RHEL-8.3
+	@echo "Bug:             1879368" >> $(METADATA) # Fedora 31
+
+	rhts-lint $(METADATA)

diff --git a/libselinux/container-selinux_crond/PURPOSE b/libselinux/container-selinux_crond/PURPOSE
new file mode 100644
index 0000000..1f27f33
--- /dev/null
+++ b/libselinux/container-selinux_crond/PURPOSE
@@ -0,0 +1,5 @@
+PURPOSE of /CoreOS/libselinux/Regression/container-selinux_crond
+Author: Vit Mojzis <vmojzis@redhat.com>
+Does installing container-selinux break crond?
+See https://bugzilla.redhat.com/show_bug.cgi?id=1862823
+and https://bugzilla.redhat.com/show_bug.cgi?id=1879368

diff --git a/libselinux/container-selinux_crond/main.fmf b/libselinux/container-selinux_crond/main.fmf
new file mode 100644
index 0000000..40f9694
--- /dev/null
+++ b/libselinux/container-selinux_crond/main.fmf
@@ -0,0 +1,2 @@
+path: /libselinux/container-selinux_crond
+tier: 2

diff --git a/libselinux/container-selinux_crond/runtest.sh b/libselinux/container-selinux_crond/runtest.sh
new file mode 100755
index 0000000..071537e
--- /dev/null
+++ b/libselinux/container-selinux_crond/runtest.sh
@@ -0,0 +1,67 @@
+#!/bin/bash
+# vim: dict=/usr/share/beakerlib/dictionary.vim cpt=.,w,b,u,t,i,k
+# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+#
+#   runtest.sh of /CoreOS/libselinux/Regression/container-selinux_crond
+#   Description: Does installing container-selinux break crond?
+#   Author:  Vit Mojzis <vmojzis@redhat.com>
+#
+# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+#
+#   Copyright (c) 2020 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/bin/rhts-environment.sh || exit 1
+. /usr/share/beakerlib/beakerlib.sh || exit 1
+
+PACKAGE="libselinux"
+
+rlJournalStart
+    rlPhaseStartSetup
+        rlAssertRpm ${PACKAGE}
+        rlAssertRpm cronie
+        rlAssertRpm container-selinux
+        rlRun "setenforce 1"
+        rlRun "sestatus"
+        OUTPUT_FILE=`mktemp`
+        rlFileBackup /etc/crontab
+    rlPhaseEnd
+
+    rlPhaseStartTest "#1879368"
+        rlRun "echo '* * * * * root date > /tmp/date' >> /etc/crontab"
+        rlRun "restorecon -v /etc/crontab"
+        rlRun "systemctl restart crond"
+        # check if crond encountered any SELinux related issues
+        rlRun "systemctl status crond | tee ${OUTPUT_FILE}"
+        rlRun "cat ${OUTPUT_FILE} | grep -i 'SELinux'" 1
+        rlRun "sleep 90"
+        rlRun "cat /tmp/date &>${OUTPUT_FILE}"
+        rlRun "sleep 90"
+        # check that the job is still running
+        rlRun "diff /tmp/date ${OUTPUT_FILE}" 1
+    rlPhaseEnd
+
+    rlPhaseStartCleanup
+        rlRun "rm -f ${OUTPUT_FILE}"
+        rlFileRestore
+        rlRun "restorecon /etc/crontab"
+        rlRun "systemctl restart crond"
+    rlPhaseEnd
+rlJournalPrintText
+rlJournalEnd

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

only message in thread, other threads:[~2026-09-11 13:18 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:18 [tests/selinux] pr775-checkpolicy-revdeps: libselinux: Add new test for crond and container-selinux Vit Mojzis

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