public inbox for git-commits@fedoraproject.org
help / color / mirror / Atom feed
* [tests/selinux] pr775-checkpolicy-revdeps: fix tests which fail or cause other tests to fail
@ 2026-09-11 13:22 Milos Malik
  0 siblings, 0 replies; only message in thread
From: Milos Malik @ 2026-09-11 13:22 UTC (permalink / raw)
  To: git-commits

            A new commit has been pushed.

            Repo   : tests/selinux
            Branch : pr775-checkpolicy-revdeps
            Commit : dbbbfb5d2c528039438b3e25f569bb375267dd75
            Author : Milos Malik <mmalik@redhat.com>
            Date   : 2025-03-05T10:42:13+01:00
            Stats  : +26/-8 in 11 file(s)
            URL    : https://src.fedoraproject.org/tests/selinux/c/dbbbfb5d2c528039438b3e25f569bb375267dd75?branch=pr775-checkpolicy-revdeps

            Log:
            fix tests which fail or cause other tests to fail

The modified tests used to fail on RHEL-10 or they caused other tests
to fail on RHEL-10. The reasons are various:
 * dependency on SELinux types which are no longer defined
 * insufficient test cleanup
 * unexpected exit codes
 * virtual vs. bare metal environment differences

These problems should be fixed now.

---
diff --git a/policycoreutils/sepolicy-manpage/main.fmf b/policycoreutils/sepolicy-manpage/main.fmf
index a342f92..107bf51 100644
--- a/policycoreutils/sepolicy-manpage/main.fmf
+++ b/policycoreutils/sepolicy-manpage/main.fmf
@@ -6,6 +6,7 @@ component:
 framework: beakerlib
 recommend:
   - /usr/bin/sepolicy
+  - setools-console
 duration: 1h
 enabled: true
 tier: 3

diff --git a/policycoreutils/sepolicy-manpage/runtest.sh b/policycoreutils/sepolicy-manpage/runtest.sh
index 6fe835a..5c0f22b 100755
--- a/policycoreutils/sepolicy-manpage/runtest.sh
+++ b/policycoreutils/sepolicy-manpage/runtest.sh
@@ -17,7 +17,12 @@ rlJournalStart
     rlPhaseEnd
 
     rlPhaseStartTest "sepolicy manpage --web, bz#1854639 + bz#1989840"
-        rlRun "sepolicy manpage --web -d zebra_t"
+        if seinfo -a domain -x | grep -q zebra ; then
+            DOMAIN_PREFIX="zebra"
+        else
+            DOMAIN_PREFIX="xserver"
+        fi
+        rlRun "sepolicy manpage --web -d ${DOMAIN_PREFIX}_t"
         if rlIsRHEL 7 8 || rlIsCentOS 7 8 ; then
             rlRun "ls -l /tmp/*release*" 0 "Html file with OS name exists."
             rlRun "cat /tmp/*release* > /tmp/testfile"
@@ -25,12 +30,12 @@ rlJournalStart
             rlRun "ls -l /tmp/index.html" 0 "HTML file exists"
             rlRun "cat /tmp/index.html > /tmp/testfile"
         fi
-        rlAssertGrep "href=zebra.html" "/tmp/testfile"
-        rlRun "ls -l /tmp/zebra.html"
+        rlAssertGrep "href=${DOMAIN_PREFIX}.html" "/tmp/testfile"
+        rlRun "ls -l /tmp/${DOMAIN_PREFIX}.html"
     rlPhaseEnd
 
     rlPhaseStartCleanup
-        rlRun "rm -f /tmp/zebra* /tmp/index.html /tmp/*release*"
+        rlRun "rm -f /tmp/${DOMAIN_PREFIX}* /tmp/index.html /tmp/*release*"
     rlPhaseEnd
 rlJournalEnd
 

diff --git a/selinux-policy/boothd-and-similar/runtest.sh b/selinux-policy/boothd-and-similar/runtest.sh
index 213acb1..ad7948e 100755
--- a/selinux-policy/boothd-and-similar/runtest.sh
+++ b/selinux-policy/boothd-and-similar/runtest.sh
@@ -100,6 +100,7 @@ rlJournalStart
         sleep 2
         rlSECheckAVC
         rlFileRestore
+        rlRun "service systemd-machined stop"
         rlServiceRestore ${SERVICE_NAME}
     rlPhaseEnd
 rlJournalPrintText

diff --git a/selinux-policy/cockpit-ws-and-similar/runtest.sh b/selinux-policy/cockpit-ws-and-similar/runtest.sh
index 9ee500c..e111a41 100755
--- a/selinux-policy/cockpit-ws-and-similar/runtest.sh
+++ b/selinux-policy/cockpit-ws-and-similar/runtest.sh
@@ -111,7 +111,7 @@ rlJournalStart
 
     rlPhaseStartTest "bz#1413509"
         rlSEMatchPathCon "/usr/libexec/cockpit-ws" "cockpit_ws_exec_t"
-        rlSEMatchPathCon "/usr/libexec/cockpit-ssh" "cockpit_session_exec_t"
+        rlSEMatchPathCon "/usr/libexec/cockpit-session" "cockpit_session_exec_t"
         rlSEMatchPathCon "/var/lib/cockpit" "cockpit_var_lib_t"
         rlSEMatchPortCon tcp 22 ssh_port_t
         rlSESearchRule "allow cockpit_ws_t cockpit_session_exec_t : file { getattr open read execute }"

diff --git a/selinux-policy/firewalld-and-similar/runtest.sh b/selinux-policy/firewalld-and-similar/runtest.sh
index 58d6f4f..df7586f 100755
--- a/selinux-policy/firewalld-and-similar/runtest.sh
+++ b/selinux-policy/firewalld-and-similar/runtest.sh
@@ -75,10 +75,12 @@ rlJournalStart
         done
     rlPhaseEnd
 
+    if rlSEDefined "puppetagent_t" ; then
     rlPhaseStartTest "bz#1214853"
         rlSESearchRule "allow firewalld_t puppetagent_t : dbus { send_msg }"
         rlSESearchRule "allow puppetagent_t firewalld_t : dbus { send_msg }"
     rlPhaseEnd
+    fi
 
     rlPhaseStartTest "bz#1221326"
         rlSESearchRule "allow firewalld_t openshift_initrc_t : dbus { send_msg }"

diff --git a/selinux-policy/install-uninstall-dsp-packages/main.fmf b/selinux-policy/install-uninstall-dsp-packages/main.fmf
index 84dcf79..7fee6cc 100644
--- a/selinux-policy/install-uninstall-dsp-packages/main.fmf
+++ b/selinux-policy/install-uninstall-dsp-packages/main.fmf
@@ -28,6 +28,8 @@ tag:
   - failinfedora
   - targeted
   - NoRHIVOS
+  - rhel9_broken
+  - rhel10_broken
 link:
 adjust:
   - enabled: false

diff --git a/selinux-policy/pcm-sensor-server-and-similar/Makefile b/selinux-policy/pcm-sensor-server-and-similar/Makefile
index df8f7dc..09892d4 100644
--- a/selinux-policy/pcm-sensor-server-and-similar/Makefile
+++ b/selinux-policy/pcm-sensor-server-and-similar/Makefile
@@ -55,7 +55,7 @@ $(METADATA): Makefile
 	@echo "TestTime:        10m" >> $(METADATA)
 	@echo "RunFor:          pcm" >> $(METADATA)
 	@echo "RunFor:          selinux-policy" >> $(METADATA)
-	@echo "Requires:        audit libselinux libselinux-utils policycoreutils selinux-policy selinux-policy-targeted setools-console pcm /usr/sbin/service" >> $(METADATA)
+	@echo "Requires:        audit libselinux libselinux-utils policycoreutils selinux-policy selinux-policy-targeted setools-console pcm /usr/sbin/service virt-what" >> $(METADATA)
 	@echo "RhtsRequires:    library(selinux-policy/common)" >> $(METADATA)
 	@echo "Environment:     AVC_ERROR=+no_avc_check" >> $(METADATA)
 	@echo "Priority:        Normal" >> $(METADATA)

diff --git a/selinux-policy/pcm-sensor-server-and-similar/main.fmf b/selinux-policy/pcm-sensor-server-and-similar/main.fmf
index 4abbd17..3476274 100644
--- a/selinux-policy/pcm-sensor-server-and-similar/main.fmf
+++ b/selinux-policy/pcm-sensor-server-and-similar/main.fmf
@@ -18,6 +18,7 @@ recommend:
   - setools-console
   - pcm
   - /usr/sbin/service
+  - virt-what
 environment:
     AVC_ERROR: +no_avc_check
 duration: 10m

diff --git a/selinux-policy/pcm-sensor-server-and-similar/runtest.sh b/selinux-policy/pcm-sensor-server-and-similar/runtest.sh
index 8bcf9a3..eab7a09 100755
--- a/selinux-policy/pcm-sensor-server-and-similar/runtest.sh
+++ b/selinux-policy/pcm-sensor-server-and-similar/runtest.sh
@@ -63,6 +63,11 @@ rlJournalStart
         sleep 2
     rlPhaseEnd
 
+    rm -f output.txt
+    virt-what >& output.txt
+    if [ -s output.txt ] ; then
+        echo "Running on a virtual machine -- ${SERVICE_NAME} does not like that"
+    else
     rlPhaseStartTest "real scenario -- standalone service"
         rlSEService - ${SERVICE_NAME} ${PROCESS_NAME} ${PROCESS_CONTEXT} "start status" 1
         rlRun "pcm-iio 1.0 -i=1"
@@ -73,6 +78,7 @@ rlJournalStart
         rlRun "pcm-lspci"
         rlSEService - ${SERVICE_NAME} ${PROCESS_NAME} ${PROCESS_CONTEXT} "stop status" 1
     rlPhaseEnd
+    fi
 
     rlPhaseStartCleanup
         sleep 2

diff --git a/selinux-policy/systemd-modules-load-and-similar/runtest.sh b/selinux-policy/systemd-modules-load-and-similar/runtest.sh
index 9288bb6..8b7172c 100755
--- a/selinux-policy/systemd-modules-load-and-similar/runtest.sh
+++ b/selinux-policy/systemd-modules-load-and-similar/runtest.sh
@@ -124,7 +124,7 @@ rlJournalStart
     rlPhaseStartTest "bz#1942267"
         tst_Time="$(date '+%T')"
         # Install kernel-module matching the running kernel version
-        rlRun "dnf -y install kernel-modules-$(uname -r)"
+        rlRun "dnf -y install kernel-modules-$(uname -r)" 0,1
         rlRun "systemctl start rdma-load-modules@rdma.service"
         rlRun "systemctl status rdma-load-modules@rdma.service"
         rlRun "lsmod | grep rdma"

diff --git a/selinux-policy/virt-install-additional/runtest.sh b/selinux-policy/virt-install-additional/runtest.sh
index 8773acf..ccb456f 100755
--- a/selinux-policy/virt-install-additional/runtest.sh
+++ b/selinux-policy/virt-install-additional/runtest.sh
@@ -33,7 +33,7 @@ PACKAGE="selinux-policy"
 
 rlJournalStart
     rlPhaseStartSetup
-        rlRun "rlImport 'selinux-policy/common'"
+        rlRun "rlImport 'selinux-policy/common'" 0,1
         rlSESatisfyRequires
         rlAssertRpm ${PACKAGE}
         rlAssertRpm ${PACKAGE}-targeted

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

only message in thread, other threads:[~2026-09-11 13:22 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:22 [tests/selinux] pr775-checkpolicy-revdeps: fix tests which fail or cause other tests to fail Milos Malik

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