diff mbox series

[6/9] Add the ability to require O_TMPFILE to be supported for a test

Message ID 162194966940.4011860.15702357969023449902.stgit@warthog.procyon.org.uk (mailing list archive)
State New, archived
Headers show
Series Add support for using xfstests to test AFS | expand

Commit Message

David Howells May 25, 2021, 1:34 p.m. UTC
Provide a '_require_o_tmpfile' clause so that a test can require than
O_TMPFILE be supported by the filesystem being tested.

Signed-off-by: David Howells <dhowells@redhat.com>
cc: linux-afs@lists.infradead.org
---

 common/rc                    |    9 +++++++++
 doc/requirement-checking.txt |    7 +++++++
 tests/generic/531            |    1 +
 3 files changed, 17 insertions(+)

Comments

Darrick J. Wong May 25, 2021, 4:19 p.m. UTC | #1
On Tue, May 25, 2021 at 02:34:29PM +0100, David Howells wrote:
> Provide a '_require_o_tmpfile' clause so that a test can require than
> O_TMPFILE be supported by the filesystem being tested.
> 
> Signed-off-by: David Howells <dhowells@redhat.com>
> cc: linux-afs@lists.infradead.org

Looks good to me,
Reviewed-by: Darrick J. Wong <djwong@kernel.org>

--D

> ---
> 
>  common/rc                    |    9 +++++++++
>  doc/requirement-checking.txt |    7 +++++++
>  tests/generic/531            |    1 +
>  3 files changed, 17 insertions(+)
> 
> diff --git a/common/rc b/common/rc
> index e25967d9..c0659215 100644
> --- a/common/rc
> +++ b/common/rc
> @@ -4640,6 +4640,15 @@ _require_unix_perm_checking()
>  	esac
>  }
>  
> +_require_o_tmpfile()
> +{
> +	case $FSTYP in
> +	afs)
> +		_notrun "O_TMPFILE is not supported on $FSTYP"
> +		;;
> +	esac
> +}
> +
>  init_rc
>  
>  ################################################################################
> diff --git a/doc/requirement-checking.txt b/doc/requirement-checking.txt
> index 9be7a84c..b708887b 100644
> --- a/doc/requirement-checking.txt
> +++ b/doc/requirement-checking.txt
> @@ -21,6 +21,7 @@ they have.  This is done with _require_<xxx> macros, which may take parameters.
>  	_require_sgid_inheritance
>  	_require_use_local_uidgid
>  	_require_unix_perm_checking
> +	_require_o_tmpfile
>  
>   (3) System call requirements.
>  
> @@ -129,6 +130,12 @@ _require_unix_perm_checking
>       some alternative distributed permissions model involving authentication
>       tokens rather than the local fsuid/fsgid.
>  
> +_require_o_tmpfile
> +
> +     The test requires that O_TMPFILE is supported by open() on that
> +     filesystem, thereby allowing the creation of temporary files to be used or
> +     tested.
> +
>  
>  ========================
>  SYSTEM CALL REQUIREMENTS
> diff --git a/tests/generic/531 b/tests/generic/531
> index e76418ca..2f3b1dc6 100755
> --- a/tests/generic/531
> +++ b/tests/generic/531
> @@ -32,6 +32,7 @@ _cleanup()
>  _supported_fs generic
>  _require_scratch
>  _require_test_program "t_open_tmpfiles"
> +_require_o_tmpfile
>  
>  rm -f $seqres.full
>  _scratch_mkfs >> $seqres.full 2>&1
> 
>
Eryu Guan May 30, 2021, 12:54 p.m. UTC | #2
On Tue, May 25, 2021 at 02:34:29PM +0100, David Howells wrote:
> Provide a '_require_o_tmpfile' clause so that a test can require than
> O_TMPFILE be supported by the filesystem being tested.
> 
> Signed-off-by: David Howells <dhowells@redhat.com>
> cc: linux-afs@lists.infradead.org
> ---
> 
>  common/rc                    |    9 +++++++++
>  doc/requirement-checking.txt |    7 +++++++
>  tests/generic/531            |    1 +
>  3 files changed, 17 insertions(+)
> 
> diff --git a/common/rc b/common/rc
> index e25967d9..c0659215 100644
> --- a/common/rc
> +++ b/common/rc
> @@ -4640,6 +4640,15 @@ _require_unix_perm_checking()
>  	esac
>  }
>  
> +_require_o_tmpfile()
> +{
> +	case $FSTYP in
> +	afs)
> +		_notrun "O_TMPFILE is not supported on $FSTYP"
> +		;;
> +	esac
> +}
> +

We could use _require_xfs_io_command "-T" to check if O_TMPFILE is
supported or not.

Thanks,
Eryu

>  init_rc
>  
>  ################################################################################
> diff --git a/doc/requirement-checking.txt b/doc/requirement-checking.txt
> index 9be7a84c..b708887b 100644
> --- a/doc/requirement-checking.txt
> +++ b/doc/requirement-checking.txt
> @@ -21,6 +21,7 @@ they have.  This is done with _require_<xxx> macros, which may take parameters.
>  	_require_sgid_inheritance
>  	_require_use_local_uidgid
>  	_require_unix_perm_checking
> +	_require_o_tmpfile
>  
>   (3) System call requirements.
>  
> @@ -129,6 +130,12 @@ _require_unix_perm_checking
>       some alternative distributed permissions model involving authentication
>       tokens rather than the local fsuid/fsgid.
>  
> +_require_o_tmpfile
> +
> +     The test requires that O_TMPFILE is supported by open() on that
> +     filesystem, thereby allowing the creation of temporary files to be used or
> +     tested.
> +
>  
>  ========================
>  SYSTEM CALL REQUIREMENTS
> diff --git a/tests/generic/531 b/tests/generic/531
> index e76418ca..2f3b1dc6 100755
> --- a/tests/generic/531
> +++ b/tests/generic/531
> @@ -32,6 +32,7 @@ _cleanup()
>  _supported_fs generic
>  _require_scratch
>  _require_test_program "t_open_tmpfiles"
> +_require_o_tmpfile
>  
>  rm -f $seqres.full
>  _scratch_mkfs >> $seqres.full 2>&1
>
diff mbox series

Patch

diff --git a/common/rc b/common/rc
index e25967d9..c0659215 100644
--- a/common/rc
+++ b/common/rc
@@ -4640,6 +4640,15 @@  _require_unix_perm_checking()
 	esac
 }
 
+_require_o_tmpfile()
+{
+	case $FSTYP in
+	afs)
+		_notrun "O_TMPFILE is not supported on $FSTYP"
+		;;
+	esac
+}
+
 init_rc
 
 ################################################################################
diff --git a/doc/requirement-checking.txt b/doc/requirement-checking.txt
index 9be7a84c..b708887b 100644
--- a/doc/requirement-checking.txt
+++ b/doc/requirement-checking.txt
@@ -21,6 +21,7 @@  they have.  This is done with _require_<xxx> macros, which may take parameters.
 	_require_sgid_inheritance
 	_require_use_local_uidgid
 	_require_unix_perm_checking
+	_require_o_tmpfile
 
  (3) System call requirements.
 
@@ -129,6 +130,12 @@  _require_unix_perm_checking
      some alternative distributed permissions model involving authentication
      tokens rather than the local fsuid/fsgid.
 
+_require_o_tmpfile
+
+     The test requires that O_TMPFILE is supported by open() on that
+     filesystem, thereby allowing the creation of temporary files to be used or
+     tested.
+
 
 ========================
 SYSTEM CALL REQUIREMENTS
diff --git a/tests/generic/531 b/tests/generic/531
index e76418ca..2f3b1dc6 100755
--- a/tests/generic/531
+++ b/tests/generic/531
@@ -32,6 +32,7 @@  _cleanup()
 _supported_fs generic
 _require_scratch
 _require_test_program "t_open_tmpfiles"
+_require_o_tmpfile
 
 rm -f $seqres.full
 _scratch_mkfs >> $seqres.full 2>&1