diff mbox series

[v2] generic: test i_blocks for large files

Message ID 20220816104536.273937-1-preichl@redhat.com (mailing list archive)
State New, archived
Headers show
Series [v2] generic: test i_blocks for large files | expand

Commit Message

Pavel Reichl Aug. 16, 2022, 10:45 a.m. UTC
This is a regression test for an incorrect
computation of i_blocks for files larger than
4 GiB. Bug was filed for exFAT.

Signed-off-by: Pavel Reichl <preichl@redhat.com>
---
 common/rc             | 10 ++++++++++
 tests/generic/693     | 46 +++++++++++++++++++++++++++++++++++++++++++
 tests/generic/693.out |  2 ++
 3 files changed, 58 insertions(+)
 create mode 100755 tests/generic/693
 create mode 100644 tests/generic/693.out

Comments

Darrick J. Wong Aug. 16, 2022, 3:58 p.m. UTC | #1
On Tue, Aug 16, 2022 at 12:45:36PM +0200, Pavel Reichl wrote:
> This is a regression test for an incorrect
> computation of i_blocks for files larger than
> 4 GiB. Bug was filed for exFAT.
> 
> Signed-off-by: Pavel Reichl <preichl@redhat.com>
> ---
>  common/rc             | 10 ++++++++++
>  tests/generic/693     | 46 +++++++++++++++++++++++++++++++++++++++++++
>  tests/generic/693.out |  2 ++
>  3 files changed, 58 insertions(+)
>  create mode 100755 tests/generic/693
>  create mode 100644 tests/generic/693.out
> 
> diff --git a/common/rc b/common/rc
> index 197c9415..06cbdee5 100644
> --- a/common/rc
> +++ b/common/rc
> @@ -1980,6 +1980,16 @@ _require_test()
>      touch ${RESULT_DIR}/require_test
>  }
>  
> +# require a test dev of a minimum size (in kb)
> +_require_test_size()
> +{
> +	[ $# -eq 1 ] || _fail "_require_test_size: expected size param"
> +
> +	_require_test
> +	local devsize=`_get_device_size $TEST_DEV`
> +	[ $devsize -lt $1 ] && _notrun "test dev too small"
> +}
> +
>  _has_logdev()
>  {
>  	local ret=0
> diff --git a/tests/generic/693 b/tests/generic/693
> new file mode 100755
> index 00000000..a6d1abff
> --- /dev/null
> +++ b/tests/generic/693
> @@ -0,0 +1,46 @@
> +#! /bin/bash
> +# SPDX-License-Identifier: GPL-2.0
> +# Copyright (c) 2022  Red Hat Inc. All Rights Reserved.
> +#
> +# FS QA Test 693
> +#
> +# Verify that i_blocks for files larger than 4 GiB have correct
> +# values.
> +#
> +# This test verifies the problem fixed in kernel with commit
> +# 0c336d6e33f4 exfat: fix incorrect loading of i_blocks for large files
> +#
> +. ./common/preamble
> +_begin_fstest auto
> +
> +# Override the default cleanup function.
> +_cleanup()
> +{
> +	cd /
> +	rm -r -f $tmp.* $junk_dir
> +}
> +
> +_supported_fs generic
> +_require_test_size $((4 * 1024 * 1024)) #kB

What does this new helper do that "_require_fs_space $TEST_DIR 4194304"
wouldn't solve?

--D

> +
> +echo "Silence is golden"
> +
> +junk_dir=$TEST_DIR/$seq
> +junk_file=$junk_dir/junk
> +mkdir -p $junk_dir
> +
> +$XFS_IO_PROG -f -c "pwrite -W 0 4G" $junk_file > /dev/null
> +
> +iblocks=`stat -c '%b' $junk_file`
> +
> +_test_cycle_mount
> +
> +iblocks_after_remount=`stat -c '%b' $junk_file`
> +
> +if [ "$iblocks" != "$iblocks_after_remount" ]; then
> +	echo "Number of blocks needs to be same: $iblocks, $iblocks_after_remount"
> +fi
> +
> +status=0
> +
> +exit
> diff --git a/tests/generic/693.out b/tests/generic/693.out
> new file mode 100644
> index 00000000..01884ea5
> --- /dev/null
> +++ b/tests/generic/693.out
> @@ -0,0 +1,2 @@
> +QA output created by 693
> +Silence is golden
> -- 
> 2.37.2
>
Pavel Reichl Aug. 16, 2022, 4:08 p.m. UTC | #2
On 8/16/22 17:58, Darrick J. Wong wrote:
> On Tue, Aug 16, 2022 at 12:45:36PM +0200, Pavel Reichl wrote:
>> This is a regression test for an incorrect
>> computation of i_blocks for files larger than
>> 4 GiB. Bug was filed for exFAT.
>>
>> Signed-off-by: Pavel Reichl <preichl@redhat.com>
>> ---
>>   common/rc             | 10 ++++++++++
>>   tests/generic/693     | 46 +++++++++++++++++++++++++++++++++++++++++++
>>   tests/generic/693.out |  2 ++
>>   3 files changed, 58 insertions(+)
>>   create mode 100755 tests/generic/693
>>   create mode 100644 tests/generic/693.out
>>
>> diff --git a/common/rc b/common/rc
>> index 197c9415..06cbdee5 100644
>> --- a/common/rc
>> +++ b/common/rc
>> @@ -1980,6 +1980,16 @@ _require_test()
>>       touch ${RESULT_DIR}/require_test
>>   }
>>   
>> +# require a test dev of a minimum size (in kb)
>> +_require_test_size()
>> +{
>> +	[ $# -eq 1 ] || _fail "_require_test_size: expected size param"
>> +
>> +	_require_test
>> +	local devsize=`_get_device_size $TEST_DEV`
>> +	[ $devsize -lt $1 ] && _notrun "test dev too small"
>> +}
>> +
>>   _has_logdev()
>>   {
>>   	local ret=0
>> diff --git a/tests/generic/693 b/tests/generic/693
>> new file mode 100755
>> index 00000000..a6d1abff
>> --- /dev/null
>> +++ b/tests/generic/693
>> @@ -0,0 +1,46 @@
>> +#! /bin/bash
>> +# SPDX-License-Identifier: GPL-2.0
>> +# Copyright (c) 2022  Red Hat Inc. All Rights Reserved.
>> +#
>> +# FS QA Test 693
>> +#
>> +# Verify that i_blocks for files larger than 4 GiB have correct
>> +# values.
>> +#
>> +# This test verifies the problem fixed in kernel with commit
>> +# 0c336d6e33f4 exfat: fix incorrect loading of i_blocks for large files
>> +#
>> +. ./common/preamble
>> +_begin_fstest auto
>> +
>> +# Override the default cleanup function.
>> +_cleanup()
>> +{
>> +	cd /
>> +	rm -r -f $tmp.* $junk_dir
>> +}
>> +
>> +_supported_fs generic
>> +_require_test_size $((4 * 1024 * 1024)) #kB
> What does this new helper do that "_require_fs_space $TEST_DIR 4194304"
> wouldn't solve?

Hello,

nothingĀ  - I was not aware of that. I'll change it to use 
'_require_fs_space'

Thanks!

> --D
>
>> +
>> +echo "Silence is golden"
>> +
>> +junk_dir=$TEST_DIR/$seq
>> +junk_file=$junk_dir/junk
>> +mkdir -p $junk_dir
>> +
>> +$XFS_IO_PROG -f -c "pwrite -W 0 4G" $junk_file > /dev/null
>> +
>> +iblocks=`stat -c '%b' $junk_file`
>> +
>> +_test_cycle_mount
>> +
>> +iblocks_after_remount=`stat -c '%b' $junk_file`
>> +
>> +if [ "$iblocks" != "$iblocks_after_remount" ]; then
>> +	echo "Number of blocks needs to be same: $iblocks, $iblocks_after_remount"
>> +fi
>> +
>> +status=0
>> +
>> +exit
>> diff --git a/tests/generic/693.out b/tests/generic/693.out
>> new file mode 100644
>> index 00000000..01884ea5
>> --- /dev/null
>> +++ b/tests/generic/693.out
>> @@ -0,0 +1,2 @@
>> +QA output created by 693
>> +Silence is golden
>> -- 
>> 2.37.2
>>
diff mbox series

Patch

diff --git a/common/rc b/common/rc
index 197c9415..06cbdee5 100644
--- a/common/rc
+++ b/common/rc
@@ -1980,6 +1980,16 @@  _require_test()
     touch ${RESULT_DIR}/require_test
 }
 
+# require a test dev of a minimum size (in kb)
+_require_test_size()
+{
+	[ $# -eq 1 ] || _fail "_require_test_size: expected size param"
+
+	_require_test
+	local devsize=`_get_device_size $TEST_DEV`
+	[ $devsize -lt $1 ] && _notrun "test dev too small"
+}
+
 _has_logdev()
 {
 	local ret=0
diff --git a/tests/generic/693 b/tests/generic/693
new file mode 100755
index 00000000..a6d1abff
--- /dev/null
+++ b/tests/generic/693
@@ -0,0 +1,46 @@ 
+#! /bin/bash
+# SPDX-License-Identifier: GPL-2.0
+# Copyright (c) 2022  Red Hat Inc. All Rights Reserved.
+#
+# FS QA Test 693
+#
+# Verify that i_blocks for files larger than 4 GiB have correct
+# values.
+#
+# This test verifies the problem fixed in kernel with commit
+# 0c336d6e33f4 exfat: fix incorrect loading of i_blocks for large files
+#
+. ./common/preamble
+_begin_fstest auto
+
+# Override the default cleanup function.
+_cleanup()
+{
+	cd /
+	rm -r -f $tmp.* $junk_dir
+}
+
+_supported_fs generic
+_require_test_size $((4 * 1024 * 1024)) #kB
+
+echo "Silence is golden"
+
+junk_dir=$TEST_DIR/$seq
+junk_file=$junk_dir/junk
+mkdir -p $junk_dir
+
+$XFS_IO_PROG -f -c "pwrite -W 0 4G" $junk_file > /dev/null
+
+iblocks=`stat -c '%b' $junk_file`
+
+_test_cycle_mount
+
+iblocks_after_remount=`stat -c '%b' $junk_file`
+
+if [ "$iblocks" != "$iblocks_after_remount" ]; then
+	echo "Number of blocks needs to be same: $iblocks, $iblocks_after_remount"
+fi
+
+status=0
+
+exit
diff --git a/tests/generic/693.out b/tests/generic/693.out
new file mode 100644
index 00000000..01884ea5
--- /dev/null
+++ b/tests/generic/693.out
@@ -0,0 +1,2 @@ 
+QA output created by 693
+Silence is golden