diff mbox series

[2/5] xfs/020: fix truncation test

Message ID 158086091464.1989378.4282506455041445127.stgit@magnolia (mailing list archive)
State New, archived
Headers show
Series fstests: random fixes | expand

Commit Message

Darrick J. Wong Feb. 5, 2020, 12:01 a.m. UTC
From: Darrick J. Wong <darrick.wong@oracle.com>

If we can't create the 60T sparse image for testing repair on a large fs
(such as when running on 32-bit), don't bother running the rest of the
test.  This requires the actual truncate(1) command, because it returns
nonzero if the system call fails.

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
---
 tests/xfs/020 |    4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

Comments

Zorro Lang Feb. 6, 2020, 4:44 a.m. UTC | #1
On Tue, Feb 04, 2020 at 04:01:54PM -0800, Darrick J. Wong wrote:
> From: Darrick J. Wong <darrick.wong@oracle.com>
> 
> If we can't create the 60T sparse image for testing repair on a large fs
> (such as when running on 32-bit), don't bother running the rest of the
> test.  This requires the actual truncate(1) command, because it returns
> nonzero if the system call fails.
> 
> Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
> ---
>  tests/xfs/020 |    4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
> 
> 
> diff --git a/tests/xfs/020 b/tests/xfs/020
> index 66433b0a..4f617379 100755
> --- a/tests/xfs/020
> +++ b/tests/xfs/020
> @@ -42,7 +42,9 @@ echo "Silence is golden"
>  
>  fsfile=$TEST_DIR/fsfile.$seq
>  rm -f $fsfile
> -$XFS_IO_PROG -f -c "truncate 60t" $fsfile || _notrun "Cannot create 60T sparse file for test."
> +# The actual truncate command is required here (and not xfs_io) because it
> +# returns nonzero if the operation fails.
> +truncate -s 60t $fsfile || _notrun "Cannot create 60T sparse file for test."

Good to me.

>  rm -f $fsfile
>  
>  $MKFS_PROG -t xfs -d size=60t,file,name=$fsfile >/dev/null
>
diff mbox series

Patch

diff --git a/tests/xfs/020 b/tests/xfs/020
index 66433b0a..4f617379 100755
--- a/tests/xfs/020
+++ b/tests/xfs/020
@@ -42,7 +42,9 @@  echo "Silence is golden"
 
 fsfile=$TEST_DIR/fsfile.$seq
 rm -f $fsfile
-$XFS_IO_PROG -f -c "truncate 60t" $fsfile || _notrun "Cannot create 60T sparse file for test."
+# The actual truncate command is required here (and not xfs_io) because it
+# returns nonzero if the operation fails.
+truncate -s 60t $fsfile || _notrun "Cannot create 60T sparse file for test."
 rm -f $fsfile
 
 $MKFS_PROG -t xfs -d size=60t,file,name=$fsfile >/dev/null