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: avoid testing empty CIL modules
Date: Fri, 11 Sep 2026 13:19:25 GMT	[thread overview]
Message-ID: <178913276545.1.9526032188172032276.tests-selinux-37adc8484f60@fedoraproject.org> (raw)

            A new commit has been pushed.

            Repo   : tests/selinux
            Branch : pr775-checkpolicy-revdeps
            Commit : 37adc8484f605fb6ec13bd0e31e932eb86cb1202
            Author : Milos Malik <mmalik@redhat.com>
            Date   : 2021-10-07T14:24:29+02:00
            Stats  : +20/-2 in 2 file(s)
            URL    : https://src.fedoraproject.org/tests/selinux/c/37adc8484f605fb6ec13bd0e31e932eb86cb1202?branch=pr775-checkpolicy-revdeps

            Log:
            avoid testing empty CIL modules

SELinux user-space of version 3.3 and higher does not support loading
of empty CIL modules. If such version is installed, one of the test
phases will be skipped.

---
diff --git a/policycoreutils/CIL-modules-without-compilation/Makefile b/policycoreutils/CIL-modules-without-compilation/Makefile
index 2d8a660..a16e88d 100644
--- a/policycoreutils/CIL-modules-without-compilation/Makefile
+++ b/policycoreutils/CIL-modules-without-compilation/Makefile
@@ -53,7 +53,7 @@ $(METADATA): Makefile
 	@echo "Type:            Sanity" >> $(METADATA)
 	@echo "TestTime:        5m" >> $(METADATA)
 	@echo "RunFor:          policycoreutils" >> $(METADATA)
-	@echo "Requires:        policycoreutils" >> $(METADATA)
+	@echo "Requires:        /usr/sbin/semodule /usr/sbin/semanage" >> $(METADATA)
 	@echo "Priority:        Normal" >> $(METADATA)
 	@echo "License:         GPLv2" >> $(METADATA)
 	@echo "Confidential:    no" >> $(METADATA)

diff --git a/policycoreutils/CIL-modules-without-compilation/runtest.sh b/policycoreutils/CIL-modules-without-compilation/runtest.sh
index 451461a..a121c58 100755
--- a/policycoreutils/CIL-modules-without-compilation/runtest.sh
+++ b/policycoreutils/CIL-modules-without-compilation/runtest.sh
@@ -31,14 +31,18 @@
 . /usr/share/beakerlib/beakerlib.sh || exit 1
 
 PACKAGE="policycoreutils"
+PACKAGE_VERSION=`rpm -q --queryformat '%{version}' ${PACKAGE}`
 
 rlJournalStart
     rlPhaseStartSetup
         rlAssertRpm $PACKAGE
         rlRun "echo '()' > empty.cil"
+        rlRun "echo '( auditallow init_t security_t ( security ( setsecparam )))' > valid.cil"
         rlRun "echo '(())' > invalid.cil"
     rlPhaseEnd
 
+    # version 3.3 of SELinux user-space does not accept empty CIL module
+    if echo "${PACKAGE_VERSION} < 3.3" | bc | grep -q 1 ; then
     rlPhaseStartTest "empty CIL module"
         rlRun "semodule -lfull | grep '400.*empty.*cil'" 1
         rlRun "semodule -i empty.cil"
@@ -51,6 +55,20 @@ rlJournalStart
         rlRun "semanage module -r empty"
         rlRun "semanage module -l | grep 'empty.*400.*cil'" 1
     rlPhaseEnd
+    fi
+
+    rlPhaseStartTest "valid CIL module"
+        rlRun "semodule -lfull | grep '400.*valid.*cil'" 1
+        rlRun "semodule -i valid.cil"
+        rlRun "semodule -lfull | grep '400.*valid.*cil'"
+        rlRun "semodule -r valid"
+        rlRun "semodule -lfull | grep '400.*valid.*cil'" 1
+        rlRun "semanage module -l | grep 'valid.*400.*cil'" 1
+        rlRun "semanage module -a valid.cil"
+        rlRun "semanage module -l | grep 'valid.*400.*cil'"
+        rlRun "semanage module -r valid"
+        rlRun "semanage module -l | grep 'valid.*400.*cil'" 1
+    rlPhaseEnd
 
     rlPhaseStartTest "invalid CIL module"
         rlRun "semodule -lfull | grep '400.*invalid.*cil'" 1
@@ -66,7 +84,7 @@ rlJournalStart
     rlPhaseEnd
 
     rlPhaseStartCleanup
-        rlRun "rm -f empty.cil invalid.cil"
+        rlRun "rm -f empty.cil valid.cil invalid.cil"
     rlPhaseEnd
 rlJournalPrintText
 rlJournalEnd

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

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-11 13:19 Milos Malik [this message]
2026-09-11 13:20 [tests/selinux] pr775-checkpolicy-revdeps: avoid testing empty CIL modules Zdenek Pytela

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=178913276545.1.9526032188172032276.tests-selinux-37adc8484f60@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