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: skip the policy which is not installed
Date: Fri, 11 Sep 2026 13:19:06 GMT	[thread overview]
Message-ID: <178913274692.1.494758370708695907.tests-selinux-28aaa75dde48@fedoraproject.org> (raw)

            A new commit has been pushed.

            Repo   : tests/selinux
            Branch : pr775-checkpolicy-revdeps
            Commit : 28aaa75dde48779df78ffec408732e0f215c7339
            Author : Milos Malik <mmalik@redhat.com>
            Date   : 2021-05-14T10:00:47+02:00
            Stats  : +10/-6 in 2 file(s)
            URL    : https://src.fedoraproject.org/tests/selinux/c/28aaa75dde48779df78ffec408732e0f215c7339?branch=pr775-checkpolicy-revdeps

            Log:
            skip the policy which is not installed

The TC expected that all SELinux policies are installed before the
TC is executed. If some of them is not installed, one of the test
phases failed.
Now, the test phase checks if particular policy is installed before
calling the D-bus interface on it.

---
diff --git a/policycoreutils/org-selinux-dbus-interfaces/Makefile b/policycoreutils/org-selinux-dbus-interfaces/Makefile
index 92c8af6..6756710 100644
--- a/policycoreutils/org-selinux-dbus-interfaces/Makefile
+++ b/policycoreutils/org-selinux-dbus-interfaces/Makefile
@@ -63,3 +63,4 @@ $(METADATA): Makefile
 	@echo "Bug:             1754873" >> $(METADATA) # RHEL-8
 
 	rhts-lint $(METADATA)
+

diff --git a/policycoreutils/org-selinux-dbus-interfaces/runtest.sh b/policycoreutils/org-selinux-dbus-interfaces/runtest.sh
index 458c695..14779a5 100755
--- a/policycoreutils/org-selinux-dbus-interfaces/runtest.sh
+++ b/policycoreutils/org-selinux-dbus-interfaces/runtest.sh
@@ -91,13 +91,16 @@ rlJournalStart
     rlPhaseEnd
 
     rlPhaseStartTest "org.selinux.change_default_policy"
+        # 1 argument is missing
         rlRun "dbus-send --system --print-reply --dest=org.selinux /org/selinux/object org.selinux.change_default_policy" 1
-        rlRun "dbus-send --system --print-reply --dest=org.selinux /org/selinux/object org.selinux.change_default_policy string:minimum"
-        rlRun "grep SELINUXTYPE=minimum /etc/selinux/config"
-        rlRun "dbus-send --system --print-reply --dest=org.selinux /org/selinux/object org.selinux.change_default_policy string:mls"
-        rlRun "grep SELINUXTYPE=mls /etc/selinux/config"
-        rlRun "dbus-send --system --print-reply --dest=org.selinux /org/selinux/object org.selinux.change_default_policy string:targeted"
-        rlRun "grep SELINUXTYPE=targeted /etc/selinux/config"
+        # test existing policies
+        for POLICY_KIND in minimum mls targeted ; do
+            if rpm -q selinux-policy-${POLICY_KIND} ; then
+                rlRun "dbus-send --system --print-reply --dest=org.selinux /org/selinux/object org.selinux.change_default_policy string:${POLICY_KIND}"
+                rlRun "grep SELINUXTYPE=${POLICY_KIND} /etc/selinux/config"
+            fi
+        done
+        # test a non-existent policy
         rlRun "dbus-send --system --print-reply --dest=org.selinux /org/selinux/object org.selinux.change_default_policy string:xyz" 1
     rlPhaseEnd
 

                 reply	other threads:[~2026-09-11 13:19 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=178913274692.1.494758370708695907.tests-selinux-28aaa75dde48@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