diff options
author | Stefano Brivio <sbrivio@redhat.com> | 2018-05-08 17:43:30 +0200 |
---|---|---|
committer | Jozsef Kadlecsik <kadlec@blackhole.kfki.hu> | 2018-05-30 10:13:32 +0200 |
commit | 5f9b3901a058c8a530d3831027a21c5497a07807 (patch) | |
tree | 48f915e0d8927fe2a2fc7b61530cc62260c07785 /tests | |
parent | d3a5e97d5c18388a94cf769dc80c8c3c5b94ba36 (diff) |
tests/check_klog.sh: Try dmesg too, don't let shell terminate script
Some hosts might not use /var/log/kern.log for kernel messages,
so if we can't find a match there, try dmesg next.
If no matches are found, don't let the shell terminate the
script, so that we have a chance to try dmesg and actually echo
"no match!" if no matches are found: set +e before the setname
loop.
Signed-off-by: Stefano Brivio <sbrivio@redhat.com>
Signed-off-by: Jozsef Kadlecsik <kadlec@blackhole.kfki.hu>
Diffstat (limited to 'tests')
-rwxr-xr-x | tests/check_klog.sh | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/tests/check_klog.sh b/tests/check_klog.sh index 146e492..9af5f66 100755 --- a/tests/check_klog.sh +++ b/tests/check_klog.sh @@ -42,9 +42,13 @@ ipaddr=`expand_ipv6 $1`; shift proto=`echo $1 | tr a-z A-Z`; shift port=$1; shift +set +e for setname in $@; do match=`tail -n +$loglines /var/log/kern.log | grep -e "in set $setname: .* SRC=$ipaddr .* PROTO=$proto SPT=$port .*"` if [ -z "$match" ]; then + match=`dmesg | tail -n +$loglines | grep -e "in set $setname: .* SRC=$ipaddr .* PROTO=$proto SPT=$port .*"` + fi + if [ -z "$match" ]; then echo "no match!" exit 1 fi |