public inbox for git-commits@fedoraproject.org
help / color / mirror / Atom feed
From: Jan Zarsky <jzarsky@redhat.com>
To: git-commits@fedoraproject.org
Subject: [tests/selinux] pr775-checkpolicy-revdeps: test switching booleans
Date: Fri, 11 Sep 2026 13:17:18 GMT [thread overview]
Message-ID: <178913263894.1.7561915449586059549.tests-selinux-26ce71b3c81c@fedoraproject.org> (raw)
A new commit has been pushed.
Repo : tests/selinux
Branch : pr775-checkpolicy-revdeps
Commit : 26ce71b3c81c93da31e6697c29f3e9566549c7f5
Author : Jan Zarsky <jzarsky@redhat.com>
Date : 2018-07-31T21:42:40+02:00
Stats : +170/-0 in 4 file(s)
URL : https://src.fedoraproject.org/tests/selinux/c/26ce71b3c81c93da31e6697c29f3e9566549c7f5?branch=pr775-checkpolicy-revdeps
Log:
test switching booleans
The test defines its own booleans and tests setting it on and off using
setsebool and semanage boolean.
---
diff --git a/policycoreutils/booleans/Makefile b/policycoreutils/booleans/Makefile
new file mode 100644
index 0000000..d75b96c
--- /dev/null
+++ b/policycoreutils/booleans/Makefile
@@ -0,0 +1,63 @@
+# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+#
+# Makefile of /CoreOS/policycoreutils/Sanity/booleans
+# Description: Basic operations with booleans
+# Author: Jan Zarsky <jzarsky@redhat.com>
+#
+# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+#
+# Copyright (c) 2018 Red Hat, Inc.
+#
+# This program is free software: you can redistribute it and/or
+# modify it under the terms of the GNU General Public License as
+# published by the Free Software Foundation, either version 2 of
+# the License, or (at your option) any later version.
+#
+# 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, see http://www.gnu.org/licenses/.
+#
+# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+export TEST=/CoreOS/policycoreutils/Sanity/booleans
+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)
+ test -x runtest.sh || chmod a+x runtest.sh
+
+clean:
+ rm -f *~ $(BUILT_FILES)
+
+
+include /usr/share/rhts/lib/rhts-make.include
+
+$(METADATA): Makefile
+ @echo "Owner: Jan Zarsky <jzarsky@redhat.com>" > $(METADATA)
+ @echo "Name: $(TEST)" >> $(METADATA)
+ @echo "TestVersion: $(TESTVERSION)" >> $(METADATA)
+ @echo "Path: $(TEST_DIR)" >> $(METADATA)
+ @echo "Description: Basic operations with booleans" >> $(METADATA)
+ @echo "Type: Sanity" >> $(METADATA)
+ @echo "TestTime: 5m" >> $(METADATA)
+ @echo "RunFor: policycoreutils" >> $(METADATA)
+ @echo "Requires: policycoreutils" >> $(METADATA)
+ @echo "Priority: Normal" >> $(METADATA)
+ @echo "License: GPLv2+" >> $(METADATA)
+ @echo "Confidential: no" >> $(METADATA)
+ @echo "Destructive: no" >> $(METADATA)
+ @echo "Releases: -RHEL4 -RHELClient5 -RHELServer5 -RHEL6" >> $(METADATA)
+
+ rhts-lint $(METADATA)
diff --git a/policycoreutils/booleans/PURPOSE b/policycoreutils/booleans/PURPOSE
new file mode 100644
index 0000000..b349afc
--- /dev/null
+++ b/policycoreutils/booleans/PURPOSE
@@ -0,0 +1,3 @@
+PURPOSE of /CoreOS/policycoreutils/Sanity/booleans
+Description: Basic operations with booleans
+Author: Jan Zarsky <jzarsky@redhat.com>
diff --git a/policycoreutils/booleans/main.fmf b/policycoreutils/booleans/main.fmf
new file mode 100644
index 0000000..5cbbf41
--- /dev/null
+++ b/policycoreutils/booleans/main.fmf
@@ -0,0 +1,7 @@
+path: /policycoreutils/booleans
+summary: Test basic operations with booleans
+description: |
+ The test defines its own booleans and tests setting it on and off
+ using setsebool and semanage boolean.
+relevancy:
+ - "distro = rhel-4, rhel-5, rhel-6: False"
diff --git a/policycoreutils/booleans/runtest.sh b/policycoreutils/booleans/runtest.sh
new file mode 100755
index 0000000..925d3d9
--- /dev/null
+++ b/policycoreutils/booleans/runtest.sh
@@ -0,0 +1,97 @@
+#!/bin/bash
+# vim: dict+=/usr/share/beakerlib/dictionary.vim cpt=.,w,b,u,t,i,k
+# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+#
+# runtest.sh of /CoreOS/policycoreutils/Sanity/booleans
+# Description: Basic operations with booleans
+# Author: Jan Zarsky <jzarsky@redhat.com>
+#
+# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+#
+# Copyright (c) 2018 Red Hat, Inc.
+#
+# This program is free software: you can redistribute it and/or
+# modify it under the terms of the GNU General Public License as
+# published by the Free Software Foundation, either version 2 of
+# the License, or (at your option) any later version.
+#
+# 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, see http://www.gnu.org/licenses/.
+#
+# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+# Include Beaker environment
+. /usr/bin/rhts-environment.sh || exit 1
+. /usr/share/beakerlib/beakerlib.sh || exit 1
+
+PACKAGE="policycoreutils"
+
+rlJournalStart
+ rlPhaseStartSetup
+ rlAssertRpm $PACKAGE
+
+ cat << EOF >test_module.cil
+(boolean test_bool_on true)
+(boolean test_bool_off false)
+EOF
+ rlRun "semodule -i test_module.cil"
+
+ BOOL_ON=test_bool_on
+ BOOL_OFF=test_bool_off
+ rlPhaseEnd
+
+ rlPhaseStartTest "listing"
+ rlRun "semanage boolean -l >stdout"
+
+ rlRun "grep -E '$BOOL_ON *\(on , on\) ' stdout"
+ rlRun "grep -E '$BOOL_OFF *\(off , off\) ' stdout"
+
+ rlRun "getsebool -a >stdout"
+
+ rlRun "grep 'test_bool_on --> on' stdout"
+ rlRun "grep 'test_bool_off --> off' stdout"
+
+ rlRun "getsebool $BOOL_ON | grep '$BOOL_ON --> on'"
+ rlRun "getsebool $BOOL_OFF | grep '$BOOL_OFF --> off'"
+ rlPhaseEnd
+
+ rlPhaseStartTest "setting"
+ # temporary via setsebool
+ rlRun "getsebool $BOOL_ON | grep '$BOOL_ON --> on'"
+
+ rlRun "setsebool $BOOL_ON off"
+ rlRun "getsebool $BOOL_ON | grep '$BOOL_ON --> off'"
+
+ rlRun "setsebool $BOOL_ON on"
+ rlRun "getsebool $BOOL_ON | grep '$BOOL_ON --> on'"
+
+ # permanent via setsebool
+ rlRun "getsebool $BOOL_ON | grep '$BOOL_ON --> on'"
+
+ rlRun "setsebool -P $BOOL_ON off"
+ rlRun "getsebool $BOOL_ON | grep '$BOOL_ON --> off'"
+
+ rlRun "setsebool -P $BOOL_ON on"
+ rlRun "getsebool $BOOL_ON | grep '$BOOL_ON --> on'"
+
+ # permanent via semanage boolean
+ rlRun "semanage boolean -m $BOOL_ON --off"
+ rlRun "getsebool $BOOL_ON | grep '$BOOL_ON --> off'"
+ rlRun "semanage boolean -l -C | grep -E '$BOOL_ON *\(off , off\) '"
+
+ rlRun "semanage boolean -m $BOOL_ON --on"
+ rlRun "getsebool $BOOL_ON | grep '$BOOL_ON --> on'"
+ rlRun "semanage boolean -l -C | grep -E '$BOOL_ON *\(on , on\) '"
+ rlPhaseEnd
+
+ rlPhaseStartCleanup
+ rlRun "semodule -r test_module"
+ rlRun "rm stdout test_module.cil"
+ rlPhaseEnd
+rlJournalPrintText
+rlJournalEnd
reply other threads:[~2026-09-11 13:17 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=178913263894.1.7561915449586059549.tests-selinux-26ce71b3c81c@fedoraproject.org \
--to=jzarsky@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