Message ID | cb5e54259bcd2bd6cd310ffa2411a79370698f61.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 |
On Fri, Feb 28, 2025 at 01:55:19PM +0800, Anand Jain wrote: > Redirect sysfs write errors to stdout as a preparatory patch to enable > testing of expected sysfs write failures. Also, log the executed > sysfs write command and its failure if any to seqres.full for better > debugging and traceability. > > Signed-off-by: Anand Jain <anand.jain@oracle.com> > --- > common/rc | 3 ++- > 1 file changed, 2 insertions(+), 1 deletion(-) > > diff --git a/common/rc b/common/rc > index c7d7dbb8e93b..59af83a01e3a 100644 > --- a/common/rc > +++ b/common/rc > @@ -5181,7 +5181,8 @@ _set_fs_sysfs_attr() > > local dname=$(_fs_sysfs_dname $dev) > > - echo "$content" > /sys/fs/${FSTYP}/${dname}/${attr} > + echo "echo '$content' 2>&1 > /sys/fs/${FSTYP}/${dname}/${attr}" >> $seqres.full > + echo "$content" 2>&1 > /sys/fs/${FSTYP}/${dname}/${attr} | tee -a $seqres.full Actually I doubt the $seqres might be not defined before calling _set_fs_sysfs_attr. For example, we call _set_fs_sysfs_attr in ./check as _test_mount -> _prepare_for_eio_shutdown -> _xfs_prepare_for_eio_shutdown -> _set_fs_sysfs_attr The _test_mount is called before $seqres is defined. At that time, the $seqres.full will be ".full" if the FSTYP=xfs Anyway, we can fix this problem in another patch, this patch is good to me, Reviewed-by: Zorro Lang <zlang@redhat.com> > } > > # Print the content of /sys/fs/$FSTYP/$DEV/$ATTR > -- > 2.47.0 > >
diff --git a/common/rc b/common/rc index c7d7dbb8e93b..59af83a01e3a 100644 --- a/common/rc +++ b/common/rc @@ -5181,7 +5181,8 @@ _set_fs_sysfs_attr() local dname=$(_fs_sysfs_dname $dev) - echo "$content" > /sys/fs/${FSTYP}/${dname}/${attr} + echo "echo '$content' 2>&1 > /sys/fs/${FSTYP}/${dname}/${attr}" >> $seqres.full + echo "$content" 2>&1 > /sys/fs/${FSTYP}/${dname}/${attr} | tee -a $seqres.full } # Print the content of /sys/fs/$FSTYP/$DEV/$ATTR
Redirect sysfs write errors to stdout as a preparatory patch to enable testing of expected sysfs write failures. Also, log the executed sysfs write command and its failure if any to seqres.full for better debugging and traceability. Signed-off-by: Anand Jain <anand.jain@oracle.com> --- common/rc | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)