common/fuzzy: if the fuzz verb is random, keep fuzzing until we get a new value
[xfstests-dev.git] / common / filter
index 1ef342b59726e2b31fc19be13e26a8d550f68b74..0cb458b0051f9d360ec449841249f88042c6fe6b 100644 (file)
@@ -295,6 +295,17 @@ _filter_scratch()
            -e "/.use_space/d"
 }
 
+_filter_testdir_and_scratch()
+{
+       # filter both $TEST_DIR and $SCRATCH_MNT, but always filter the longer
+       # string first if the other string is a substring of the first one
+       if echo "$TEST_DIR" | grep -q "$SCRATCH_MNT"; then
+               _filter_test_dir | _filter_scratch
+       else
+               _filter_scratch | _filter_test_dir
+       fi
+}
+
 # Turn any device in the scratch pool into SCRATCH_DEV
 _filter_scratch_pool()
 {
@@ -311,7 +322,7 @@ _filter_quota()
 {
        # Long dev name might be split onto its own line; last
        # seds remove that newline if present
-       _filter_scratch | _filter_test_dir | _filter_spaces | \
+       _filter_testdir_and_scratch | _filter_spaces | \
        sed -e 'N;s/SCRATCH_DEV\n/SCRATCH_DEV/g' | \
        sed -e 'N;s/TEST_DEV\n/TEST_DEV/g'
 }
@@ -437,5 +448,30 @@ _filter_filefrag()
              $flags, "\n"'
 }
 
+# We generate WARNINGs on purpose when applications mix buffered/mmap IO with
+# direct IO on the same file. This is a helper for _check_dmesg() to filter out
+# such warnings.
+_filter_aiodio_dmesg()
+{
+       local warn1="WARNING:.*fs/xfs/xfs_file\.c:.*xfs_file_dio_aio_write.*"
+       local warn2="WARNING:.*fs/xfs/xfs_file\.c:.*xfs_file_dio_aio_read.*"
+       local warn3="WARNING:.*fs/xfs/xfs_file\.c:.*xfs_file_read_iter.*"
+       local warn4="WARNING:.*fs/xfs/xfs_file\.c:.*xfs_file_aio_read.*"
+       local warn5="WARNING:.*fs/iomap\.c:.*iomap_dio_rw.*"
+       local warn6="WARNING:.*fs/xfs/xfs_aops\.c:.*__xfs_get_blocks.*"
+       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.*"
+       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#" \
+           -e "s#$warn4#Intentional warnings in xfs_file_aio_read#" \
+           -e "s#$warn5#Intentional warnings in iomap_dio_rw#" \
+           -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#"
+}
+
 # make sure this script returns success
 /bin/true