scoutfs-tests: only check for new dmesg entries

The dmesg check was creating false positives when unexpected messages
from before the test run were forced out of the ring.  The evicted
messages were showing up as removals in the diff.

We only want to see new messages that were created during the test run.
So we format the diff to only output added lines.

Signed-off-by: Zach Brown <zab@versity.com>
This commit is contained in:
Zach Brown
2020-02-25 12:04:44 -08:00
committed by Zach Brown
parent 503011b777
commit cce20dbeb6
+7 -5
View File
@@ -474,15 +474,17 @@ for t in $tests; do
message=$(cat "$T_TMPDIR/status.msg")
fi
# see if anything unexpected showed up in dmesg
# see if anything unexpected was added to dmesg
if [ "$sts" == "$T_PASS_STATUS" ]; then
dmesg | t_filter_dmesg > "$T_TMPDIR/dmesg.after"
diff -u "$T_TMPDIR/dmesg.before" "$T_TMPDIR/dmesg.after" > \
"$T_TMPDIR/dmesg.diff"
if [ -s "$T_TMPDIR/dmesg.diff" ]; then
diff --old-line-format="" --unchanged-line-format="" \
"$T_TMPDIR/dmesg.before" "$T_TMPDIR/dmesg.after" > \
"$T_TMPDIR/dmesg.new"
if [ -s "$T_TMPDIR/dmesg.new" ]; then
message="unexpected messages in dmesg"
sts=$T_FAIL_STATUS
cat "$T_TMPDIR/dmesg.diff" >> "$T_RESULTS/fail.log"
cat "$T_TMPDIR/dmesg.new" >> "$T_RESULTS/fail.log"
fi
fi