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: run the services only if they are present
Date: Fri, 11 Sep 2026 13:22:51 GMT	[thread overview]
Message-ID: <178913297124.1.16588011561491392402.tests-selinux-03d60e2e84cd@fedoraproject.org> (raw)

            A new commit has been pushed.

            Repo   : tests/selinux
            Branch : pr775-checkpolicy-revdeps
            Commit : 03d60e2e84cd4109559d29a8b32ae3fb95dd2959
            Author : Milos Malik <mmalik@redhat.com>
            Date   : 2025-05-27T13:56:18+02:00
            Stats  : +22/-10 in 3 file(s)
            URL    : https://src.fedoraproject.org/tests/selinux/c/03d60e2e84cd4109559d29a8b32ae3fb95dd2959?branch=pr775-checkpolicy-revdeps

            Log:
            run the services only if they are present

Not all tested services are available for all architectures. Some
tests fail when they try to start/stop service which is not present.
Let's make the tests more robust.

---
diff --git a/selinux-policy/libvirt-dbus-and-similar/runtest.sh b/selinux-policy/libvirt-dbus-and-similar/runtest.sh
index 03aff21..7a87688 100755
--- a/selinux-policy/libvirt-dbus-and-similar/runtest.sh
+++ b/selinux-policy/libvirt-dbus-and-similar/runtest.sh
@@ -77,7 +77,9 @@ rlJournalStart
     fi
 
     rlPhaseStartTest "real scenario -- confined users"
-        rlRun "service virtqemud start"
+        if [ -f /usr/lib/systemd/system/virtqemud.service ] ; then
+            rlRun "service virtqemud start"
+        fi
         rlSEConfigureSSH
         rlRun "setsebool ssh_sysadm_login on"
         for SELINUX_USER in staff_u sysadm_u ; do
@@ -89,13 +91,15 @@ rlJournalStart
             rlRun "userdel -rfZ ${USER_NAME}"
         done
         rlRun "setsebool ssh_sysadm_login off"
-        rlRun "service virtqemud stop"
+        if [ -f /usr/lib/systemd/system/virtqemud.service ] ; then
+            rlRun "service virtqemud stop"
+        fi
     rlPhaseEnd
 
     if [ -f /usr/lib/systemd/system/${SERVICE_NAME}.service ] ; then
     rlPhaseStartTest "real scenario -- standalone service"
         rlSEService - ${SERVICE_NAME} ${PROCESS_NAME} ${PROCESS_CONTEXT} "start status" 1
-        rlRun "restorecon -Rv /var /run -e /var/ARTIFACTS" 0-255
+        rlRun "restorecon -Rv /etc /var /run -e /var/ARTIFACTS" 0-255
         rlSEService - ${SERVICE_NAME} ${PROCESS_NAME} ${PROCESS_CONTEXT} "restart status stop status" 1
     rlPhaseEnd
     fi

diff --git a/selinux-policy/tuned-ppd-and-similar/runtest.sh b/selinux-policy/tuned-ppd-and-similar/runtest.sh
index d228c1d..e337ae3 100755
--- a/selinux-policy/tuned-ppd-and-similar/runtest.sh
+++ b/selinux-policy/tuned-ppd-and-similar/runtest.sh
@@ -83,16 +83,20 @@ rlJournalStart
 
     if [ -f /usr/lib/systemd/system/${SERVICE_NAME}.service ] ; then
     rlPhaseStartTest "real scenario -- standalone service"
-        rlRun "service gdm start"
-        rlRun "service gdm status"
-        sleep 2
+        if [ -f /usr/lib/systemd/system/gdm.service ] ; then
+            rlRun "service gdm start"
+            rlRun "service gdm status"
+            sleep 2
+        fi
         rlSEService - ${SERVICE_NAME} ${PROCESS_NAME} ${PROCESS_CONTEXT} "start status" 1
         rlRun "busctl introspect net.hadess.PowerProfiles /org/freedesktop/UPower/PowerProfiles"
         rlRun "busctl introspect net.hadess.PowerProfiles /net/hadess/PowerProfiles"
         rlRun "restorecon -Rv /etc /run /var -e /var/ARTIFACTS" 0-255
         rlSEService - ${SERVICE_NAME} ${PROCESS_NAME} ${PROCESS_CONTEXT} "restart status stop status" 1
-        sleep 2
-        rlRun "service gdm stop"
+        if [ -f /usr/lib/systemd/system/gdm.service ] ; then
+            sleep 2
+            rlRun "service gdm stop"
+        fi
     rlPhaseEnd
     fi
 

diff --git a/selinux-policy/virt-install-additional/runtest.sh b/selinux-policy/virt-install-additional/runtest.sh
index b5de6be..b05be78 100755
--- a/selinux-policy/virt-install-additional/runtest.sh
+++ b/selinux-policy/virt-install-additional/runtest.sh
@@ -278,7 +278,9 @@ rlJournalStart
     rlPhaseEnd
 
     rlPhaseStartTest "RHEL-65266"
-        rlSESearchRule "allow virtqemud_t sysfs_t : file { write } [ ]"
+        if seinfo -a | grep -q virt_driver_domain ; then
+            rlSESearchRule "allow virtqemud_t sysfs_t : file { write } [ ]"
+        fi
         rlRun "service virtqemud start"
         rlRun "service virtnodedevd start"
         rlRun "mkdir -p devices"
@@ -301,7 +303,9 @@ rlJournalStart
     rlPhaseEnd
 
     rlPhaseStartTest "RHEL-65385"
-        rlSESearchRule "allow virtqemud_t sysfs_t : file { write } [ ]"
+        if seinfo -a | grep -q virt_driver_domain ; then
+            rlSESearchRule "allow virtqemud_t sysfs_t : file { write } [ ]"
+        fi
         if rlIsRHEL 8 ; then
             rlRun "service libvirtd start"
         fi

                 reply	other threads:[~2026-09-11 13:22 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=178913297124.1.16588011561491392402.tests-selinux-03d60e2e84cd@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