common: filter aiodio dmesg after fs/iomap.c to fs/iomap/ move
[xfstests-dev.git] / common / filter
index 9c33efacea6c856c150e0f5d9703243cc2ec393d..26fc21322d1cac349acfc2ffc40c4c8c7e0bf589 100644 (file)
@@ -1,23 +1,8 @@
 ##/bin/bash
-#
+# SPDX-License-Identifier: GPL-2.0
 # Copyright (c) 2000-2001 Silicon Graphics, Inc.  All Rights Reserved.
 #
-# This program is free software; you can redistribute it and/or
-# modify it under the terms of the GNU General Public License as
-# published by the Free Software Foundation.
-#
-# This program is distributed in the hope that it would be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write the Free Software Foundation,
-# Inc.,  51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
-#
-#
 # standard filters
-#
 
 # Checks that given_value is in range of correct_value +/- tolerance.
 # Tolerance can be an absolute value or a percentage of the correct value
@@ -226,6 +211,15 @@ _filter_xfs_io()
     sed -e "s/[0-9/.]* [GMKiBbytes]*, [0-9]* ops\; [0-9/:. sec]* ([infa0-9/.]* [EPGMKiBbytes]*\/sec and [infa0-9/.]* ops\/sec)/XXX Bytes, X ops\; XX:XX:XX.X (XXX YYY\/sec and XXX ops\/sec)/"
 }
 
+# Also filter out the offset part of xfs_io output
+# Some test cases may be affected by underlaying extent/chunk layout change,
+# so wipe out this part to avoid golden output difference
+_filter_xfs_io_offset()
+{
+    # filter out " at offset XXX" and offset of "pread -v"
+    _filter_xfs_io | sed -e "s/ at offset [0-9]*$//" -e "s/^[0-9a-f]\+:/XXXXXXXX:/"
+}
+
 # stderr filter for xfs_io to handle change of error output format (e.g.
 # pwrite64 -> pwrite).
 _filter_xfs_io_error()
@@ -277,6 +271,10 @@ _filter_xfs_io_pages_modified()
        _filter_xfs_io_units_modified "Page" $PAGE_SIZE
 }
 
+_filter_xfs_io_numbers()
+{
+        _filter_xfs_io | sed -E 's/[0-9]+/XXXX/g'
+}
 
 _filter_test_dir()
 {
@@ -506,6 +504,12 @@ _filter_mknod()
        sed -e "s/mknod: [\`']\(.*\)': File exists/mknod: \1: File exists/"
 }
 
+# Remove leading "rename" in "mv -v" output
+_filter_mv()
+{
+       sed -e "s/^renamed //"
+}
+
 _filter_lostfound()
 {
        sed -e '/^lost+found$/d'
@@ -551,6 +555,7 @@ _filter_aiodio_dmesg()
        local warn7="WARNING:.*fs/iomap\.c:.*iomap_dio_actor.*"
        local warn8="WARNING:.*fs/iomap\.c:.*iomap_dio_complete.*"
        local warn9="WARNING:.*fs/direct-io\.c:.*dio_complete.*"
+       local warn10="WARNING:.*fs/iomap/direct-io\.c:.*iomap_dio_actor.*"
        sed -e "s#$warn1#Intentional warnings in xfs_file_dio_aio_write#" \
            -e "s#$warn2#Intentional warnings in xfs_file_dio_aio_read#" \
            -e "s#$warn3#Intentional warnings in xfs_file_read_iter#" \
@@ -559,7 +564,19 @@ _filter_aiodio_dmesg()
            -e "s#$warn6#Intentional warnings in __xfs_get_blocks#" \
            -e "s#$warn7#Intentional warnings in iomap_dio_actor#" \
            -e "s#$warn8#Intentional warnings in iomap_dio_complete#" \
-           -e "s#$warn9#Intentional warnings in dio_complete#"
+           -e "s#$warn9#Intentional warnings in dio_complete#" \
+           -e "s#$warn10#Intentional warnings in iomap_dio_actor#"
+}
+
+# We generate assert related WARNINGs on purpose and make sure test doesn't fail
+# because of these warnings. This is a helper for _check_dmesg() to filter out
+# them.
+_filter_assert_dmesg()
+{
+       local warn1="WARNING:.*fs/xfs/xfs_message\.c:.*asswarn.*"
+       local warn2="WARNING:.*fs/xfs/xfs_message\.c:.*assfail.*"
+       sed -e "s#$warn1#Intentional warnings in asswarn#" \
+           -e "s#$warn2#Intentional warnings in assfail#"
 }
 
 # make sure this script returns success