]> www.infradead.org Git - users/sagi/blktests.git/commitdiff
block/012: fix xfs_io error mismatch
authorOmar Sandoval <osandov@fb.com>
Fri, 10 Nov 2017 19:07:13 +0000 (11:07 -0800)
committerOmar Sandoval <osandov@fb.com>
Fri, 10 Nov 2017 20:04:49 +0000 (12:04 -0800)
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 <osandov@fb.com>
common/rc
tests/block/012
tests/block/012.out

index d7f322016ea48094ddd134f6a8acb54b893ee62f..6b29c2bc3add60401ed2c7418aadd9c428042dbc 100644 (file)
--- 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/'
+}
index cc85d2d703a1813595ba0c18008e664a9d2c2da4..baabdd68b655243972764ceeac6f72125fd33e34 100755 (executable)
@@ -17,7 +17,7 @@
 # You should have received a copy of the GNU General Public License
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
-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"
index fc6fc007ab202d106e79fc759ac23d018f128877..3e52322b71761c749358e17ac4cb832fdea9b211 100644 (file)
@@ -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