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: add important downstream tests to upstream repo
Date: Fri, 11 Sep 2026 13:21:36 GMT	[thread overview]
Message-ID: <178913289605.1.2501176772703855509.tests-selinux-7f4c2828eb41@fedoraproject.org> (raw)

            A new commit has been pushed.

            Repo   : tests/selinux
            Branch : pr775-checkpolicy-revdeps
            Commit : 7f4c2828eb419846e392d4c4e8209a2994ded442
            Author : Milos Malik <mmalik@redhat.com>
            Date   : 2024-04-19T17:26:05+02:00
            Stats  : +600/-0 in 8 file(s)
            URL    : https://src.fedoraproject.org/tests/selinux/c/7f4c2828eb419846e392d4c4e8209a2994ded442?branch=pr775-checkpolicy-revdeps

            Log:
            add important downstream tests to upstream repo

To improve the quality of upstream testing, some important
downstream tests are moved to the upstream repository.

---
diff --git a/setools/seinfo/Makefile b/setools/seinfo/Makefile
new file mode 100644
index 0000000..0a3d589
--- /dev/null
+++ b/setools/seinfo/Makefile
@@ -0,0 +1,78 @@
+# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+#
+#   Makefile of /CoreOS/setools/Sanity/seinfo
+#   Description: Does seinfo work well? Does it support all features?
+#   Author: Milos Malik <mmalik@redhat.com>
+#
+# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+#
+#   Copyright (c) 2010 Red Hat, Inc. All rights reserved.
+#
+#   This copyrighted material is made available to anyone wishing
+#   to use, modify, copy, or redistribute it subject to the terms
+#   and conditions of the GNU General Public License version 2.
+#
+#   This program is distributed in the hope that it will be
+#   useful, but WITHOUT ANY WARRANTY; without even the implied
+#   warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+#   PURPOSE. See the GNU General Public License for more details.
+#
+#   You should have received a copy of the GNU General Public
+#   License along with this program; if not, write to the Free
+#   Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+#   Boston, MA 02110-1301, USA.
+#
+# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+export TEST=/CoreOS/setools/Sanity/seinfo
+export TESTVERSION=1.0
+
+BUILT_FILES=
+
+FILES=$(METADATA) runtest.sh Makefile PURPOSE
+
+.PHONY: all install download clean
+
+run: $(FILES) build
+	./runtest.sh
+
+build: $(BUILT_FILES)
+	chmod a+x runtest.sh
+	chcon -t bin_t runtest.sh
+
+clean:
+	rm -f *~ $(BUILT_FILES)
+
+include /usr/share/rhts/lib/rhts-make.include
+
+$(METADATA): Makefile
+	@echo "Owner:           Milos Malik <mmalik@redhat.com>" > $(METADATA)
+	@echo "Name:            $(TEST)" >> $(METADATA)
+	@echo "TestVersion:     $(TESTVERSION)" >> $(METADATA)
+	@echo "Path:            $(TEST_DIR)" >> $(METADATA)
+	@echo "Description:     Does seinfo work well? Does it support all features?" >> $(METADATA)
+	@echo "Type:            Sanity" >> $(METADATA)
+	@echo "TestTime:        20m" >> $(METADATA)
+	@echo "RunFor:          setools" >> $(METADATA)
+	@echo "Requires:        setools" >> $(METADATA)
+	@echo "Requires:        setools-console" >> $(METADATA)
+	@echo "Requires:        selinux-policy" >> $(METADATA)
+	@echo "Requires:        selinux-policy-targeted" >> $(METADATA)
+	@echo "Requires:        grep" >> $(METADATA)
+	@echo "Requires:        diffutils" >> $(METADATA)
+	@echo "RhtsRequires:    library(selinux-policy/common)" >> $(METADATA)
+	@echo "Priority:        Normal" >> $(METADATA)
+	@echo "License:         GPLv2" >> $(METADATA)
+	@echo "Confidential:    no" >> $(METADATA)
+	@echo "Destructive:     no" >> $(METADATA)
+	@echo "Releases:        -RHEL4" >> $(METADATA)
+	@echo "Bug:             499247" >> $(METADATA) # Fedora
+	@echo "Bug:             584286" >> $(METADATA) # RHEL-5
+	@echo "Bug:             649699" >> $(METADATA) # RHEL-5
+	@echo "Bug:             650092" >> $(METADATA) # RHEL-6
+	@echo "Bug:             739628" >> $(METADATA) # RHEL-6
+	@echo "Bug:             928705" >> $(METADATA) # RHEL-7
+	@echo "Bug:             1581761" >> $(METADATA) # RHEL-8
+
+	rhts-lint $(METADATA)
+

diff --git a/setools/seinfo/PURPOSE b/setools/seinfo/PURPOSE
new file mode 100644
index 0000000..206824a
--- /dev/null
+++ b/setools/seinfo/PURPOSE
@@ -0,0 +1,5 @@
+PURPOSE of /CoreOS/setools/Sanity/seinfo
+Author: Milos Malik <mmalik@redhat.com>
+
+Does seinfo work well? Does it support all features?
+

diff --git a/setools/seinfo/main.fmf b/setools/seinfo/main.fmf
new file mode 100644
index 0000000..ad77582
--- /dev/null
+++ b/setools/seinfo/main.fmf
@@ -0,0 +1,49 @@
+summary: Does seinfo work well? Does it support all features?
+description: |+
+    Does seinfo work well? Does it support all features?
+
+contact: Milos Malik <mmalik@redhat.com>
+component:
+  - setools
+test: ./runtest.sh
+framework: beakerlib
+require:
+  - library(selinux-policy/common)
+recommend:
+  - setools
+  - setools-console
+  - selinux-policy
+  - selinux-policy-targeted
+  - grep
+  - diffutils
+duration: 20m
+enabled: true
+tag:
+  - NoRHEL4
+  - TIPpass_Security
+  - Tier1
+  - Tier1se
+  - TipWaived5
+  - TipWaived6
+  - f31friendly
+  - f32friendly
+  - failinrhel8ci
+  - targeted
+tier: '1'
+link:
+  - relates: https://bugzilla.redhat.com/show_bug.cgi?id=499247
+  - relates: https://bugzilla.redhat.com/show_bug.cgi?id=584286
+  - relates: https://bugzilla.redhat.com/show_bug.cgi?id=649699
+  - relates: https://bugzilla.redhat.com/show_bug.cgi?id=650092
+  - relates: https://bugzilla.redhat.com/show_bug.cgi?id=739628
+  - relates: https://bugzilla.redhat.com/show_bug.cgi?id=928705
+  - relates: https://bugzilla.redhat.com/show_bug.cgi?id=1581761
+  - relates: https://bugzilla.redhat.com/show_bug.cgi?id=920981
+  - relates: https://bugzilla.redhat.com/show_bug.cgi?id=1581848
+adjust:
+  - enabled: false
+    when: distro == rhel-4
+    continue: false
+extra-nitrate: TC#0067249
+extra-summary: /CoreOS/setools/Sanity/seinfo
+extra-task: /CoreOS/setools/Sanity/seinfo

diff --git a/setools/seinfo/runtest.sh b/setools/seinfo/runtest.sh
new file mode 100755
index 0000000..05cf002
--- /dev/null
+++ b/setools/seinfo/runtest.sh
@@ -0,0 +1,199 @@
+#!/bin/bash
+# vim: dict=/usr/share/beakerlib/dictionary.vim cpt=.,w,b,u,t,i,k
+# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+#
+#   runtest.sh of /CoreOS/setools/Sanity/seinfo
+#   Description: Does seinfo work well? Does it support all features?
+#   Author: Milos Malik <mmalik@redhat.com>
+#
+# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+#
+#   Copyright (c) 2010 Red Hat, Inc. All rights reserved.
+#
+#   This copyrighted material is made available to anyone wishing
+#   to use, modify, copy, or redistribute it subject to the terms
+#   and conditions of the GNU General Public License version 2.
+#
+#   This program is distributed in the hope that it will be
+#   useful, but WITHOUT ANY WARRANTY; without even the implied
+#   warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+#   PURPOSE. See the GNU General Public License for more details.
+#
+#   You should have received a copy of the GNU General Public
+#   License along with this program; if not, write to the Free
+#   Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+#   Boston, MA 02110-1301, USA.
+#
+# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+# Include rhts environment
+. /usr/share/beakerlib/beakerlib.sh || exit 1
+
+PACKAGE="setools"
+
+rlJournalStart
+    rlPhaseStartSetup
+        rlRun "rlImport 'selinux-policy/common'"
+        if rlIsRHEL 5 ; then
+            rlAssertRpm ${PACKAGE}
+        else
+            rlAssertRpm ${PACKAGE}-console
+        fi
+        rlAssertRpm selinux-policy
+        rlAssertRpm selinux-policy-targeted
+        SHORT_OUTPUT=`mktemp`
+        LONG_OUTPUT=`mktemp`
+    rlPhaseEnd
+
+    if seinfo --version | grep -q '3\.3' ; then
+    rlPhaseStartTest "bz#499247 + bz#584286"
+        rlRun "seinfo"
+        rlRun "seinfo --version"
+        rlRun "seinfo --stats"
+        for CLASS in "capability" ; do
+            rlRun "SIMPLE_COUNT=\`seinfo -c${CLASS} | wc -l\`"
+            rlAssertEquals "the output without details should 1 line long" ${SIMPLE_COUNT} 1
+            rlRun "EXPANDED_COUNT=\`seinfo -x -c${CLASS} | wc -l\`"
+            rlAssertGreater "the output with details should be more than 1 line long" ${EXPANDED_COUNT} 1
+        done
+
+        for TYPE in "root_t" ; do
+            rlRun "SIMPLE_COUNT=\`seinfo -t${TYPE} | wc -l\`"
+            rlAssertEquals "the output without details should 1 line long" ${SIMPLE_COUNT} 1
+            rlRun "EXPANDED_COUNT=\`seinfo -x -t${TYPE} | wc -l\`"
+            rlAssertGreater "the output with details should be more than 1 line long" ${EXPANDED_COUNT} 1
+        done
+
+        if ! rlIsRHEL 5 ; then
+            ATTRIBUTE="domain"
+        else
+            ATTRIBUTE="@ttr0135"
+        fi
+        rlRun "SIMPLE_COUNT=\`seinfo -a${ATTRIBUTE} | wc -l\`"
+        rlAssertEquals "the output without details should 1 line long" ${SIMPLE_COUNT} 1
+        rlRun "EXPANDED_COUNT=\`seinfo -x -a${ATTRIBUTE} | wc -l\`"
+        rlAssertGreater "the output with details should be more than 1 line long" ${EXPANDED_COUNT} 1
+
+        for ROLE in "sysadm_r" ; do
+            rlRun "SIMPLE_COUNT=\`seinfo -r${ROLE} | wc -l\`"
+            rlAssertEquals "the output without details should 1 line long" ${SIMPLE_COUNT} 1
+            rlRun "EXPANDED_COUNT=\`seinfo -x -r${ROLE} | wc -l\`"
+            rlAssertGreater "the output with details should be more than 1 line long" ${EXPANDED_COUNT} 1
+        done
+
+        for USER in "root" ; do
+            rlRun "SIMPLE_COUNT=\`seinfo -u${USER} | wc -l\`"
+            rlAssertEquals "the output without details should 1 line long" ${SIMPLE_COUNT} 1
+            rlRun "EXPANDED_COUNT=\`seinfo -x -u${USER} | wc -l\`"
+            rlAssertGreater "the output with details should be more than 1 line long" ${EXPANDED_COUNT} 1
+        done
+
+        for BOOLEAN in "ftpd_connect_db" ; do
+            rlRun "SIMPLE_COUNT=\`seinfo -b${BOOLEAN} | wc -c\`"
+            rlAssertGreater "the output without details should be short" ${SIMPLE_COUNT} 10
+            rlRun "EXPANDED_COUNT=\`seinfo -x -b${BOOLEAN} | wc -c\`"
+            rlAssertGreater "the output with details should be longer" ${EXPANDED_COUNT} ${SIMPLE_COUNT}
+        done
+
+        if rlIsRHEL 5 ; then
+            for OPTION_PAIR in \
+            "-c|--classes" \
+            "-t|--types" \
+            "-a|--attribs" \
+            "-r|--roles" \
+            "-u|--users" \
+            "-b|--boolean" \
+            "-S|--sensitivities" \
+            "-C|--categories" \
+            "-f|--fs_use" \
+            "-g|--genfscon" \
+            "-n|--netifcon" \
+            "-o|--nodecon" \
+            "-p|--portcon" \
+            "-i|--initialsid" ; do
+                SHORT_OPTION=`echo ${OPTION_PAIR} | cut -d '|' -f 1`
+                rlRun "seinfo ${SHORT_OPTION} >& ${SHORT_OUTPUT}"
+                LONG_OPTION=`echo ${OPTION_PAIR} | cut -d '|' -f 2`
+                rlRun "seinfo ${LONG_OPTION} >& ${LONG_OUTPUT}"
+                rlRun "diff ${SHORT_OUTPUT} ${LONG_OUTPUT} >& /dev/null"
+            done
+        else
+            for OPTION_PAIR in \
+            "-c|--class" \
+            "-t|--type" \
+            "-a|--attribute" \
+            "-r|--role" \
+            "-u|--user" \
+            "-b|--bool" ; do
+                SHORT_OPTION=`echo ${OPTION_PAIR} | cut -d '|' -f 1`
+                rlRun "seinfo ${SHORT_OPTION} >& ${SHORT_OUTPUT}"
+                LONG_OPTION=`echo ${OPTION_PAIR} | cut -d '|' -f 2`
+                rlRun "seinfo ${LONG_OPTION} >& ${LONG_OUTPUT}"
+                rlRun "diff ${SHORT_OUTPUT} ${LONG_OUTPUT} >& /dev/null"
+            done
+        fi
+    rlPhaseEnd
+    fi
+
+    if false ; then # both bugs were closed as WONTFIX
+    rlPhaseStartTest "bz#649699 + bz#650092"
+        for SHORT_OPTION in "-c" "-t" "-a" "-r" "-u" "-b" ; do
+            rlRun "seinfo ${SHORT_OPTION}xyz" 1-255
+        done
+        for LONG_OPTION in "--class" "--sensitivity" "--category" "--type" "--attribute" \
+            "--role" "--user" "--bool" "--constrain" "--initialsid" "--fs_use" "--genfscon" \
+            "--netifcon" "--nodecon" "--all" "--portcon --protocol" "--expand" "--stats" \
+            "--version" "--help"; do
+            rlRun "seinfo ${LONG_OPTION}=xyz" 1-255
+        done
+    rlPhaseEnd
+    fi
+
+    rlPhaseStartTest "bz#739628"
+        rlRun "seinfo -r | grep -v -e Roles: -e _r$ -e ^$" 1
+        rlRun "seinfo -u | grep -v -e Users: -e _u$ -e ^$ -e root$" 1
+        rlRun "seinfo -t | grep -v -e Types: -e _t$ -e ^$" 1
+    rlPhaseEnd
+
+    if ! rlIsRHEL 5 6 ; then
+    rlPhaseStartTest "bz#928705 + bz#1581761"
+        rlRun "seinfo -tspamc_t -x | grep -i alias"
+        rlRun "seinfo -tspamc_t -x | grep spamc_t"
+        rlRun "seinfo -tspamc_t -x | grep spamassassin_t"
+        rlRun "seinfo -tspamassassin_t -x | grep -i alias"
+        rlRun "seinfo -tspamassassin_t -x | grep spamassassin_t"
+        rlRun "seinfo -tspamassassin_t -x | grep -i spamc_t"
+    rlPhaseEnd
+    fi
+
+    rlPhaseStartTest "bz#1029837"
+        # there is a difference when seinfo analyzes the policy file stored under /etc/selinux and the active policy stored in the SELinux file-system
+        if rlIsRHEL 5 6 ; then
+            SELINUX_FS="/selinux"
+        else
+            SELINUX_FS="/sys/fs/selinux"
+        fi
+        rlRun "seinfo ${SELINUX_FS}/policy"
+        for POLICY_TYPE in minimum mls targeted ; do
+            if [ -f /etc/selinux/${POLICY_TYPE}/policy/policy.* ] ; then
+                rlRun "seinfo /etc/selinux/${POLICY_TYPE}/policy/policy.*"
+            fi
+        done
+    rlPhaseEnd
+
+    if seinfo --version | grep '^4\.' ; then
+    rlPhaseStartTest "additional v.4 features in comparison to v.3"
+        for OPTION in "common" "default" "typebounds" "validatetrans" ; do
+            rlRun "seinfo --${OPTION}"
+            rlRun "seinfo --${OPTION} | grep -i ${OPTION}"
+        done
+    rlPhaseEnd
+    fi
+
+    rlPhaseStartCleanup
+        rm -f ${SHORT_OUTPUT}
+        rm -f ${LONG_OUTPUT}
+    rlPhaseEnd
+    rlJournalPrintText
+rlJournalEnd
+

diff --git a/setools/sesearch/Makefile b/setools/sesearch/Makefile
new file mode 100644
index 0000000..93c7504
--- /dev/null
+++ b/setools/sesearch/Makefile
@@ -0,0 +1,77 @@
+# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+#
+#   Makefile of /CoreOS/setools/Sanity/sesearch
+#   Description: Does sesearch work well? Does it support all features?
+#   Author: Milos Malik <mmalik@redhat.com>
+#
+# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+#
+#   Copyright (c) 2009 Red Hat, Inc. All rights reserved.
+#
+#   This copyrighted material is made available to anyone wishing
+#   to use, modify, copy, or redistribute it subject to the terms
+#   and conditions of the GNU General Public License version 2.
+#
+#   This program is distributed in the hope that it will be
+#   useful, but WITHOUT ANY WARRANTY; without even the implied
+#   warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+#   PURPOSE. See the GNU General Public License for more details.
+#
+#   You should have received a copy of the GNU General Public
+#   License along with this program; if not, write to the Free
+#   Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+#   Boston, MA 02110-1301, USA.
+#
+# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+export TEST=/CoreOS/setools/Sanity/sesearch
+export TESTVERSION=1.0
+
+BUILT_FILES=
+
+FILES=$(METADATA) runtest.sh Makefile PURPOSE
+
+.PHONY: all install download clean
+
+run: $(FILES) build
+	./runtest.sh
+
+build: $(BUILT_FILES)
+	chmod a+x runtest.sh
+	chcon -t bin_t runtest.sh
+
+clean:
+	rm -f *~ $(BUILT_FILES)
+
+include /usr/share/rhts/lib/rhts-make.include
+
+$(METADATA): Makefile
+	@echo "Owner:           Milos Malik <mmalik@redhat.com>" > $(METADATA)
+	@echo "Name:            $(TEST)" >> $(METADATA)
+	@echo "TestVersion:     $(TESTVERSION)" >> $(METADATA)
+	@echo "Path:            $(TEST_DIR)" >> $(METADATA)
+	@echo "Description:     Does sesearch work well? Does it support all features?" >> $(METADATA)
+	@echo "Type:            Sanity" >> $(METADATA)
+	@echo "TestTime:        15m" >> $(METADATA)
+	@echo "RunFor:          setools" >> $(METADATA)
+	@echo "Requires:        setools-console" >> $(METADATA)
+	@echo "Requires:        python3-setools" >> $(METADATA)
+	@echo "Requires:        selinux-policy" >> $(METADATA)
+	@echo "Requires:        selinux-policy-targeted" >> $(METADATA)
+	@echo "Priority:        Normal" >> $(METADATA)
+	@echo "License:         GPLv2" >> $(METADATA)
+	@echo "Confidential:    no" >> $(METADATA)
+	@echo "Destructive:     no" >> $(METADATA)
+	@echo "Releases:        -RHEL4" >> $(METADATA)
+	@echo "Bug:             526460" >> $(METADATA) # Fedora 11
+	@echo "Bug:             583915" >> $(METADATA) # RHEL-6
+	@echo "Bug:             602166" >> $(METADATA) # RHEL-6
+	@echo "Bug:             649711" >> $(METADATA) # RHEL-5
+	@echo "Bug:             650094" >> $(METADATA) # RHEL-6
+	@echo "Bug:             836213" >> $(METADATA) # RHEL-7
+	@echo "Bug:             924588" >> $(METADATA) # RHEL-7
+	@echo "Bug:             1029837" >> $(METADATA) # RHEL-7
+	@echo "Bug:             1595582" >> $(METADATA) # RHEL-8
+
+	rhts-lint $(METADATA)
+

diff --git a/setools/sesearch/PURPOSE b/setools/sesearch/PURPOSE
new file mode 100644
index 0000000..9524a62
--- /dev/null
+++ b/setools/sesearch/PURPOSE
@@ -0,0 +1,5 @@
+PURPOSE of /CoreOS/setools/Sanity/sesearch
+Author: Milos Malik <mmalik@redhat.com>
+
+Does sesearch work well? Does it support all features?
+

diff --git a/setools/sesearch/main.fmf b/setools/sesearch/main.fmf
new file mode 100644
index 0000000..ae36e4b
--- /dev/null
+++ b/setools/sesearch/main.fmf
@@ -0,0 +1,46 @@
+summary: Does sesearch work well? Does it support all features?
+description: |+
+    Does sesearch work well? Does it support all features?
+
+contact: Milos Malik <mmalik@redhat.com>
+component:
+  - setools
+test: ./runtest.sh
+framework: beakerlib
+recommend:
+  - setools-console
+  - python3-setools
+  - selinux-policy
+  - selinux-policy-targeted
+duration: 15m
+enabled: true
+tag:
+  - NoRHEL4
+  - TIPpass_Security
+  - Tier1
+  - Tier1se
+  - TierCandidatesFAIL
+  - TipWaived7
+  - f32friendly
+  - f33friendly
+  - targeted
+tier: '1'
+link:
+  - relates: https://bugzilla.redhat.com/show_bug.cgi?id=526460
+  - relates: https://bugzilla.redhat.com/show_bug.cgi?id=583915
+  - relates: https://bugzilla.redhat.com/show_bug.cgi?id=602166
+  - relates: https://bugzilla.redhat.com/show_bug.cgi?id=649711
+  - relates: https://bugzilla.redhat.com/show_bug.cgi?id=650094
+  - relates: https://bugzilla.redhat.com/show_bug.cgi?id=836213
+  - relates: https://bugzilla.redhat.com/show_bug.cgi?id=924588
+  - relates: https://bugzilla.redhat.com/show_bug.cgi?id=1029837
+  - relates: https://bugzilla.redhat.com/show_bug.cgi?id=1595582
+  - relates: https://bugzilla.redhat.com/show_bug.cgi?id=920981
+  - relates: https://bugzilla.redhat.com/show_bug.cgi?id=1595572
+adjust:
+  - enabled: false
+    when: distro == rhel-4
+    continue: false
+extra-nitrate: TC#0062271
+extra-summary: /CoreOS/setools/Sanity/sesearch
+extra-task: /CoreOS/setools/Sanity/sesearch

diff --git a/setools/sesearch/runtest.sh b/setools/sesearch/runtest.sh
new file mode 100755
index 0000000..feb7a22
--- /dev/null
+++ b/setools/sesearch/runtest.sh
@@ -0,0 +1,141 @@
+#!/bin/bash
+# vim: dict=/usr/share/beakerlib/dictionary.vim cpt=.,w,b,u,t,i,k
+# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+#
+#   runtest.sh of /CoreOS/setools/Sanity/sesearch
+#   Description: Does sesearch work well? Does it support all features?
+#   Author: Milos Malik <mmalik@redhat.com>
+#
+# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+#
+#   Copyright (c) 2009 Red Hat, Inc. All rights reserved.
+#
+#   This copyrighted material is made available to anyone wishing
+#   to use, modify, copy, or redistribute it subject to the terms
+#   and conditions of the GNU General Public License version 2.
+#
+#   This program is distributed in the hope that it will be
+#   useful, but WITHOUT ANY WARRANTY; without even the implied
+#   warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+#   PURPOSE. See the GNU General Public License for more details.
+#
+#   You should have received a copy of the GNU General Public
+#   License along with this program; if not, write to the Free
+#   Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+#   Boston, MA 02110-1301, USA.
+#
+# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+# Include rhts environment
+. /usr/share/beakerlib/beakerlib.sh
+
+PACKAGE="setools"
+
+rlJournalStart
+    rlPhaseStartSetup
+        if rlIsRHEL 5 ; then
+            rlAssertRpm ${PACKAGE}
+        elif rlIsRHEL 6 7 ; then
+            rlAssertRpm ${PACKAGE}-libs
+            rlAssertRpm ${PACKAGE}-console
+        else
+            rlAssertRpm ${PACKAGE}-console
+        fi
+    rlPhaseEnd
+
+    if rlIsRHEL '<=7' ; then
+    rlPhaseStartTest "Records counting"
+        if rlIsRHEL 5 6 ; then
+            rlRun "MAX_COUNT=\`sesearch --all | wc -l\`"
+        else
+            rlRun "MAX_COUNT=\`sesearch --allow --auditallow --dontaudit --type --role_allow --role_trans --range_trans | wc -l\`"
+        fi
+        if rlIsRHEL 5 ; then
+            for PARAM in "allow" "neverallow" "audit" "role_trans" "type" ; do
+                rlRun "FULL_COUNT=\`sesearch --${PARAM} | wc -l\`"
+                rlRun "echo \${FULL_COUNT}"
+                rlRun "FILTERED_COUNT=\`sesearch --${PARAM} | grep ${PARAM} | wc -l\`"
+                rlRun "echo \${FILTERED_COUNT}"
+                rlAssertGreaterOrEqual "the difference must be between 0 and 2" 2 $((FULL_COUNT - FILTERED_COUNT))
+                rlAssertGreaterOrEqual "the difference must be between 0 and 2" $((FULL_COUNT - FILTERED_COUNT)) 0
+                rlAssertGreaterOrEqual "number of all rules must be greater or equal to this number" ${MAX_COUNT} ${FULL_COUNT}
+            done
+
+            rlRun "FULL_COUNT=\`sesearch --rangetrans | wc -l\`"
+            rlRun "echo \${FULL_COUNT}"
+            rlRun "FILTERED_COUNT=\`sesearch --rangetrans | grep range_trans | wc -l\`"
+            rlRun "echo \${FILTERED_COUNT}"
+            rlAssertGreaterOrEqual "the difference must be between 0 and 2" 2 $((FULL_COUNT - FILTERED_COUNT))
+            rlAssertGreaterOrEqual "the difference must be between 0 and 2" $((FULL_COUNT - FILTERED_COUNT)) 0
+            rlAssertGreaterOrEqual "number of all rules must be greater or equal to this number" ${MAX_COUNT} ${FULL_COUNT}
+        else
+            for PARAM in "allow" "neverallow" "auditallow" "dontaudit" "range_trans" "role_trans" "type" ; do
+                rlRun "FULL_COUNT=\`sesearch --${PARAM} | grep -v -e 'Found ' -e '^$' | wc -l\`"
+                rlRun "echo \${FULL_COUNT}"
+                rlRun "FILTERED_COUNT=\`sesearch --${PARAM} | grep -v -e 'Found ' -e '^$' | grep ${PARAM} | wc -l\`"
+                rlRun "echo \${FILTERED_COUNT}"
+                rlAssertEquals "these 2 numbers should be equal" ${FULL_COUNT} ${FILTERED_COUNT}
+                rlAssertGreater "number of all rules must be greater than any of these numbers" ${MAX_COUNT} ${FULL_COUNT}
+            done
+        fi
+
+        rlRun "FULL_COUNT=\`sesearch --role_allow | wc -l\`"
+        rlRun "echo \${FULL_COUNT}"
+        rlRun "FILTERED_COUNT=\`sesearch --role_allow | grep allow | wc -l\`"
+        rlRun "echo \${FILTERED_COUNT}"
+        rlAssertGreaterOrEqual "the difference must be between 0 and 2" 2 $((FULL_COUNT - FILTERED_COUNT))
+        rlAssertGreaterOrEqual "the difference must be between 0 and 2" $((FULL_COUNT - FILTERED_COUNT)) 0
+        rlAssertGreaterOrEqual "number of all rules must be greater or equal to this number" ${MAX_COUNT} ${FULL_COUNT}
+    rlPhaseEnd
+    fi
+
+    rlPhaseStartTest "bz#649711 + bz#650094 + bz#924588"
+        rlLog "All three bugs were closed as WONTFIX, so this phase was commented out"
+        #for SHORT_OPTION in "-s" "-t" "-c" ; do
+            #rlRun "sesearch -A ${SHORT_OPTION} xxx" 1-255
+        #done
+
+        #for LONG_OPTION in "--source" "--target" "--class" ; do
+            #rlRun "sesearch --allow ${LONG_OPTION}=xxx" 1-255
+        #done
+    rlPhaseEnd
+
+    if rlIsRHEL '<=7' ; then
+    rlPhaseStartTest "bz#836213"
+        rlRun "sesearch -s ipsec_t -t ipsec_mgmt_t -c process --allow 2>&1 | grep -i \"found .* av rules\""
+        rlRun "sesearch -s ipsec_t -t ipsec_mgmt_t -c process --dontaudit 2>&1 | grep -i \"found .* av rules\""
+        rlRun "sesearch -s ipsec_t -t ipsec_mgmt_t -c process --all 2>&1 | grep -i \"found .* av rules\""
+    rlPhaseEnd
+    fi
+
+    rlPhaseStartTest "bz#1029837"
+        if rlIsRHEL 5 6 ; then
+            SELINUX_FS="/selinux"
+        else
+            SELINUX_FS="/sys/fs/selinux"
+        fi
+        rlRun "sesearch -T ${SELINUX_FS}/policy >/dev/null"
+        for POLICY_TYPE in minimum mls targeted ; do
+            if [ -f /etc/selinux/${POLICY_TYPE}/policy/policy.* ] ; then
+                rlRun "sesearch -T /etc/selinux/${POLICY_TYPE}/policy/policy.* >/dev/null"
+            fi
+        done
+    rlPhaseEnd
+
+    rlPhaseStartTest "bz#1595582"
+        REFERENCE_FILE=`mktemp`
+        OUTPUT_FILE=`mktemp`
+        REAL_TYPE="spamc_home_t"
+        rlRun "sesearch -t ${REAL_TYPE} --allow --dontaudit --auditallow | sort > ${REFERENCE_FILE}"
+        for ALIAS in spamassassin_home_t pyzor_home_t razor_home_t ; do
+            rlRun "sesearch -t ${ALIAS} --allow --dontaudit --auditallow | sort > ${OUTPUT_FILE}"
+            rlRun "diff ${REFERENCE_FILE} ${OUTPUT_FILE}"
+        done
+        rm -f ${REFERENCE_FILE} ${OUTPUT_FILE}
+    rlPhaseEnd
+
+    rlPhaseStartCleanup
+    rlPhaseEnd
+    rlJournalPrintText
+rlJournalEnd
+

                 reply	other threads:[~2026-09-11 13:21 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=178913289605.1.2501176772703855509.tests-selinux-7f4c2828eb41@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