Re: [PATCH v5 2/6] fstests: common/rc: fix unset seqres in _set_fs_sysfs_attr

[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]



On Tue, Apr 08, 2025 at 11:10:43PM +0800, Anand Jain wrote:
> 
> 
> On 8/4/25 00:58, Darrick J. Wong wrote:
> > On Mon, Apr 07, 2025 at 11:48:16AM +0800, Anand Jain wrote:
> > > Ensure logs don’t write to a `.full` file when `_set_fs_sysfs_attr()`
> > > is called during setup (before a testcase) in XFS due to unset seqres.
> > > 
> > > Signed-off-by: Anand Jain <anand.jain@xxxxxxxxxx>
> > > ---
> > >   common/rc | 11 +++++++++--
> > >   1 file changed, 9 insertions(+), 2 deletions(-)
> > > 
> > > diff --git a/common/rc b/common/rc
> > > index e89eee5de840..ca1d13ca1f0b 100644
> > > --- a/common/rc
> > > +++ b/common/rc
> > > @@ -5201,6 +5201,13 @@ _set_fs_sysfs_attr()
> > >   	local attr=$1
> > >   	shift
> > >   	local content="$*"
> > > +	local logfile="/dev/null"
> > 
> > If we're not actually running a test, should the error output go to
> > $check.full instead?
> > 
> 
> Ah. I didn't know. It seems like no one is using check.full.

Oh, they do, but it's subtle:

$ git grep seqres=
check:852:      seqres="$check"
check:1120:     seqres="$check"

--D

> -----
> $ find . -type f -exec grep check\.full {} \; -print
> 	rm -f $check.full
> ./check
> -----
> 
> Thanks, Anand
> 
> 
> > --D
> > 
> > > +
> > > +	# This function may be called outside a testcase during setup,
> > > +	# so seqres might not be set.
> > > +	if [[ -v seqres ]]; then
> > > +		logfile="$seqres.full"
> > > +	fi
> > >   	if [ ! -b "$dev" -o -z "$attr" -o -z "$content" ];then
> > >   		_fail "Usage: _set_fs_sysfs_attr <mounted_device> <attr> <content>"
> > > @@ -5208,8 +5215,8 @@ _set_fs_sysfs_attr()
> > >   	local dname=$(_fs_sysfs_dname $dev)
> > > -	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
> > > +	echo "echo '$content' 2>&1 > /sys/fs/${FSTYP}/${dname}/${attr}" >> $logfile
> > > +	echo "$content" 2>&1 > /sys/fs/${FSTYP}/${dname}/${attr} | tee -a $logfile
> > >   }
> > >   # Print the content of /sys/fs/$FSTYP/$DEV/$ATTR
> > > -- 
> > > 2.47.0
> > > 
> > > 
> 
> 




[Index of Archives]     [Linux Filesystems Development]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux