On Mon, Jul 13, 2020 at 07:32:57PM +0800, Anand Jain wrote:
>
>
>
> > > +# check if the show_devname() returns the sprout device instead of seed device.
> > > +cat /proc/self/mounts | grep $SCRATCH_MNT | awk '{print $1}' | \
> > > + _filter_devs $sprout
> >
> > Why does this have to be so complicated - 4 chained program executions,
> > 1 additional function...
> >
>
> For example:
> /dev/sdb /btrfs btrfs ro,relatime,noacl,space_cache,subvolid=5,subvol=/ 0 0
>
> $1 to $3 remain constant, but $4 options might vary. So to avoid
> unnecessary breakage of test case due to kernel updates or mount
> options, I just used $1.
>
> > dev=$(grep $SCRATCH_MOUNT /proc/mounts | awk '{printf $1}')
This looks simpler, just use $AWK_PROG instead of bare awk.
> >
> > if [ $sprout != $dev ]; then
> > _fail "Unexpected device"
> > fi
> fstests prefers use of .out file to look for the expected string.
> Will wait for Eryu comments.
Even $dev is not constant, we don't have to filter the device to
"SCRATCH_DEV" by _filter_devs. Just do
echo "Silence is golden"
if [ "$sprout" != "$dev" ]; then
echo "Unexpected device: $dev"
fi
Thanks,
Eryu