fstests: filter mount error message for EUCLEAN and ESTALE

util-linux commit ea848180dd34 ("libmount: add
mnt_context_get_excode()") since v2.30 changed the error message on
EUCLEAN and ESTALE again (and maybe other errno too):

 - mount: <device> on <mountpoint> failed: Structure needs cleaning
 + mount: <mountpoint>: mount(2) system call failed: Structure needs cleaning.

and it causes xfs/005, overlay/037 to fail (and probably xfs/333 too,
but it's always _notrun for now).

And what's more, the mentioned tests would also fail when testing
with util-linux prior to v2.21, no one complained just because the
tests are usually _notrun on such old distributions that ship
util-linux < v2.21.

So let's filter out the changing parts and keep the error message
simple.

Reviewed-by: Amir Goldstein <amir73il@gmail.com>
Signed-off-by: Eryu Guan <eguan@redhat.com>
This commit is contained in:
Eryu Guan
2017-11-14 15:49:36 +08:00
parent 26b2fe2880
commit 94d3a4f00c
6 changed files with 33 additions and 12 deletions
+26
View File
@@ -390,6 +390,13 @@ _filter_fstrim()
egrep -o "[0-9]+ bytes" | $AWK_PROG '{print $1}'
}
# Remove the ending dot appended to mount error message, util-linux 2.30
# starts to do so.
_filter_ending_dot()
{
sed -e "s/\.$//"
}
# Older mount output referred to "block device" when mounting RO devices
# It's gone in newer versions
_filter_ro_mount() {
@@ -397,6 +404,25 @@ _filter_ro_mount() {
-e "s/mount: cannot mount block device/mount: cannot mount/g"
}
# Filter a failed mount output due to EUCLEAN and USTALE, util-linux changed
# the message several times.
#
# prior to v2.21:
# mount: Structure needs cleaning
# v2.21 to v2.29:
# mount: mount <device> on <mountpoint> failed: Structure needs cleaning
# v2.30 and later:
# mount: <mountpoint>: mount(2) system call failed: Structure needs cleaning.
#
# This is also true for ESTALE error. So let's remove all the changing parts
# and keep the 'prior to v2.21' format:
# mount: Structure needs cleaning
# mount: Stale file handle
_filter_error_mount()
{
sed -e "s/mount:\(.*failed:\)/mount:/" | _filter_ending_dot
}
_filter_od()
{
BLOCK_SIZE=$(_get_block_size $SCRATCH_MNT)