diff mbox

[1/2] filter.btrfs: new filter for property messages

Message ID 478b11f8a7ffe7d491227ab536418f214e7d346c.1457028701.git.dsterba@suse.com (mailing list archive)
State New, archived
Headers show

Commit Message

David Sterba March 3, 2016, 6:16 p.m. UTC
The error message in newer btrfs utilities contains name of the
property, we want to filter it out so it matches golden output. There's
an optional parameter with property name that is matched against the
command output.

Signed-off-by: David Sterba <dsterba@suse.com>
---
 common/filter.btrfs | 12 ++++++++++++
 1 file changed, 12 insertions(+)

Comments

Filipe Manana March 4, 2016, 9:31 a.m. UTC | #1
On Thu, Mar 3, 2016 at 6:16 PM, David Sterba <dsterba@suse.com> wrote:
> The error message in newer btrfs utilities contains name of the
> property, we want to filter it out so it matches golden output. There's
> an optional parameter with property name that is matched against the
> command output.
>
> Signed-off-by: David Sterba <dsterba@suse.com>
Reviewed-by: Filipe Manana <fdmanana@suse.com>

> ---
>  common/filter.btrfs | 12 ++++++++++++
>  1 file changed, 12 insertions(+)
>
> diff --git a/common/filter.btrfs b/common/filter.btrfs
> index 9bb64792f14f..380454399834 100644
> --- a/common/filter.btrfs
> +++ b/common/filter.btrfs
> @@ -68,5 +68,17 @@ _filter_btrfs_subvol_delete()
>
>  }
>
> +# filter name of the property from the output, optionally verify against $1
> +# recognized message(s):
> +#  "object is not compatible with property: label"
> +_filter_btrfs_prop_error()
> +{
> +       if ! [ -z "$1" ]; then
> +               sed -e "s/\(compatible with property\): $1/\1/"
> +       else
> +               sed -e "s/^\(.*compatible with property\).*/\1/"
> +       fi
> +}
> +
>  # make sure this script returns success
>  /bin/true
> --
> 1.8.4.5
>
> --
> To unsubscribe from this list: send the line "unsubscribe fstests" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/common/filter.btrfs b/common/filter.btrfs
index 9bb64792f14f..380454399834 100644
--- a/common/filter.btrfs
+++ b/common/filter.btrfs
@@ -68,5 +68,17 @@  _filter_btrfs_subvol_delete()
 
 }
 
+# filter name of the property from the output, optionally verify against $1
+# recognized message(s):
+#  "object is not compatible with property: label"
+_filter_btrfs_prop_error()
+{
+	if ! [ -z "$1" ]; then
+		sed -e "s/\(compatible with property\): $1/\1/"
+	else
+		sed -e "s/^\(.*compatible with property\).*/\1/"
+	fi
+}
+
 # make sure this script returns success
 /bin/true