public inbox for git-commits@fedoraproject.org
help / color / mirror / Atom feed
* [tests/selinux] pr775-checkpolicy-revdeps: adapt to semanage port dealing with duplicated local customization
@ 2026-09-11 13:21 Milos Malik
0 siblings, 0 replies; only message in thread
From: Milos Malik @ 2026-09-11 13:21 UTC (permalink / raw)
To: git-commits
A new commit has been pushed.
Repo : tests/selinux
Branch : pr775-checkpolicy-revdeps
Commit : 85a3f368bdbba5bf8a6daa1223c3e821c940f936
Author : Milos Malik <mmalik@redhat.com>
Date : 2024-02-15T08:09:55+01:00
Stats : +15/-9 in 3 file(s)
URL : https://src.fedoraproject.org/tests/selinux/c/85a3f368bdbba5bf8a6daa1223c3e821c940f936?branch=pr775-checkpolicy-revdeps
Log:
adapt to semanage port dealing with duplicated local customization
The semanage command from older policycoreutils versions (<= 3.6-1.el9)
behaves in a certain way when a duplicated port context pattern is added.
It does not add the pattern but produces the following message:
ValueError: Port <protocol>/<number> already defined
The semanage command from new policycoreutils versions (>= 3.6-2.el9)
behaves differently when a duplicated port context pattern is added.
It adds the pattern and produces the following message:
Port <protocol>/<number> already defined, modifying instead
Above-mentioned differences in behavior have some consequences for the
automated test when removing a duplicated port context pattern. If the
automated test should pass, it needs to anticipate both possibilities.
---
diff --git a/policycoreutils/semanage-port-add-delete-problems/Makefile b/policycoreutils/semanage-port-add-delete-problems/Makefile
index 263da02..36cdf85 100644
--- a/policycoreutils/semanage-port-add-delete-problems/Makefile
+++ b/policycoreutils/semanage-port-add-delete-problems/Makefile
@@ -54,13 +54,14 @@ $(METADATA): Makefile
@echo "Type: Regression" >> $(METADATA)
@echo "TestTime: 15m" >> $(METADATA)
@echo "RunFor: policycoreutils" >> $(METADATA)
+ @echo "Requires: audit" >> $(METADATA)
+ @echo "Requires: coreutils" >> $(METADATA)
+ @echo "Requires: grep" >> $(METADATA)
+ @echo "Requires: libselinux" >> $(METADATA)
+ @echo "Requires: libselinux-utils" >> $(METADATA)
@echo "Requires: policycoreutils" >> $(METADATA)
@echo "Requires: policycoreutils-python-utils" >> $(METADATA)
@echo "Requires: setools-console" >> $(METADATA)
- @echo "Requires: libselinux" >> $(METADATA)
- @echo "Requires: libselinux-utils" >> $(METADATA)
- @echo "Requires: coreutils" >> $(METADATA)
- @echo "Requires: grep" >> $(METADATA)
@echo "Priority: Normal" >> $(METADATA)
@echo "License: GPLv2" >> $(METADATA)
@echo "Confidential: no" >> $(METADATA)
diff --git a/policycoreutils/semanage-port-add-delete-problems/main.fmf b/policycoreutils/semanage-port-add-delete-problems/main.fmf
index d0609a9..d948252 100644
--- a/policycoreutils/semanage-port-add-delete-problems/main.fmf
+++ b/policycoreutils/semanage-port-add-delete-problems/main.fmf
@@ -6,13 +6,14 @@ contact: Milos Malik <mmalik@redhat.com>
component:
- policycoreutils
recommend:
+ - audit
+ - coreutils
+ - grep
+ - libselinux
+ - libselinux-utils
- policycoreutils
- policycoreutils-python-utils
- setools-console
- - libselinux
- - libselinux-utils
- - coreutils
- - grep
duration: 15m
extra-summary: /CoreOS/policycoreutils/Regression/semanage-port-add-delete-problems
extra-task: /CoreOS/policycoreutils/Regression/semanage-port-add-delete-problems
diff --git a/policycoreutils/semanage-port-add-delete-problems/runtest.sh b/policycoreutils/semanage-port-add-delete-problems/runtest.sh
index 435fc40..835b043 100755
--- a/policycoreutils/semanage-port-add-delete-problems/runtest.sh
+++ b/policycoreutils/semanage-port-add-delete-problems/runtest.sh
@@ -115,8 +115,12 @@ rlJournalStart
rlRun "semanage port -a -t smtp_port_t -p tcp 25 2>&1 | tee ${OUTPUT_FILE}"
rlAssertGrep "port .* already defined" ${OUTPUT_FILE} -i
rlRun "semanage port -l | grep 'smtp_port_t.*tcp.*25'"
+ rm -f ${OUTPUT_FILE}
rlRun "semanage port -d -t smtp_port_t -p tcp 25 2>&1 | tee ${OUTPUT_FILE}"
- rlAssertGrep "port .* is defined in policy.*cannot be deleted" ${OUTPUT_FILE} -i
+ # the error may not appear because the local customization can be deleted always
+ if [ -s ${OUTPUT_FILE} ] ; then
+ rlAssertGrep "port .* is defined in policy.*cannot be deleted" ${OUTPUT_FILE} -i
+ fi
rlRun "semanage port -d -t smtp_port_t -p tcp 25 2>&1 | tee ${OUTPUT_FILE}"
rlAssertGrep "port .* is defined in policy.*cannot be deleted" ${OUTPUT_FILE} -i
rlRun "semanage port -l | grep 'smtp_port_t.*tcp.*25'"
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2026-09-11 13:21 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:21 [tests/selinux] pr775-checkpolicy-revdeps: adapt to semanage port dealing with duplicated local customization Milos Malik
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox