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/'
+}
# 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() {
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"