public inbox for git-commits@fedoraproject.org
help / color / mirror / Atom feed
* [tests/selinux] pr775-checkpolicy-revdeps: checkmodule/checkmodule: Grep for error messages rather than debug logs
@ 2026-09-11 13:17 Petr Lautrbach
0 siblings, 0 replies; only message in thread
From: Petr Lautrbach @ 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 : 1d45ca7dec44c62abf63b0cc91eb805cb9ff42a5
Author : Petr Lautrbach <plautrba@redhat.com>
Date : 2019-04-09T15:32:29+02:00
Stats : +11/-12 in 2 file(s)
URL : https://src.fedoraproject.org/tests/selinux/c/1d45ca7dec44c62abf63b0cc91eb805cb9ff42a5?branch=pr775-checkpolicy-revdeps
Log:
checkmodule/checkmodule: Grep for error messages rather than debug logs
checkpolicy was updated in 2.9 in order not to write debug messages on ouput. It
doesn't output "loading policy ..." messages anymore.
At the same time, it should be enough to check the checkmodule exit status and
whether the OUTPUT_FILE exists
See https://github.com/SELinuxProject/selinux/commit/854fdc1ac40720782491e8ada6837aa4550a7ca1
Fixes:
[ PASS ] :: Command 'checkmodule >& /tmp/tmp.GUkhm09UGI' (Expected 1, got 1)
[ FAIL ] :: File '/tmp/tmp.GUkhm09UGI' should contain 'loading policy configuration from policy.conf'
[ PASS ] :: Command 'checkmodule -b >& /tmp/tmp.GUkhm09UGI' (Expected 1, got 1)
[ FAIL ] :: File '/tmp/tmp.GUkhm09UGI' should contain 'loading policy configuration from policy'
[ BEGIN ] :: Running 'checkmodule -m -o mypolicy.output mypolicy.te 2>&1 | grep "checkmodule.*loading policy configuration from mypolicy.te"'
[ FAIL ] :: Command 'checkmodule -m -o mypolicy.output mypolicy.te 2>&1 | grep "checkmodule.*loading policy configuration from mypolicy.te"' (Expected 0, got 1)
[ BEGIN ] :: Running 'checkmodule -m -o mypolicy.output mypolicy.te 2>&1 | grep "checkmodule.*writing binary representation.*to mypolicy.output"'
[ FAIL ] :: Command 'checkmodule -m -o mypolicy.output mypolicy.te 2>&1 | grep "checkmodule.*writing binary representation.*to mypolicy.output"' (Expected 0, got 1)
[ BEGIN ] :: Running 'checkmodule -m -C -o mypolicy.output mypolicy.te 2>&1 | grep "checkmodule.*loading policy configuration from mypolicy.te"'
[ FAIL ] :: Command 'checkmodule -m -C -o mypolicy.output mypolicy.te 2>&1 | grep "checkmodule.*loading policy configuration from mypolicy.te"' (Expected 0, got 1)
[ BEGIN ] :: Running 'checkmodule -m -C -o mypolicy.output mypolicy.te 2>&1 | grep "checkmodule.*writing CIL to mypolicy.output"'
[ FAIL ] :: Command 'checkmodule -m -C -o mypolicy.output mypolicy.te 2>&1 | grep "checkmodule.*writing CIL to mypolicy.output"' (Expected 0, got 1)
---
diff --git a/checkpolicy/checkmodule/Makefile b/checkpolicy/checkmodule/Makefile
index 7be6779..4dca103 100644
--- a/checkpolicy/checkmodule/Makefile
+++ b/checkpolicy/checkmodule/Makefile
@@ -53,10 +53,7 @@ $(METADATA): Makefile
@echo "Type: Sanity" >> $(METADATA)
@echo "TestTime: 10m" >> $(METADATA)
@echo "RunFor: checkpolicy" >> $(METADATA)
- @echo "Requires: checkpolicy" >> $(METADATA)
- @echo "Requires: man" >> $(METADATA)
- @echo "Requires: grep" >> $(METADATA)
- @echo "Requires: mktemp" >> $(METADATA)
+ @echo "Requires: checkpolicy man grep mktemp policycoreutils policycoreutils-devel" >> $(METADATA)
@echo "Priority: Normal" >> $(METADATA)
@echo "License: GPLv2" >> $(METADATA)
@echo "Confidential: no" >> $(METADATA)
diff --git a/checkpolicy/checkmodule/runtest.sh b/checkpolicy/checkmodule/runtest.sh
index f4ee8ce..590a799 100644
--- a/checkpolicy/checkmodule/runtest.sh
+++ b/checkpolicy/checkmodule/runtest.sh
@@ -38,13 +38,14 @@ rlJournalStart
TEST_FILE=`mktemp`
TEST_DIR=`mktemp -d`
rlRun "rpm -ql ${PACKAGE} | grep bin/checkmodule"
+ rlRun "rpm -ql ${PACKAGE} | grep /usr/share/man/.*checkmodule"
rlPhaseEnd
rlPhaseStartTest
rlRun "checkmodule >& ${TEST_FILE}" 1
- rlAssertGrep "loading policy configuration from policy.conf" ${TEST_FILE}
+ rlAssertGrep "unable to open policy.conf" ${TEST_FILE}
rlRun "checkmodule -b >& ${TEST_FILE}" 1
- rlAssertGrep "loading policy configuration from policy" ${TEST_FILE}
+ rlAssertGrep "Can't open 'policy': No such file or directory" ${TEST_FILE}
rlRun "checkmodule -V"
rlRun "checkmodule -U 1>/dev/null" 1
rlRun "rm -f policy.conf"
@@ -65,8 +66,11 @@ rlJournalStart
rlRun "checkmodule ${TEST_FILE}" 1
rlRun "checkmodule -b ${TEST_FILE}" 1
if rlIsRHEL 5 ; then
+ rlRun "man checkmodule | col -b | grep -- -d"
rlRun "checkmodule --help 2>&1 | grep -- -d"
fi
+ rlRun "man checkmodule | col -b | grep -- -h"
+ rlRun "man checkmodule | col -b | grep -- -U"
rlRun "checkmodule --help 2>&1 | grep -- -h"
rlRun "checkmodule --help 2>&1 | grep -- -U"
rlPhaseEnd
@@ -82,14 +86,12 @@ rlJournalStart
INPUT_FILE="mypolicy.te"
OUTPUT_FILE="mypolicy.output"
rlRun "ls -l ${INPUT_FILE}"
- rlRun "checkmodule -m -o ${OUTPUT_FILE} ${INPUT_FILE} 2>&1 | grep \"checkmodule.*loading policy configuration from ${INPUT_FILE}\""
- rlRun "checkmodule -m -o ${OUTPUT_FILE} ${INPUT_FILE} 2>&1 | grep \"checkmodule.*writing binary representation.*to ${OUTPUT_FILE}\""
- rlRun "ls -l ${OUTPUT_FILE}"
+ rlRun "checkmodule -m -o ${OUTPUT_FILE} ${INPUT_FILE}" 0
+ rlRun "ls -l ${OUTPUT_FILE}" 0
if checkmodule --help | grep -q " CIL " ; then
rlRun "rm -f ${OUTPUT_FILE}"
- rlRun "checkmodule -m -C -o ${OUTPUT_FILE} ${INPUT_FILE} 2>&1 | grep \"checkmodule.*loading policy configuration from ${INPUT_FILE}\""
- rlRun "checkmodule -m -C -o ${OUTPUT_FILE} ${INPUT_FILE} 2>&1 | grep \"checkmodule.*writing CIL to ${OUTPUT_FILE}\""
- rlRun "ls -l ${OUTPUT_FILE}"
+ rlRun "checkmodule -m -C -o ${OUTPUT_FILE} ${INPUT_FILE}" 0
+ rlRun "ls -l ${OUTPUT_FILE}" 0
fi
rlPhaseEnd
^ 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: checkmodule/checkmodule: Grep for error messages rather than debug logs Petr Lautrbach
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox