Message ID | 1455069001-17846-9-git-send-email-tytso@mit.edu (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
On Tue, Feb 09, 2016 at 08:49:57PM -0500, Theodore Ts'o wrote: > From: Hugh Dickins <hughd@google.com> > > 312 avoid reading /proc/partitions for tmpfs, just assume enough space. > > Signed-off-by: Hugh Dickins <hughd@google.com> > Signed-off-by: Theodore Ts'o <tytso@mit.edu> > --- > tests/generic/312 | 11 ++++++----- > 1 file changed, 6 insertions(+), 5 deletions(-) > > diff --git a/tests/generic/312 b/tests/generic/312 > index b570814..a826071 100755 > --- a/tests/generic/312 > +++ b/tests/generic/312 > @@ -51,12 +51,13 @@ _require_scratch > > # 5G in byte > fssize=$((2**30 * 5)) > -required_blocks=$(($fssize / 1024)) > -dev_blocks=$(grep -w $(_short_dev $SCRATCH_DEV) /proc/partitions | $AWK_PROG '{print $3}') > -if [ $required_blocks -gt $dev_blocks ];then > - _notrun "this test requires \$SCRATCH_DEV has ${fssize}B space" > +if [ "$FSTYP" != "tmpfs" ]; then > + required_blocks=$(($fssize / 1024)) > + dev_blocks=$(grep -w $(_short_dev $SCRATCH_DEV) /proc/partitions | $AWK_PROG '{print $3}') > + if [ $required_blocks -gt $dev_blocks ];then > + _notrun "this test requires \$SCRATCH_DEV has ${fssize}B space" > + fi > fi _scratch_mkfs _scratch_mount _require_fs_space $SCRATCH_MNT $((fssize / 1024)) _scratch_unmount _scratch_mkfs_sized $fssize Cheers, Dave.
On Wed, Feb 10, 2016 at 04:54:55PM +1100, Dave Chinner wrote: > > _scratch_mkfs > _scratch_mount > _require_fs_space $SCRATCH_MNT $((fssize / 1024)) > _scratch_unmount > _scratch_mkfs_sized $fssize This doesn't work because _require_fs_space uses df -klP, and the -l file systems with names such as "test:/scratch" to be filtered out --- and xfstests requires us to use NFS-looking names as a hint that the file system has no block device. This results in "_require_fs_space" failing on tmpfs file systems with the error messages: df: no file systems processed ./common/rc: line 1860: [: -lt: unary operator expected I'm not sure why the -l option is being used at all in the first place. Any objections if I remove it? Presumably this is also causing _require_fs_space to blow up on any tests run using NFS.... Alternatively I could just remove if it $FSTYP == tmpfs, but that assumes there was some reason for using the -l option in the first place. - Ted -- 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
On Wed, Feb 10, 2016 at 06:39:11PM -0500, Theodore Ts'o wrote: > On Wed, Feb 10, 2016 at 04:54:55PM +1100, Dave Chinner wrote: > > > > _scratch_mkfs > > _scratch_mount > > _require_fs_space $SCRATCH_MNT $((fssize / 1024)) > > _scratch_unmount > > _scratch_mkfs_sized $fssize > > This doesn't work because _require_fs_space uses df -klP, and the -l > file systems with names such as "test:/scratch" to be filtered out --- > and xfstests requires us to use NFS-looking names as a hint that the > file system has no block device. > > This results in "_require_fs_space" failing on tmpfs file systems with > the error messages: > > df: no file systems processed > ./common/rc: line 1860: [: -lt: unary operator expected > > I'm not sure why the -l option is being used at all in the first > place. Any objections if I remove it? Presumably this is also > causing _require_fs_space to blow up on any tests run using NFS.... No idea on why -l is used. If there is a reason to be found, it will be in the commit history. > Alternatively I could just remove if it $FSTYP == tmpfs, but that > assumes there was some reason for using the -l option in the first > place. Remove it, see what breaks/who complains. Cheers, Dave.
diff --git a/tests/generic/312 b/tests/generic/312 index b570814..a826071 100755 --- a/tests/generic/312 +++ b/tests/generic/312 @@ -51,12 +51,13 @@ _require_scratch # 5G in byte fssize=$((2**30 * 5)) -required_blocks=$(($fssize / 1024)) -dev_blocks=$(grep -w $(_short_dev $SCRATCH_DEV) /proc/partitions | $AWK_PROG '{print $3}') -if [ $required_blocks -gt $dev_blocks ];then - _notrun "this test requires \$SCRATCH_DEV has ${fssize}B space" +if [ "$FSTYP" != "tmpfs" ]; then + required_blocks=$(($fssize / 1024)) + dev_blocks=$(grep -w $(_short_dev $SCRATCH_DEV) /proc/partitions | $AWK_PROG '{print $3}') + if [ $required_blocks -gt $dev_blocks ];then + _notrun "this test requires \$SCRATCH_DEV has ${fssize}B space" + fi fi - rm -f $seqres.full _scratch_mkfs_sized $fssize >>$seqres.full 2>&1 _scratch_mount >>$seqres.full 2>&1