All of lore.kernel.org
 help / color / mirror / Atom feed
From: Mimi Zohar <zohar@linux.ibm.com>
To: linux-integrity@vger.kernel.org
Cc: Mimi Zohar <zohar@linux.ibm.com>,
	Roberto Sassu <roberto.sassu@huaweicloud.com>,
	Vitaly Chikunov <vt@altlinux.org>, Petr Vorel <pvorel@suse.cz>,
	Stefan Berger <stefanb@linux.ibm.com>
Subject: [PATCH ima-evm-utils] ci: cleanup build.sh test log output
Date: Wed, 25 Jan 2023 17:13:11 -0500	[thread overview]
Message-ID: <20230125221311.395032-1-zohar@linux.ibm.com> (raw)

Unlike the original ima-evm-utils ima_hash.test and sign_verify.test
selftests, kernel tests may fail for any number of reasons (e.g. kernel
config, permissions, missing applications, test infrastructure).  For
these tests, the full test log is needed to analyze the failure.

Create a phony target in tests/Makefile.am named "check-logs". Based on
test name, output different amounts of the test log.

Signed-off-by: Mimi Zohar <zohar@linux.ibm.com>
---
[Applies on top of Roberto's "v3 Support testing in new enviroments"
 patch set.]

 build.sh          | 23 +----------------------
 tests/Makefile.am | 13 +++++++++++++
 2 files changed, 14 insertions(+), 22 deletions(-)

diff --git a/build.sh b/build.sh
index 0920599b2780..c226dd1f1773 100755
--- a/build.sh
+++ b/build.sh
@@ -97,28 +97,7 @@ VERBOSE=1 make check || ret=$?
 
 title "logs"
 if [ $ret -eq 0 ]; then
-	if [ -f tests/ima_hash.log ]; then
-		tail -3 tests/ima_hash.log
-		grep "skipped" tests/ima_hash.log  && \
-		   grep "skipped" tests/ima_hash.log | wc -l
-	fi
-	if [ -f tests/sign_verify.log ]; then
-		tail -3 tests/sign_verify.log
-		grep "skipped" tests/sign_verify.log  && \
-		   grep "skipped" tests/sign_verify.log | wc -l
-	fi
-	tail -20 tests/boot_aggregate.log
-
-	if [ -f tests/fsverity.log ]; then
-		[ -n "$CI" ] && cat tests/fsverity.log || tail tests/fsverity.log
-		grep "skipped" tests/fsverity.log  && \
-		   grep "skipped" tests/fsverity.log | wc -l
-	fi
-	if [ -f tests/portable_signatures.log ]; then
-		[ -n "$CI" ] && cat tests/portable_signatures.log || tail tests/portable_signatures.log
-		grep "skipped" tests/portable_signatures.log  && \
-		   grep "skipped" tests/portable_signatures.log | wc -l
-	fi
+	cd tests; make check_logs; cd ..
 	exit 0
 fi
 
diff --git a/tests/Makefile.am b/tests/Makefile.am
index 421fac577b55..a0463b7b5b5d 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -4,6 +4,19 @@ TESTS = $(check_SCRIPTS)
 check_SCRIPTS += ima_hash.test sign_verify.test boot_aggregate.test \
 		 fsverity.test portable_signatures.test
 
+.PHONY: check_logs
+check_logs:
+	@for log in $(TEST_LOGS); do \
+	   echo -e "\n***" $$log "***" ; \
+	   case $$log in \
+	   ima_hash.log | sign_verify.log ) \
+	       tail -3 $$log ; \
+	       grep "skipped" $$log && grep "skipped" $$log | wc -l ;; \
+	   *) \
+	       cat $$log ;; \
+	   esac ; \
+	done
+
 clean-local:
 	-rm -f *.txt *.out *.sig *.sig2
 
-- 
2.31.1


             reply	other threads:[~2023-01-25 22:13 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-01-25 22:13 Mimi Zohar [this message]
2023-01-25 23:00 ` [PATCH ima-evm-utils] ci: cleanup build.sh test log output Petr Vorel

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=20230125221311.395032-1-zohar@linux.ibm.com \
    --to=zohar@linux.ibm.com \
    --cc=linux-integrity@vger.kernel.org \
    --cc=pvorel@suse.cz \
    --cc=roberto.sassu@huaweicloud.com \
    --cc=stefanb@linux.ibm.com \
    --cc=vt@altlinux.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.