public inbox for git-commits@fedoraproject.org
help / color / mirror / Atom feed
* [tests/selinux] pr775-checkpolicy-revdeps: kernel/labeling_before_policy_load: misc tweaks
@ 2026-09-11 13:20 Ondrej Mosnacek
  0 siblings, 0 replies; only message in thread
From: Ondrej Mosnacek @ 2026-09-11 13:20 UTC (permalink / raw)
  To: git-commits

            A new commit has been pushed.

            Repo   : tests/selinux
            Branch : pr775-checkpolicy-revdeps
            Commit : bdffd24e923f39618189a6d99db72f03405df1a7
            Author : Ondrej Mosnacek <omosnace@redhat.com>
            Date   : 2023-05-18T16:19:56+02:00
            Stats  : +24/-10 in 1 file(s)
            URL    : https://src.fedoraproject.org/tests/selinux/c/bdffd24e923f39618189a6d99db72f03405df1a7?branch=pr775-checkpolicy-revdeps

            Log:
            kernel/labeling_before_policy_load: misc tweaks

- ensure the current booted kernel is set as default
  (fixes the case where a newer kernel package has been installed since
   boot)
- add Beaker compat workaround
- add descriptions to most rlRun asserts
- run zipl also after the cleanup `dracut -f` invocation

Signed-off-by: Ondrej Mosnacek <omosnace@redhat.com>

---
diff --git a/kernel/labeling_before_policy_load/runtest.sh b/kernel/labeling_before_policy_load/runtest.sh
index 65956bf..a9ec1a5 100755
--- a/kernel/labeling_before_policy_load/runtest.sh
+++ b/kernel/labeling_before_policy_load/runtest.sh
@@ -7,16 +7,26 @@
 # Include Beakerlib environment
 . /usr/share/beakerlib/beakerlib.sh || exit 1
 
+# Beaker compat
+if [ -n "$JOBID" ] && [ -n "$TESTID" ]; then
+    function tmt-reboot() { rstrnt-reboot; }
+    TMT_REBOOT_COUNT="$REBOOTCOUNT"
+fi
+
 rlJournalStart
 if [ $TMT_REBOOT_COUNT -lt 1 ]; then
     rlPhaseStartSetup "Setup"
         rlRun "uname -r" 0 "Kernel version before reboot"
 
-        rlRun "install -d /usr/lib/dracut/modules.d/97bz1777525"
-        rlRun "install module-setup.sh relabel.sh /usr/lib/dracut/modules.d/97bz1777525"
-        rlRun "dracut --regenerate-all -f"
+        rlRun "install -d /usr/lib/dracut/modules.d/97bz1777525" 0 \
+            "Install dracut plugin directory for testing"
+        rlRun "install module-setup.sh relabel.sh /usr/lib/dracut/modules.d/97bz1777525" 0 \
+            "Install dracut plugin for testing"
+        rlRun "dracut -f" 0 "Rebuild the initramfs"
+        rlRun "grubby --set-default /boot/vmlinuz-$(uname -r)" 0 \
+            "Ensure the current booted kernel is the default"
         if command -v zipl >/dev/null; then
-            rlRun "zipl"
+            rlRun "zipl" 0 "Run zipl"
         fi
     rlPhaseEnd
 
@@ -27,20 +37,24 @@ fi
     rlPhaseEnd
 
     rlPhaseStartTest "Test"
-        # Test writing labels (BZ 1777525)
+        rlLog "Test writing labels (BZ 1777525)"
         rlRun "ls -lZ /etc/testfile"
         rlRun "ls -lZ /etc/testfile | grep -qF ':etc_t:'" 0 \
-            "/etc/testfile is labeled correctly"
+            "Test that /etc/testfile is labeled correctly"
 
-        # Test reading labels (BZ 1839819)
+        rlLog "Test reading labels (BZ 1839819)"
         rlRun "cat /etc/labeldump"
         rlAssertNotDiffer "/etc/labeldump" labeldump-expected.txt
     rlPhaseEnd
 
     rlPhaseStartCleanup
-        rlRun "rm -f /etc/labeldump /etc/testfile"
-        rlRun "rm -rf /usr/lib/dracut/modules.d/97bz1777525"
-        rlRun "dracut --regenerate-all -f"
+        rlRun "rm -f /etc/labeldump /etc/testfile" 0 "Remove test files"
+        rlRun "rm -rf /usr/lib/dracut/modules.d/97bz1777525" 0 \
+            "Remove the dracut plugin"
+        rlRun "dracut -f" 0 "Rebuild the initramfs again"
+        if command -v zipl >/dev/null; then
+            rlRun "zipl" 0 "Run zipl"
+        fi
     rlPhaseEnd
 rlJournalPrintText
 rlJournalEnd

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

only message in thread, other threads:[~2026-09-11 13:20 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:20 [tests/selinux] pr775-checkpolicy-revdeps: kernel/labeling_before_policy_load: misc tweaks Ondrej Mosnacek

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