diff mbox series

[v4,2/5] fstests: filter: helper for sysfs error filtering

Message ID c8389fe873ff3cbf68d1f6b5a6df8d6fc0645f9f.1740721626.git.anand.jain@oracle.com (mailing list archive)
State New, archived
Headers show
Series fstests: btrfs: add test case to validate sysfs input arguments | expand

Commit Message

Anand Jain Feb. 28, 2025, 5:55 a.m. UTC
Added filter helper to filter sysfs write errors, retain only the
error part.

Signed-off-by: Anand Jain <anand.jain@oracle.com>
---
 common/filter | 9 +++++++++
 1 file changed, 9 insertions(+)

Comments

Zorro Lang March 31, 2025, 1:53 p.m. UTC | #1
On Fri, Feb 28, 2025 at 01:55:20PM +0800, Anand Jain wrote:
> Added filter helper to filter sysfs write errors, retain only the
> error part.
> 
> Signed-off-by: Anand Jain <anand.jain@oracle.com>
> ---
>  common/filter | 9 +++++++++
>  1 file changed, 9 insertions(+)
> 
> diff --git a/common/filter b/common/filter
> index 7e02ded377cc..44ba2b38c21d 100644
> --- a/common/filter
> +++ b/common/filter
> @@ -671,5 +671,14 @@ _filter_flakey_EIO()
>  	sed -e "s#.*: Input\/output error#$message#"
>  }
>  
> +# Filters
> +#      +./common/rc: line 5085: echo: write error: Invalid argument
> +# to
> +# 	Invalid argument
> +_filter_sysfs_error()
> +{
> +	sed 's/.*: \(.*\)$/\1/'
> +}

Maybe output the "echo: write error: Invalid argument" or "write error:
Invalid argument" is better. But as there's not more requirement for
this helper, for later two cases, this helper is good. We can change
that when we have particular requirement.

Reviewed-by: Zorro Lang <zlang@redhat.com>

> +
>  # make sure this script returns success
>  /bin/true
> -- 
> 2.47.0
> 
>
diff mbox series

Patch

diff --git a/common/filter b/common/filter
index 7e02ded377cc..44ba2b38c21d 100644
--- a/common/filter
+++ b/common/filter
@@ -671,5 +671,14 @@  _filter_flakey_EIO()
 	sed -e "s#.*: Input\/output error#$message#"
 }
 
+# Filters
+#      +./common/rc: line 5085: echo: write error: Invalid argument
+# to
+# 	Invalid argument
+_filter_sysfs_error()
+{
+	sed 's/.*: \(.*\)$/\1/'
+}
+
 # make sure this script returns success
 /bin/true