From: Lukas Czerner <lczerner@redhat.com>
To: io-uring@vger.kernel.org
Subject: [PATCH 3/5] test: store test output to a log file
Date: Fri, 18 Sep 2020 12:47:44 +0200 [thread overview]
Message-ID: <20200918104746.146747-3-lczerner@redhat.com> (raw)
In-Reply-To: <20200918104746.146747-1-lczerner@redhat.com>
Store test output to a log file for further inspection. Depending on
the test result the log file name for the test will be one of the
following ${test_name}.{log,timeout,failed,skipped}
Signed-off-by: Lukas Czerner <lczerner@redhat.com>
---
.gitignore | 4 ++++
test/runtests.sh | 27 ++++++++++++++++++++++++---
2 files changed, 28 insertions(+), 3 deletions(-)
diff --git a/.gitignore b/.gitignore
index 8f7f369..9e7865b 100644
--- a/.gitignore
+++ b/.gitignore
@@ -107,6 +107,10 @@
/test/timeout-overflow
/test/wakeup-hang
/test/*.dmesg
+/test/*.log
+/test/*.failed
+/test/*.skipped
+/test/*.timeout
config-host.h
config-host.mak
diff --git a/test/runtests.sh b/test/runtests.sh
index acefe33..b61cb27 100755
--- a/test/runtests.sh
+++ b/test/runtests.sh
@@ -83,29 +83,42 @@ run_test()
# Do we have to exclude the test ?
echo $TEST_EXCLUDE | grep -w "$test_name" > /dev/null 2>&1
if [ $? -eq 0 ]; then
- echo "Test skipped"
+ echo "Test skipped by user" | tee ${test_name}.skipped
SKIPPED="$SKIPPED <$test_string>"
return
fi
+ # Prepare log file name
+ if [ -n "$dev" ]; then
+ local logfile=$(echo "${test_name}_${dev}" | \
+ sed 's/\(\/\|_\/\|\/_\)/_/g')
+ else
+ local logfile=${test_name}
+ fi
+
# Run the test
- timeout --preserve-status -s INT -k $TIMEOUT $TIMEOUT ./$test_name $dev
- local status=$?
+ timeout --preserve-status -s INT -k $TIMEOUT $TIMEOUT \
+ ./$test_name $dev 2>&1 | tee ${logfile}.log
+ local status=${PIPESTATUS[0]}
# Check test status
if [ "$status" -eq 124 ]; then
echo "Test $test_name timed out (may not be a failure)"
+ mv ${logfile}.log ${logfile}.timeout
elif [ "$status" -ne 0 ] && [ "$status" -ne 255 ]; then
echo "Test $test_name failed with ret $status"
FAILED="$FAILED <$test_string>"
RET=1
+ mv ${logfile}.log ${logfile}.failed
elif ! _check_dmesg "$dmesg_marker" "$test_name" "$dev"; then
echo "Test $test_name failed dmesg check"
FAILED="$FAILED <$test_string>"
RET=1
+ mv ${logfile}.log ${logfile}.failed
elif [ "$status" -eq 255 ]; then
echo "Test skipped"
SKIPPED="$SKIPPED <$test_string>"
+ mv ${logfile}.log ${logfile}.skipped
elif [ -n "$dev" ]; then
sleep .1
ps aux | grep "\[io_wq_manager\]" > /dev/null
@@ -113,8 +126,16 @@ run_test()
MAYBE_FAILED="$MAYBE_FAILED $test_string"
fi
fi
+
+ # Only leave behing log file with some content in it
+ if [ ! -s "${logfile}.log" ]; then
+ rm -f ${logfile}.log
+ fi
}
+# Clean up all the logs from previous run
+rm -f *.{log,timeout,failed,skipped,dmesg}
+
# Run all specified tests
for tst in $TESTS; do
run_test $tst
--
2.26.2
next prev parent reply other threads:[~2020-09-18 10:48 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-09-18 10:47 [PATCH 1/5] test: save dmesg output for each test and test file Lukas Czerner
2020-09-18 10:47 ` [PATCH 2/5] test: make a distinction between successful and skipped test Lukas Czerner
2020-09-18 10:47 ` Lukas Czerner [this message]
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 \
--in-reply-to=20200918104746.146747-3-lczerner@redhat.com \
--to=lczerner@redhat.com \
--cc=io-uring@vger.kernel.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.