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

            A new commit has been pushed.

            Repo   : tests/selinux
            Branch : pr775-checkpolicy-revdeps
            Commit : f0693a3d135df164369302fc552ff371c5974b34
            Author : Milos Malik <mmalik@redhat.com>
            Date   : 2020-12-01T18:36:45+00:00
            Stats  : +5/-4 in 1 file(s)
            URL    : https://src.fedoraproject.org/tests/selinux/c/f0693a3d135df164369302fc552ff371c5974b34?branch=pr775-checkpolicy-revdeps

            Log:
            introduce a variable which skips systemd-sleep services

The automated TC contains a phase where services systemd-hybrid-sleep
and systemd-hibernate are started for testing purposes. Unfortunately,
running these services had real consequences on machines in certain
environments where the TC was executed (for example: machines became
unresponsive).
To have some control of the situation, a new environment variable was
introduced. It is called REAL_SCENARIOS and it can avoid the situation
when set to false. Default value of the variable is true which means
that above-mentioned services will be executed.

---
diff --git a/selinux-policy/swap-file-and-systemd-access/runtest.sh b/selinux-policy/swap-file-and-systemd-access/runtest.sh
index fbebe5b..d7af11e 100755
--- a/selinux-policy/swap-file-and-systemd-access/runtest.sh
+++ b/selinux-policy/swap-file-and-systemd-access/runtest.sh
@@ -30,12 +30,11 @@
 . /usr/share/beakerlib/beakerlib.sh || exit 1
 
 PACKAGE="selinux-policy"
+REAL_SCENARIOS=${REAL_SCENARIOS:-true}
 
 rlJournalStart
-    if rlIsFedora "<34" || rlIsRHEL "<8.4" ; then
-        rlLog "Not applicable to this system version."
-        rlJournalEnd
-        exit 0
+    if ! seinfo -t | grep -q systemd_sleep ; then
+        rlDie "Not applicable to this SELinux policy version."
     fi
 
     rlPhaseStartSetup
@@ -74,6 +73,7 @@ rlJournalStart
         rlSESearchRule "allow systemd_logind_t swapfile_t : file { getattr open read ioctl } [ ]"
     rlPhaseEnd
 
+    if ${REAL_SCENARIOS} ; then
     rlPhaseStartTest "real scenario"
         rlRun "rm -f /swapfile"
         rlRun "dd if=/dev/zero of=/swapfile bs=1M count=256"
@@ -98,6 +98,7 @@ rlJournalStart
         rlRun "free"
         rlRun "rm -f /swapfile"
     rlPhaseEnd
+    fi
 
     rlPhaseStartCleanup
         sleep 2

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

only message in thread, other threads:[~2026-09-11 13:18 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:18 [tests/selinux] pr775-checkpolicy-revdeps: introduce a variable which skips systemd-sleep services Milos Malik

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