public inbox for git-commits@fedoraproject.org
help / color / mirror / Atom feed
* [tests/selinux] pr775-checkpolicy-revdeps: test switching booleans
@ 2026-09-11 13:17 Jan Zarsky
0 siblings, 0 replies; only message in thread
From: Jan Zarsky @ 2026-09-11 13:17 UTC (permalink / raw)
To: git-commits
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
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2026-09-11 13:17 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:17 [tests/selinux] pr775-checkpolicy-revdeps: test switching booleans Jan Zarsky
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox