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: do not modify systemd services directly
Date: Fri, 11 Sep 2026 13:23:31 GMT	[thread overview]
Message-ID: <178913301105.1.1508470094263865930.tests-selinux-79e29ad4216c@fedoraproject.org> (raw)

            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

                 reply	other threads:[~2026-09-11 13:23 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=178913301105.1.1508470094263865930.tests-selinux-79e29ad4216c@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