public inbox for fstests@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] xfs/191: skip tests on older xfsprogs
@ 2016-08-14 13:35 Xiao Yang
  2016-08-17  3:08 ` Xiao Yang
  0 siblings, 1 reply; 8+ messages in thread
From: Xiao Yang @ 2016-08-14 13:35 UTC (permalink / raw)
  To: fstests; +Cc: eguan, jtulak, root

From: root <root@localhost.localdomain>

If we don't have /tmp/foo file on xfsprogs 3.2.2, _require_xfs_mkfs_validation
will fail because mkfs.xfs can't create this file.  We need to skip tests
before xfsprogs 4.7.0, so fix it.  the feature has been introduced since
xfsprogs 4.2.0:
commit 20cec860e16b267ea0c71a2f648fa2b26aad2e65
Author: Eric Sandeen <sandeen@sandeen.net>
Date: Fri Jul 31 09:04:11 2015 +1000

  mkfs.xfs: always use underlying fs sector size when mkfs'ing a file

Signed-off-by: root <root@localhost.localdomain>
---
 common/rc | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/common/rc b/common/rc
index b19b698..db99794 100644
--- a/common/rc
+++ b/common/rc
@@ -3889,6 +3889,9 @@ _get_fs_sysfs_attr()
 # number of failed cases.
 _mkfs_validation_check()
 {
+	if [ ! -f /tmp/foo ]; then
+		touch /tmp/foo
+	fi
 	local cmd="$MKFS_XFS_PROG -f -N -d file,name=/tmp/foo,size=$((1024 * 1024 * 1024))"
 	$cmd -s size=2s >/dev/null 2>&1
 	local sum=$?
-- 
1.8.3.1




^ permalink raw reply related	[flat|nested] 8+ messages in thread

* Re: [PATCH] xfs/191: skip tests on older xfsprogs
  2016-08-14 13:35 Xiao Yang
@ 2016-08-17  3:08 ` Xiao Yang
  0 siblings, 0 replies; 8+ messages in thread
From: Xiao Yang @ 2016-08-17  3:08 UTC (permalink / raw)
  To: fstests; +Cc: jtulak

Sorry, please ingore it, I will resend it.
On 2016/08/14 21:35, Xiao Yang wrote:
> From: root <root@localhost.localdomain>
>
> If we don't have /tmp/foo file on xfsprogs 3.2.2, _require_xfs_mkfs_validation
> will fail because mkfs.xfs can't create this file.  We need to skip tests
> before xfsprogs 4.7.0, so fix it.  the feature has been introduced since
> xfsprogs 4.2.0:
> commit 20cec860e16b267ea0c71a2f648fa2b26aad2e65
> Author: Eric Sandeen <sandeen@sandeen.net>
> Date: Fri Jul 31 09:04:11 2015 +1000
>
>   mkfs.xfs: always use underlying fs sector size when mkfs'ing a file
>
> Signed-off-by: root <root@localhost.localdomain>
> ---
>  common/rc | 3 +++
>  1 file changed, 3 insertions(+)
>
> diff --git a/common/rc b/common/rc
> index b19b698..db99794 100644
> --- a/common/rc
> +++ b/common/rc
> @@ -3889,6 +3889,9 @@ _get_fs_sysfs_attr()
>  # number of failed cases.
>  _mkfs_validation_check()
>  {
> +	if [ ! -f /tmp/foo ]; then
> +		touch /tmp/foo
> +	fi
>  	local cmd="$MKFS_XFS_PROG -f -N -d file,name=/tmp/foo,size=$((1024 * 1024 * 1024))"
>  	$cmd -s size=2s >/dev/null 2>&1
>  	local sum=$?




^ permalink raw reply	[flat|nested] 8+ messages in thread

* [PATCH] xfs/191: skip tests on older xfsprogs
@ 2016-08-17  3:18 Xiao Yang
  2016-08-17  3:36 ` Eryu Guan
  0 siblings, 1 reply; 8+ messages in thread
From: Xiao Yang @ 2016-08-17  3:18 UTC (permalink / raw)
  To: fstests; +Cc: jtulak, Xiao Yang

If we don't have /tmp/foo file on xfsprogs 3.2.2, _require_xfs_mkfs_validation
will fail because mkfs.xfs can't create this file.  We need to skip tests
before xfsprogs 4.7.0, so fix it.  the feature has been introduced since
xfsprogs 4.2.0:
commit 20cec860e16b267ea0c71a2f648fa2b26aad2e65
Author: Eric Sandeen <sandeen@sandeen.net>
Date: Fri Jul 31 09:04:11 2015 +1000

  mkfs.xfs: always use underlying fs sector size when mkfs'ing a file

Signed-off-by: Xiao Yang <yangx.jy@cn.fujitsu.com>
---
 common/rc | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/common/rc b/common/rc
index b19b698..db99794 100644
--- a/common/rc
+++ b/common/rc
@@ -3889,6 +3889,9 @@ _get_fs_sysfs_attr()
 # number of failed cases.
 _mkfs_validation_check()
 {
+	if [ ! -f /tmp/foo ]; then
+		touch /tmp/foo
+	fi
 	local cmd="$MKFS_XFS_PROG -f -N -d file,name=/tmp/foo,size=$((1024 * 1024 * 1024))"
 	$cmd -s size=2s >/dev/null 2>&1
 	local sum=$?
-- 
1.8.3.1




^ permalink raw reply related	[flat|nested] 8+ messages in thread

* Re: [PATCH] xfs/191: skip tests on older xfsprogs
  2016-08-17  3:18 [PATCH] xfs/191: skip tests on older xfsprogs Xiao Yang
@ 2016-08-17  3:36 ` Eryu Guan
  2016-08-17  4:46   ` [PATCH v2] " Xiao Yang
  2016-08-17  9:27   ` [PATCH] " Jan Tulak
  0 siblings, 2 replies; 8+ messages in thread
From: Eryu Guan @ 2016-08-17  3:36 UTC (permalink / raw)
  To: Xiao Yang; +Cc: fstests, jtulak

On Wed, Aug 17, 2016 at 11:18:55AM +0800, Xiao Yang wrote:
> If we don't have /tmp/foo file on xfsprogs 3.2.2, _require_xfs_mkfs_validation
> will fail because mkfs.xfs can't create this file.  We need to skip tests
> before xfsprogs 4.7.0, so fix it.  the feature has been introduced since
> xfsprogs 4.2.0:
> commit 20cec860e16b267ea0c71a2f648fa2b26aad2e65
> Author: Eric Sandeen <sandeen@sandeen.net>
> Date: Fri Jul 31 09:04:11 2015 +1000
> 
>   mkfs.xfs: always use underlying fs sector size when mkfs'ing a file
> 
> Signed-off-by: Xiao Yang <yangx.jy@cn.fujitsu.com>
> ---
>  common/rc | 3 +++
>  1 file changed, 3 insertions(+)
> 
> diff --git a/common/rc b/common/rc
> index b19b698..db99794 100644
> --- a/common/rc
> +++ b/common/rc
> @@ -3889,6 +3889,9 @@ _get_fs_sysfs_attr()
>  # number of failed cases.
>  _mkfs_validation_check()
>  {
> +	if [ ! -f /tmp/foo ]; then
> +		touch /tmp/foo
> +	fi

I think the file can be touched unconditionally.

Thanks,
Eryu

>  	local cmd="$MKFS_XFS_PROG -f -N -d file,name=/tmp/foo,size=$((1024 * 1024 * 1024))"
>  	$cmd -s size=2s >/dev/null 2>&1
>  	local sum=$?
> -- 
> 1.8.3.1
> 
> 
> 
> --
> 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

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [PATCH v2] xfs/191: skip tests on older xfsprogs
  2016-08-17  3:36 ` Eryu Guan
@ 2016-08-17  4:46   ` Xiao Yang
  2016-08-18  1:04     ` Dave Chinner
  2016-08-17  9:27   ` [PATCH] " Jan Tulak
  1 sibling, 1 reply; 8+ messages in thread
From: Xiao Yang @ 2016-08-17  4:46 UTC (permalink / raw)
  To: fstests; +Cc: jtulak, Xiao Yang

If we don't have /tmp/foo file on xfsprogs 3.2.2, _require_xfs_mkfs_validation
will fail because mkfs.xfs can't create this file.  We need to skip tests
before xfsprogs 4.7.0, so fix it.  the feature has been introduced since
xfsprogs 4.2.0:
  commit 20cec860e16b267ea0c71a2f648fa2b26aad2e65
  Author: Eric Sandeen <sandeen@sandeen.net>
  Date: Fri Jul 31 09:04:11 2015 +1000
    mkfs.xfs: always use underlying fs sector size when mkfs'ing a file

Signed-off-by: Xiao Yang <yangx.jy@cn.fujitsu.com>
---
 common/rc | 1 +
 1 file changed, 1 insertion(+)

diff --git a/common/rc b/common/rc
index b19b698..1907c70 100644
--- a/common/rc
+++ b/common/rc
@@ -3889,6 +3889,7 @@ _get_fs_sysfs_attr()
 # number of failed cases.
 _mkfs_validation_check()
 {
+	touch /tmp/foo >/dev/null 2>&1
 	local cmd="$MKFS_XFS_PROG -f -N -d file,name=/tmp/foo,size=$((1024 * 1024 * 1024))"
 	$cmd -s size=2s >/dev/null 2>&1
 	local sum=$?
-- 
1.8.3.1




^ permalink raw reply related	[flat|nested] 8+ messages in thread

* Re: [PATCH] xfs/191: skip tests on older xfsprogs
  2016-08-17  3:36 ` Eryu Guan
  2016-08-17  4:46   ` [PATCH v2] " Xiao Yang
@ 2016-08-17  9:27   ` Jan Tulak
  1 sibling, 0 replies; 8+ messages in thread
From: Jan Tulak @ 2016-08-17  9:27 UTC (permalink / raw)
  To: Eryu Guan; +Cc: Xiao Yang, fstests

On Wed, Aug 17, 2016 at 5:36 AM, Eryu Guan <eguan@redhat.com> wrote:

>>  _mkfs_validation_check()
>>  {
>> +     if [ ! -f /tmp/foo ]; then
>> +             touch /tmp/foo
>> +     fi
>
> I think the file can be touched unconditionally.
>

If the file already exists and mtime/atime of the file is important,
then it could be an issue. It looks improbable, but still, maybe we
should be on the safe side?

Anyway, thanks for spotting this.

Jan

-- 
Jan Tulak
jtulak@redhat.com / jan@tulak.me

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH v2] xfs/191: skip tests on older xfsprogs
  2016-08-17  4:46   ` [PATCH v2] " Xiao Yang
@ 2016-08-18  1:04     ` Dave Chinner
  2016-08-18  3:09       ` [PATCH v3] " Xiao Yang
  0 siblings, 1 reply; 8+ messages in thread
From: Dave Chinner @ 2016-08-18  1:04 UTC (permalink / raw)
  To: Xiao Yang; +Cc: fstests, jtulak

On Wed, Aug 17, 2016 at 12:46:01PM +0800, Xiao Yang wrote:
> If we don't have /tmp/foo file on xfsprogs 3.2.2, _require_xfs_mkfs_validation
> will fail because mkfs.xfs can't create this file.  We need to skip tests
> before xfsprogs 4.7.0, so fix it.  the feature has been introduced since
> xfsprogs 4.2.0:
>   commit 20cec860e16b267ea0c71a2f648fa2b26aad2e65
>   Author: Eric Sandeen <sandeen@sandeen.net>
>   Date: Fri Jul 31 09:04:11 2015 +1000
>     mkfs.xfs: always use underlying fs sector size when mkfs'ing a file
> 
> Signed-off-by: Xiao Yang <yangx.jy@cn.fujitsu.com>
> ---
>  common/rc | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/common/rc b/common/rc
> index b19b698..1907c70 100644
> --- a/common/rc
> +++ b/common/rc
> @@ -3889,6 +3889,7 @@ _get_fs_sysfs_attr()
>  # number of failed cases.
>  _mkfs_validation_check()
>  {
> +	touch /tmp/foo >/dev/null 2>&1
>  	local cmd="$MKFS_XFS_PROG -f -N -d file,name=/tmp/foo,size=$((1024 * 1024 * 1024))"
>  	$cmd -s size=2s >/dev/null 2>&1
>  	local sum=$?


Couple of things here:

	1. this is an xfs specific check. The function needs to have
	   "xfs" in it's name. i.e. _xfs_mkfs_validation_check

	2. Don't hard code temporary files ie use mktemp for
	   creating the file like so:

		imgfile=`mktemp`
		.....
		rm -f $imgfile

	3. mkfs.xfs takes human readable units for sizes, such as
	   "1g" for a 1GB filesystem and "260k" for the log size. No
	   need calculations in the script for this, and this gets
	   rid of overly long lines and makes it easier to read.

	4. Whitespace between each check and result processing makes
	   it much easier to see each of the operations being
	   performed during the check.

i.e.

_xfs_mkfs_validation_check()
{
	local imgfile=`mktemp`
	local cmd="$MKFS_XFS_PROG -f -N -d file,name=/tmp/foo,size=1g"

	$cmd -s size=2s >/dev/null 2>&1
	local sum=$?

	$cmd -l version=2,su=260k >/dev/null 2>&1
	sum=`expr $sum + $?`

	rm -f $imgfile
	return $sum
}

Cheers,

Dave.
-- 
Dave Chinner
david@fromorbit.com

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [PATCH v3] xfs/191: skip tests on older xfsprogs
  2016-08-18  1:04     ` Dave Chinner
@ 2016-08-18  3:09       ` Xiao Yang
  0 siblings, 0 replies; 8+ messages in thread
From: Xiao Yang @ 2016-08-18  3:09 UTC (permalink / raw)
  To: david; +Cc: fstests, jtulak, Xiao Yang

If we don't have temp file used to test on xfsprogs 3.2.2,
_require_xfs_mkfs_validation will fail because mkfs.xfs can't
create this file.  We need to skip tests before xfsprogs 4.7.0,
so fix it.  the feature has been introduced since xfsprogs 4.2.0:
  Commit 20cec860e16b267ea0c71a2f648fa2b26aad2e65
  Author: Eric Sandeen <sandeen@sandeen.net>
  Date: Fri Jul 31 09:04:11 2015 +1000
    mkfs.xfs: always use underlying fs sector size when mkfs'ing a file

Signed-off-by: Xiao Yang <yangx.jy@cn.fujitsu.com>
---
 common/rc | 16 ++++++++++------
 1 file changed, 10 insertions(+), 6 deletions(-)

diff --git a/common/rc b/common/rc
index b19b698..b716d26 100644
--- a/common/rc
+++ b/common/rc
@@ -3887,21 +3887,25 @@ _get_fs_sysfs_attr()
 #
 # At first, make a common function that runs the tests and returns
 # number of failed cases.
-_mkfs_validation_check()
+_xfs_mkfs_validation_check()
 {
-	local cmd="$MKFS_XFS_PROG -f -N -d file,name=/tmp/foo,size=$((1024 * 1024 * 1024))"
+	local tmpfile=`mktemp`
+	local cmd="$MKFS_XFS_PROG -f -N -d file,name=$tmpfile,size=1g"
+
 	$cmd -s size=2s >/dev/null 2>&1
 	local sum=$?
-	$cmd -l version=2,su=$((256 * 1024 + 4096)) >/dev/null 2>&1
+
+	$cmd -l version=2,su=260k >/dev/null 2>&1
 	sum=`expr $sum + $?`
-	rm -f /tmp/foo
+
+	rm -f $tmpfile
 	return $sum
 }
 
 # Skip the test if all calls passed - mkfs accepts invalid input
 _require_xfs_mkfs_validation()
 {
-	_mkfs_validation_check
+	_xfs_mkfs_validation_check
 	if [ "$?" -eq 0 ]; then
 		_notrun "Requires newer mkfs with stricter input checks: the oldest supported version of xfsprogs is 4.7."
 	fi
@@ -3910,7 +3914,7 @@ _require_xfs_mkfs_validation()
 # The oposite of _require_xfs_mkfs_validation.
 _require_xfs_mkfs_without_validation()
 {
-	_mkfs_validation_check
+	_xfs_mkfs_validation_check
 	if [ "$?" -ne 0 ]; then
 		_notrun "Requires older mkfs without strict input checks: the last supported version of xfsprogs is 4.5."
 	fi
-- 
1.8.3.1




^ permalink raw reply related	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2016-08-18  3:12 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-08-17  3:18 [PATCH] xfs/191: skip tests on older xfsprogs Xiao Yang
2016-08-17  3:36 ` Eryu Guan
2016-08-17  4:46   ` [PATCH v2] " Xiao Yang
2016-08-18  1:04     ` Dave Chinner
2016-08-18  3:09       ` [PATCH v3] " Xiao Yang
2016-08-17  9:27   ` [PATCH] " Jan Tulak
  -- strict thread matches above, loose matches on Subject: below --
2016-08-14 13:35 Xiao Yang
2016-08-17  3:08 ` Xiao Yang

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox