public inbox for git-commits@fedoraproject.org
help / color / mirror / Atom feed
* [tests/selinux] pr775-checkpolicy-revdeps: Test rpm transaction for stderr output
@ 2026-09-11 13:22 Petr Lautrbach
  0 siblings, 0 replies; only message in thread
From: Petr Lautrbach @ 2026-09-11 13:22 UTC (permalink / raw)
  To: git-commits

            A new commit has been pushed.

            Repo   : tests/selinux
            Branch : pr775-checkpolicy-revdeps
            Commit : deaf7662f4ec2c2dde737da139b055a5bcad6f10
            Author : Petr Lautrbach <lautrbach@redhat.com>
            Date   : 2024-10-18T14:48:15+00:00
            Stats  : +72/-0 in 2 file(s)
            URL    : https://src.fedoraproject.org/tests/selinux/c/deaf7662f4ec2c2dde737da139b055a5bcad6f10?branch=pr775-checkpolicy-revdeps

            Log:
            Test rpm transaction for stderr output

Commands stderr output should be hidden unless it's fatal error

Verifies: https://issues.redhat.com/browse/RHEL-59192

---
diff --git a/selinux-policy/rpm-suppress-stderr/main.fmf b/selinux-policy/rpm-suppress-stderr/main.fmf
new file mode 100644
index 0000000..9ea92b7
--- /dev/null
+++ b/selinux-policy/rpm-suppress-stderr/main.fmf
@@ -0,0 +1,17 @@
+summary: Does rpm install generate any output on stderr?
+component:
+  - selinux-policy
+require:
+  - fuse
+  - fuse-overlayfs
+  - dnf
+test: ./test.sh
+framework: beakerlib
+duration: 10m
+enabled: true
+link:
+  - https://issues.redhat.com/browse/RHEL-59192
+adjust:
+  - enabled: false
+    when: distro == rhel-4, rhel-5, rhel-6, rhel-7, rhel-8
+    continue: false

diff --git a/selinux-policy/rpm-suppress-stderr/test.sh b/selinux-policy/rpm-suppress-stderr/test.sh
new file mode 100755
index 0000000..f7432da
--- /dev/null
+++ b/selinux-policy/rpm-suppress-stderr/test.sh
@@ -0,0 +1,55 @@
+#!/bin/bash
+# vim: dict+=/usr/share/beakerlib/dictionary.vim cpt=.,w,b,u,t,i,k
+# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
+. /usr/share/beakerlib/beakerlib.sh || exit 1
+
+INSTALL_OPTION=""
+DOWNLOAD_OPTION=""
+if dnf --help | grep -q use-host-config ; then
+    INSTALL_OPTION="${INSTALL_OPTION} --use-host-config"
+fi
+if rlIsCentOS 9 ; then
+    INSTALL_OPTION="${INSTALL_OPTION} --releasever 9"
+elif rlIsFedora ; then
+    RELEASEVER=`grep VERSION_ID /etc/os-release | cut -d = -f 2`
+    INSTALL_OPTION="${INSTALL_OPTION} --releasever ${RELEASEVER}"
+fi
+DOWNLOAD_OPTION=${INSTALL_OPTION}
+# dnf sometimes fails to detect the release version on CentOS 9
+if dnf install --help | grep -q skip-broken ; then
+    INSTALL_OPTION="${INSTALL_OPTION} --skip-broken"
+fi
+if dnf install --help | grep -q skip-unavailable ; then
+    INSTALL_OPTION="${INSTALL_OPTION} --skip-unavailable"
+fi
+
+rlJournalStart
+    rlPhaseStartSetup
+        rlRun "tmp=\$(mktemp -d)" 0 "Create tmp directory"
+        rlRun "pushd $tmp"
+        rlRun "set -o pipefail"
+        rlAssertRpm fuse
+	rlAssertRpm fuse-overlayfs
+    rlPhaseEnd
+
+    rlPhaseStartTest
+	rlRun "mkdir $tmp/lower $tmp/upper $tmp/work $tmp/merged"
+	rlRun "dnf -y install --installroot=$tmp/lower diffutils libfdisk libselinux-utils libutempter policycoreutils util-linux rpm ${INSTALL_OPTION}"
+	rlRun "mkdir download"
+	rlRun "cd download"
+	rlRun "dnf download --installroot=$tmp/lower rpm-plugin-selinux selinux-policy selinux-policy-targeted ${DOWNLOAD_OPTION}"
+	rlRun "mv -v *rpm $tmp/lower"
+	rlRun "cd .."
+	rlRun "fuse-overlayfs -o lowerdir=$tmp/lower/ -o upperdir=$tmp/upper/ -o workdir=$tmp/work/ $tmp/merged/"
+	RPMS=$(ls $tmp/merged/ | grep .rpm | xargs)
+	rlRun "chroot $tmp/merged/ /usr/bin/rpm -i $RPMS 2> error.log"
+	rlAssert0 "error.log should be empty" "test -s error.log"
+	rlRun "cat error.log"
+	rlRun "fusermount -u $tmp/merged/"
+    rlPhaseEnd
+
+    rlPhaseStartCleanup
+        rlRun "popd"
+        rlRun "rm -r $tmp" 0 "Remove tmp directory"
+    rlPhaseEnd
+rlJournalEnd

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

only message in thread, other threads:[~2026-09-11 13:22 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:22 [tests/selinux] pr775-checkpolicy-revdeps: Test rpm transaction for stderr output Petr Lautrbach

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