public inbox for git-commits@fedoraproject.org
help / color / mirror / Atom feed
* [tests/selinux] pr775-checkpolicy-revdeps: do not modify systemd services directly
@ 2026-09-11 13:23 Milos Malik
  0 siblings, 0 replies; only message in thread
From: Milos Malik @ 2026-09-11 13:23 UTC (permalink / raw)
  To: git-commits

            A new commit has been pushed.

            Repo   : tests/selinux
            Branch : pr775-checkpolicy-revdeps
            Commit : 79e29ad4216ccd322acb150b4cacf71f50c9b41f
            Author : Milos Malik <mmalik@redhat.com>
            Date   : 2026-01-27T16:48:45+01:00
            Stats  : +11/-7 in 2 file(s)
            URL    : https://src.fedoraproject.org/tests/selinux/c/79e29ad4216ccd322acb150b4cacf71f50c9b41f?branch=pr775-checkpolicy-revdeps

            Log:
            do not modify systemd services directly

When tests run in image mode, it's impossible to modify files under
/usr/lib/systemd/system because the filesystem is read-only.
Unfortunately, some tests try to do that which leads to their failures.
In order to avoid these failures, any systemd service file which
requires a modification needs to be copied to /etc/systemd/system/
directory (read-write mode) and modified there.

Purpose of this change is to increase the number of passing tests
in image mode.

---
diff --git a/selinux-policy/nvme-stas-and-similar/main.fmf b/selinux-policy/nvme-stas-and-similar/main.fmf
index 8e55c79..4b7637b 100644
--- a/selinux-policy/nvme-stas-and-similar/main.fmf
+++ b/selinux-policy/nvme-stas-and-similar/main.fmf
@@ -32,12 +32,14 @@ tag:
   - targeted
   - failinfedora
   - NoRHIVOS
+  - epel
+  - rhel10-epel
 link:
   - verifies: https://bugzilla.redhat.com/show_bug.cgi?id=2111414
   - verifies: https://issues.redhat.com/browse/RHEL-1557
 adjust+:
   - enabled: false
-    when: distro == rhel-4, rhel-5, rhel-6, rhel-7, rhel-8, centos-stream-8, rhel-10, centos-stream-10
+    when: distro == rhel-4, rhel-5, rhel-6, rhel-7, rhel-8, centos-stream-8
     because: the nvme-stas package is not available there
 extra-summary: /CoreOS/selinux-policy/Regression/nvme-stas-and-similar
 extra-task: /CoreOS/selinux-policy/Regression/nvme-stas-and-similar

diff --git a/selinux-policy/nvme-stas-and-similar/runtest.sh b/selinux-policy/nvme-stas-and-similar/runtest.sh
index 029512f..ba83928 100755
--- a/selinux-policy/nvme-stas-and-similar/runtest.sh
+++ b/selinux-policy/nvme-stas-and-similar/runtest.sh
@@ -44,8 +44,6 @@ rlJournalStart
 
         rlServiceStart avahi-daemon
         rlServiceStop stacd stafd
-        rlFileBackup /usr/lib/systemd/system/stacd.service
-        rlFileBackup /usr/lib/systemd/system/stafd.service
 
         rlSESetEnforce
         rlSEStatus
@@ -91,9 +89,11 @@ rlJournalStart
         for CUR_FILE in /usr/lib/systemd/system/stacd.service \
             /usr/lib/systemd/system/stafd.service ; do
             if grep -q '^ExecStart=.*python' ${CUR_FILE} ; then
-                rlRun "sed -i 's|^ExecStart=.*python.* /|ExecStart=/|' ${CUR_FILE}"
+                rlRun "cp -f ${CUR_FILE} /etc/systemd/system/"
+                COPIED_FILE=`echo ${CUR_FILE} | sed 's|/usr/lib|/etc|'`
+                rlRun "sed -i 's|^ExecStart=.*python.* /|ExecStart=/|' ${COPIED_FILE}"
                 rlRun "systemctl daemon-reload"
-                rlRun "grep '^ExecStart=' ${CUR_FILE}"
+                rlRun "grep '^ExecStart=' ${COPIED_FILE}"
             fi
         done
         if ! rlSEDefined ${PROCESS_CONTEXT} ; then
@@ -112,7 +112,7 @@ rlJournalStart
         rlRun "stasadm -v"
         rlRun "stasadm hostid"
         rlRun "stasadm hostnqn"
-        rlRun "restorecon -Rv /var /run -e /var/ARTIFACTS" 0-255
+        rlRun "restorecon -Rv /etc /var /run -e /var/ARTIFACTS" 0-255
         rlSEService - stacd stacd ${PROCESS_CONTEXT} "restart status stop status" 1
         rlSEService - stafd stafd ${PROCESS_CONTEXT} "restart status stop status" 1
     rlPhaseEnd
@@ -121,7 +121,9 @@ rlJournalStart
         sleep 2
         rlSECheckAVC
 
-        rlFileRestore
+        rlRun "rm -f /etc/systemd/system/stacd.service"
+        rlRun "rm -f /etc/systemd/system/stafd.service"
+        rlRun "systemctl daemon-reload"
         rlServiceRestore stacd stafd
     rlPhaseEnd
 rlJournalPrintText

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

only message in thread, other threads:[~2026-09-11 13:23 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:23 [tests/selinux] pr775-checkpolicy-revdeps: do not modify systemd services directly Milos Malik

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