From b6ec2fee8d1cf35c356fa2bde6820f6f5cfebefd Mon Sep 17 00:00:00 2001 From: Milos Malik Date: Mon, 16 Jan 2023 14:21:00 +0100 Subject: [PATCH] test if sepolicy manpage can generate manpage in HTML form The sepolicy tool can generate man pages for specific SELinux domains. When the sepolicy tool was instructed to generate man pages in HTML form (--web), the generated HTML files were very incomplete. The TC reproduces the situation. The newly added TC checks if the sepolicy manpage command works correctly. The checks related to the sepolicy manpage command were removed from the sepolicy-generate TC. The TC covers BZ#1989840. --- policycoreutils/sepolicy-generate/runtest.sh | 8 +----- policycoreutils/sepolicy-manpage/main.fmf | 19 ++++++++++++++ policycoreutils/sepolicy-manpage/runtest.sh | 27 ++++++++++++++++++++ 3 files changed, 47 insertions(+), 7 deletions(-) create mode 100644 policycoreutils/sepolicy-manpage/main.fmf create mode 100755 policycoreutils/sepolicy-manpage/runtest.sh diff --git a/policycoreutils/sepolicy-generate/runtest.sh b/policycoreutils/sepolicy-generate/runtest.sh index e51e519..f79213f 100755 --- a/policycoreutils/sepolicy-generate/runtest.sh +++ b/policycoreutils/sepolicy-generate/runtest.sh @@ -106,16 +106,10 @@ rlJournalStart rlRun "rm -rf mypolicy" rlPhaseEnd - rlPhaseStartTest "sepolicy manpage --web, bz1854639" - rlRun "sepolicy manpage --web -d zebra_t" - rlRun "ls /tmp/*release*" 0 "Html file with OS name exists." - rlRun "cat /tmp/*release* > /tmp/testfile" - rlAssertGrep "href=zebra.html" "/tmp/testfile" - rlPhaseEnd - rlPhaseStartCleanup rlRun "popd" rlRun "rm -r $TmpDir" 0 "Removing tmp directory" rlPhaseEnd rlJournalPrintText rlJournalEnd + diff --git a/policycoreutils/sepolicy-manpage/main.fmf b/policycoreutils/sepolicy-manpage/main.fmf new file mode 100644 index 0000000..eae4499 --- /dev/null +++ b/policycoreutils/sepolicy-manpage/main.fmf @@ -0,0 +1,19 @@ +summary: sepolicy manpage sanity test +description: Does the sepolicy manpage command work correctly? +contact: Milos Malik +component: + - policycoreutils +framework: beakerlib +recommend: + - /usr/bin/sepolicy +duration: 10m +enabled: true +tier: 3 +link: + - verifies: https://bugzilla.redhat.com/show_bug.cgi?id=1854639 + - verifies: https://bugzilla.redhat.com/show_bug.cgi?id=1989840 +adjust: + - enabled: false + when: distro == rhel-4, rhel-5, rhel-6 + because: the sepolicy command is not available there + diff --git a/policycoreutils/sepolicy-manpage/runtest.sh b/policycoreutils/sepolicy-manpage/runtest.sh new file mode 100755 index 0000000..32c12a3 --- /dev/null +++ b/policycoreutils/sepolicy-manpage/runtest.sh @@ -0,0 +1,27 @@ +#!/bin/bash +# vim: dict+=/usr/share/beakerlib/dictionary.vim cpt=.,w,b,u,t,i,k +. /usr/share/beakerlib/beakerlib.sh || exit 1 + +rlJournalStart + rlPhaseStartSetup + rlRun "rpm -qa | grep policycoreutils" + rlPhaseEnd + + rlPhaseStartTest "sepolicy manpage --web, bz#1854639 + bz#1989840" + rlRun "sepolicy manpage --web -d zebra_t" + if rlIsRHEL 7 8 ; then + rlRun "ls -l /tmp/*release*" 0 "Html file with OS name exists." + rlRun "cat /tmp/*release* > /tmp/testfile" + else + rlRun "ls -l /tmp/index.html" 0 "HTML file exists" + rlRun "cat /tmp/index.html > /tmp/testfile" + fi + rlAssertGrep "href=zebra.html" "/tmp/testfile" + rlRun "ls -l /tmp/zebra.html" + rlPhaseEnd + + rlPhaseStartCleanup + rlRun "rm -f /tmp/zebra* /tmp/index.html /tmp/*release*" + rlPhaseEnd +rlJournalEnd +