# Mount it, and make sure we can't write to it, and we can unmount it again
#
echo "mounting read-only block device:"
-_try_scratch_mount 2>&1 | _filter_ro_mount
-echo "touching file on read-only filesystem (should fail)"
-touch $SCRATCH_MNT/foo 2>&1 | _filter_scratch
+_try_scratch_mount 2>&1 | _filter_ro_mount | _filter_scratch
+if [ "${PIPESTATUS[0]}" -eq 0 ]; then
+ echo "touching file on read-only filesystem (should fail)"
+ touch $SCRATCH_MNT/foo 2>&1 | _filter_scratch
+fi
#
# Apparently this used to be broken at some point:
# -o norecovery is used.
#
echo "mounting filesystem that needs recovery on a read-only device:"
-_try_scratch_mount 2>&1 | _filter_ro_mount
+_try_scratch_mount 2>&1 | _filter_ro_mount | _filter_scratch
echo "unmounting read-only filesystem"
_scratch_unmount 2>&1 | _filter_scratch | _filter_ending_dot
# data recovery hack.
#
echo "mounting filesystem with -o norecovery on a read-only device:"
-_try_scratch_mount -o norecovery 2>&1 | _filter_ro_mount
+_try_scratch_mount -o norecovery 2>&1 | _filter_ro_mount | _filter_scratch
echo "unmounting read-only filesystem"
_scratch_unmount 2>&1 | _filter_scratch | _filter_ending_dot
QA output created by 050
setting device read-only
mounting read-only block device:
-mount: /mnt-scratch: permission denied
-touching file on read-only filesystem (should fail)
+mount: SCRATCH_MNT: permission denied
unmounting read-only filesystem
umount: SCRATCH_DEV: not mounted
setting device read-write
unmounting read-only filesystem
umount: SCRATCH_DEV: not mounted
mounting filesystem with -o norecovery on a read-only device:
-mount: /mnt-scratch: permission denied
+mount: SCRATCH_MNT: permission denied
unmounting read-only filesystem
umount: SCRATCH_DEV: not mounted
setting device read-write