public inbox for [email protected]
 help / color / mirror / Atom feed
From: Lukas Czerner <[email protected]>
To: [email protected]
Subject: [PATCH 1/5] test: save dmesg output for each test and test file
Date: Fri, 18 Sep 2020 12:47:42 +0200	[thread overview]
Message-ID: <[email protected]> (raw)

Currently the dmesg output for each test will overwritten for every
test file so in the end only the dmesg output of the last test run will
be stored.

Fix it by using the test file name as well as test name in the dmesg log
file.

Signed-off-by: Lukas Czerner <[email protected]>
---
 test/runtests.sh | 15 ++++++++++-----
 1 file changed, 10 insertions(+), 5 deletions(-)

diff --git a/test/runtests.sh b/test/runtests.sh
index fa240f2..5107a0a 100755
--- a/test/runtests.sh
+++ b/test/runtests.sh
@@ -28,13 +28,18 @@ fi
 _check_dmesg()
 {
 	local dmesg_marker="$1"
-	local seqres="$2.seqres"
+	if [ -n "$3" ]; then
+		local dmesg_log=$(echo "${2}_${3}.dmesg" | \
+				  sed 's/\(\/\|_\/\|\/_\)/_/g')
+	else
+		local dmesg_log="${2}.dmesg"
+	fi
 
 	if [ $DO_KMSG -eq 0 ]; then
 		return 0
 	fi
 
-	dmesg | bash -c "$DMESG_FILTER" | grep -A 9999 "$dmesg_marker" >"${seqres}.dmesg"
+	dmesg | bash -c "$DMESG_FILTER" | grep -A 9999 "$dmesg_marker" >"$dmesg_log"
 	grep -q -e "kernel BUG at" \
 	     -e "WARNING:" \
 	     -e "BUG:" \
@@ -45,12 +50,12 @@ _check_dmesg()
 	     -e "INFO: possible circular locking dependency detected" \
 	     -e "general protection fault:" \
 	     -e "blktests failure" \
-	     "${seqres}.dmesg"
+	     "$dmesg_log"
 	# shellcheck disable=SC2181
 	if [[ $? -eq 0 ]]; then
 		return 1
 	else
-		rm -f "${seqres}.dmesg"
+		rm -f "$dmesg_log"
 		return 0
 	fi
 }
@@ -94,7 +99,7 @@ run_test()
 		echo "Test $test_name failed with ret $status"
 		FAILED="$FAILED <$test_string>"
 		RET=1
-	elif ! _check_dmesg "$dmesg_marker" "$test_name"; then
+	elif ! _check_dmesg "$dmesg_marker" "$test_name" "$dev"; then
 		echo "Test $test_name failed dmesg check"
 		FAILED="$FAILED <$test_string>"
 		RET=1
-- 
2.26.2


             reply	other threads:[~2020-09-18 10:47 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-09-18 10:47 Lukas Czerner [this message]
2020-09-18 10:47 ` [PATCH 2/5] test: make a distinction between successful and skipped test Lukas Czerner
2020-09-18 10:47 ` [PATCH 3/5] test: store test output to a log file Lukas Czerner
2020-09-18 10:47 ` [PATCH 4/5] test: make test output more readable Lukas Czerner
2020-09-18 10:47 ` [PATCH 5/5] test: handle the case when timeout is forced to KILL Lukas Czerner

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 \
    [email protected] \
    [email protected] \
    [email protected] \
    /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