public inbox for git-commits@fedoraproject.org
help / color / mirror / Atom feed
From: Petr Lautrbach <plautrba@redhat.com>
To: git-commits@fedoraproject.org
Subject: [tests/selinux] pr775-checkpolicy-revdeps: checkmodule/checkmodule: Grep for error messages rather than debug logs
Date: Fri, 11 Sep 2026 13:17:32 GMT	[thread overview]
Message-ID: <178913265211.1.1035177059480405598.tests-selinux-1d45ca7dec44@fedoraproject.org> (raw)

            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
 

                 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=178913265211.1.1035177059480405598.tests-selinux-1d45ca7dec44@fedoraproject.org \
    --to=plautrba@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