FS/XFS testing framework
 help / color / mirror / Atom feed
* [PATCH v2] generic/571: skip test on filesystems that don't support F_SETLEASE fcntl
@ 2020-04-01 17:26 Scott Mayhew
  2020-04-02 10:39 ` Christoph Hellwig
  0 siblings, 1 reply; 3+ messages in thread
From: Scott Mayhew @ 2020-04-01 17:26 UTC (permalink / raw)
  To: fstests

Add an option to the locktest program to check for fcntl setlease
support, and skip the generic/571 test on filesystems where the check
returns EINVAL.

Signed-off-by: Scott Mayhew <smayhew@redhat.com>
---
 common/rc         |  8 ++++++++
 src/locktest.c    | 14 +++++++++++++-
 tests/generic/571 |  1 +
 3 files changed, 22 insertions(+), 1 deletion(-)

diff --git a/common/rc b/common/rc
index 454f5ccf..504232fd 100644
--- a/common/rc
+++ b/common/rc
@@ -3501,6 +3501,14 @@ _require_test_fcntl_advisory_locks()
 		_notrun "Require fcntl advisory locks support"
 }
 
+_require_test_fcntl_setlease()
+{
+	_require_test_program "locktest"
+	touch $TEST_DIR/setlease_testfile
+	$here/src/locktest -t $TEST_DIR/setlease_testfile >/dev/null 2>&1
+	[ $? -eq 22 ] && _notrun "Require fcntl setlease support"
+}
+
 _require_ofd_locks()
 {
 	# Give a test run by getlk wrlck on testfile.
diff --git a/src/locktest.c b/src/locktest.c
index 8696966f..0e7c3008 100644
--- a/src/locktest.c
+++ b/src/locktest.c
@@ -1030,6 +1030,7 @@ main(int argc, char *argv[])
     extern int	optind;
     int fail_count = 0;
     int run_leases = 0;
+    int test_setlease = 0;
     
     atexit(cleanup);
     
@@ -1042,7 +1043,7 @@ main(int argc, char *argv[])
 	    prog = p+1;
     }
 
-    while ((c = getopt(argc, argv, "dLn:h:p:?")) != EOF) {
+    while ((c = getopt(argc, argv, "dLn:h:p:t?")) != EOF) {
 	switch (c) {
 
 	case 'd':	/* debug flag */
@@ -1072,6 +1073,10 @@ main(int argc, char *argv[])
 	    }
 	    break;
 
+	case 't':
+	    test_setlease = 1;
+	    break;
+
 	case '?':
 	default:
 	    errflag++;
@@ -1090,6 +1095,13 @@ main(int argc, char *argv[])
     if (do_open(O_RDWR) == FAIL)
 	exit(1);
 
+    if (test_setlease == 1) {
+	fcntl(f_fd, F_SETLEASE, F_UNLCK);
+	saved_errno = errno;
+	close(f_fd);
+	exit(saved_errno);
+    }
+
     setbuf(stderr, NULL);
 
     if (server) {
diff --git a/tests/generic/571 b/tests/generic/571
index 68c8a604..599e3e68 100755
--- a/tests/generic/571
+++ b/tests/generic/571
@@ -26,6 +26,7 @@ _supported_fs generic
 _supported_os Linux
 _require_test
 _require_test_fcntl_advisory_locks
+_require_test_fcntl_setlease
 
 _run_leasetest
 
-- 
2.18.2


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

* Re: [PATCH v2] generic/571: skip test on filesystems that don't support F_SETLEASE fcntl
  2020-04-01 17:26 [PATCH v2] generic/571: skip test on filesystems that don't support F_SETLEASE fcntl Scott Mayhew
@ 2020-04-02 10:39 ` Christoph Hellwig
  2020-04-02 12:22   ` Scott Mayhew
  0 siblings, 1 reply; 3+ messages in thread
From: Christoph Hellwig @ 2020-04-02 10:39 UTC (permalink / raw)
  To: Scott Mayhew; +Cc: fstests

On Wed, Apr 01, 2020 at 01:26:59PM -0400, Scott Mayhew wrote:
> Add an option to the locktest program to check for fcntl setlease
> support, and skip the generic/571 test on filesystems where the check
> returns EINVAL.

The changes to locktest.c seem to contain some whitespace damange.

Otherwie this looks sensible to me.

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

* Re: [PATCH v2] generic/571: skip test on filesystems that don't support F_SETLEASE fcntl
  2020-04-02 10:39 ` Christoph Hellwig
@ 2020-04-02 12:22   ` Scott Mayhew
  0 siblings, 0 replies; 3+ messages in thread
From: Scott Mayhew @ 2020-04-02 12:22 UTC (permalink / raw)
  To: Christoph Hellwig; +Cc: fstests

Hi Christoph,

On Thu, 02 Apr 2020, Christoph Hellwig wrote:

> On Wed, Apr 01, 2020 at 01:26:59PM -0400, Scott Mayhew wrote:
> > Add an option to the locktest program to check for fcntl setlease
> > support, and skip the generic/571 test on filesystems where the check
> > returns EINVAL.
> 
> The changes to locktest.c seem to contain some whitespace damange.
> 
The changes are consistent with the existing locktest.c, which uses a
mixture of tabs and spaces.

-Scott

> Otherwie this looks sensible to me.
> 


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

end of thread, other threads:[~2020-04-02 12:22 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-04-01 17:26 [PATCH v2] generic/571: skip test on filesystems that don't support F_SETLEASE fcntl Scott Mayhew
2020-04-02 10:39 ` Christoph Hellwig
2020-04-02 12:22   ` Scott Mayhew

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