From: Omar Sandoval Date: Fri, 10 Nov 2017 19:07:13 +0000 (-0800) Subject: block/012: fix xfs_io error mismatch X-Git-Url: https://www.infradead.org/git/?a=commitdiff_plain;h=fb715172f62ed5e55ff04b24dc725a46f8b3f1d6;p=users%2Fsagi%2Fblktests.git block/012: fix xfs_io error mismatch Old versions of xfs_io (like David must be using) use pwrite64() instead of pwrite(), which was causing an output mismatch on my newer version. Pull in _filter_xfs_io_error from xfstests to fix it. While we're here, add a slightly more descriptive description. Fixes: 3aeec46f048b ("block/012: add test for BLKROSET/BLKROGET ioctls") Signed-off-by: Omar Sandoval --- diff --git a/common/rc b/common/rc index d7f3220..6b29c2b 100644 --- a/common/rc +++ b/common/rc @@ -141,3 +141,10 @@ _get_pci_dev_from_blkdev() { grep -Eo '[0-9a-f]{4}:[0-9a-f]{2}:[0-9a-f]{2}\.[0-9a-f]' | \ tail -1 } + +# Older versions of xfs_io use pwrite64 and such, so the error messages won't +# match current versions of xfs_io. See c52086226bc6 ("filter: xfs_io output +# has dropped "64" from error messages") in xfstests. +_filter_xfs_io_error() { + sed -e 's/^\(.*\)64\(: .*$\)/\1\2/' +} diff --git a/tests/block/012 b/tests/block/012 index cc85d2d..baabdd6 100755 --- a/tests/block/012 +++ b/tests/block/012 @@ -17,7 +17,7 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . -DESCRIPTION="check read-only state" +DESCRIPTION="check that a read-only block device fails writes" TIMED=1 requires() { @@ -34,7 +34,8 @@ test_device() { blockdev --setro "$TEST_DEV" blockdev --getro "$TEST_DEV" # writes should fail while device is read-only - xfs_io -c "pwrite -w -S 0xbb -b 2M 0 2M" -d "$TEST_DEV" >>"$FULL" + xfs_io -c "pwrite -w -S 0xbb -b 2M 0 2M" -d "$TEST_DEV" 2>&1 >>"$FULL" \ + | _filter_xfs_io_error dd if="$TEST_DEV" bs=2M count=1 2>>"$FULL" | hexdump blockdev --setrw "$TEST_DEV" blockdev --getro "$TEST_DEV" diff --git a/tests/block/012.out b/tests/block/012.out index fc6fc00..3e52322 100644 --- a/tests/block/012.out +++ b/tests/block/012.out @@ -4,7 +4,7 @@ Running block/012 * 0200000 1 -pwrite64: Operation not permitted +pwrite: Operation not permitted 0000000 aaaa aaaa aaaa aaaa aaaa aaaa aaaa aaaa * 0200000