generic/310: slightly improve check for dmesg error
authorPaulo Alcantara (SUSE) <pc@cjr.nz>
Tue, 17 Mar 2020 01:54:39 +0000 (22:54 -0300)
committerEryu Guan <guaneryu@gmail.com>
Sun, 22 Mar 2020 15:18:38 +0000 (23:18 +0800)
The 'grep -c "error"' check was causing false positive results for
cifs.ko when running it with 'echo 1 > /proc/fs/cifs/cifsFYI'.

That is, the test would fail when cifs.ko prints out a non-error
message like this:

  [ 2320.903987] fs/cifs/smb2maperror.c: Mapping SMB2 status code 0x80000006 to POSIX err -61

Signed-off-by: Paulo Alcantara (SUSE) <pc@cjr.nz>
Suggested-by: Zorro Lang <zlang@redhat.com>
Reviewed-by: Eryu Guan <guaneryu@gmail.com>
Signed-off-by: Eryu Guan <guaneryu@gmail.com>
tests/generic/310

index 1fcd517e4e6fea3d14e9deabe57ac7095a6694ef..74bb04d650dd6e5b5ae8ea3632ff59a9a2841a5d 100755 (executable)
@@ -49,7 +49,7 @@ _require_command "$KILLALL_PROG" killall
 dmesg -c > /dev/null
 
 nr_bug=`dmesg | grep -c "kernel BUG"`
 dmesg -c > /dev/null
 
 nr_bug=`dmesg | grep -c "kernel BUG"`
-nr_error=`dmesg | grep -c "error"`
+nr_error=`dmesg | grep -wc "error"`
 nr_null=`dmesg | grep -c "kernel NULL pointer dereference"`
 nr_warning=`dmesg | grep -c "^WARNING"`
 nr_lockdep=`dmesg | grep -c "possible recursive locking detected"`
 nr_null=`dmesg | grep -c "kernel NULL pointer dereference"`
 nr_warning=`dmesg | grep -c "^WARNING"`
 nr_lockdep=`dmesg | grep -c "possible recursive locking detected"`
@@ -58,7 +58,7 @@ nr_lockdep=`dmesg | grep -c "possible recursive locking detected"`
 check_kernel_bug()
 {
        new_bug=`dmesg | grep -c "kernel BUG"`
 check_kernel_bug()
 {
        new_bug=`dmesg | grep -c "kernel BUG"`
-       new_error=`dmesg | grep -c "error"`
+       new_error=`dmesg | grep -wc "error"`
        new_null=`dmesg | grep -c "kernel NULL pointer dereference"`
        new_warning=`dmesg | grep -c "^WARNING"`
        new_lockdep=`dmesg | grep -c "possible recursive locking detected"`
        new_null=`dmesg | grep -c "kernel NULL pointer dereference"`
        new_warning=`dmesg | grep -c "^WARNING"`
        new_lockdep=`dmesg | grep -c "possible recursive locking detected"`