All of lore.kernel.org
 help / color / mirror / Atom feed
* [LTP] [PATCH] fcntl: fix lock type interpretation
@ 2023-06-06  6:51 Murphy Zhou
  2023-06-06  7:35 ` Li Wang
  0 siblings, 1 reply; 2+ messages in thread
From: Murphy Zhou @ 2023-06-06  6:51 UTC (permalink / raw)
  To: ltp

The lock type switching from an integer to a string in those
testcases are wrong because of typo I believe. As part of a
batch porting, fcntl17.c did it right.

In /usr/include/asm-generic/fcntl.h:166 defines the posix file
lock type value:

Those testcases mistook them as 1, 2, 3 respectively.

This does not affect the test verdict, but is printing wrong
message when the type is really not match, for example when
testing on CIFS.

Signed-off-by: Murphy Zhou <jencce.kernel@gmail.com>
---
 testcases/kernel/syscalls/fcntl/fcntl11.c | 6 +++---
 testcases/kernel/syscalls/fcntl/fcntl19.c | 6 +++---
 testcases/kernel/syscalls/fcntl/fcntl20.c | 6 +++---
 testcases/kernel/syscalls/fcntl/fcntl21.c | 6 +++---
 4 files changed, 12 insertions(+), 12 deletions(-)

diff --git a/testcases/kernel/syscalls/fcntl/fcntl11.c b/testcases/kernel/syscalls/fcntl/fcntl11.c
index b66fa8421..d042c6b9b 100644
--- a/testcases/kernel/syscalls/fcntl/fcntl11.c
+++ b/testcases/kernel/syscalls/fcntl/fcntl11.c
@@ -189,11 +189,11 @@ char *str_type(int type)
 	static char buf[20];
 
 	switch (type) {
-	case 0:
+	case F_RDLCK:
 		return ("F_RDLCK");
-	case 1:
+	case F_WRLCK:
 		return ("F_WRLCK");
-	case 2:
+	case F_UNLCK:
 		return ("F_UNLCK");
 	default:
 		sprintf(buf, "BAD VALUE: %d", type);
diff --git a/testcases/kernel/syscalls/fcntl/fcntl19.c b/testcases/kernel/syscalls/fcntl/fcntl19.c
index 88c91d6ea..f929aff99 100644
--- a/testcases/kernel/syscalls/fcntl/fcntl19.c
+++ b/testcases/kernel/syscalls/fcntl/fcntl19.c
@@ -215,11 +215,11 @@ char *str_type(int type)
 	static char buf[20];
 
 	switch (type) {
-	case 1:
+	case F_RDLCK:
 		return ("F_RDLCK");
-	case 2:
+	case F_WRLCK:
 		return ("F_WRLCK");
-	case 3:
+	case F_UNLCK:
 		return ("F_UNLCK");
 	default:
 		sprintf(buf, "BAD VALUE: %d", type);
diff --git a/testcases/kernel/syscalls/fcntl/fcntl20.c b/testcases/kernel/syscalls/fcntl/fcntl20.c
index b671af8a9..4aa773451 100644
--- a/testcases/kernel/syscalls/fcntl/fcntl20.c
+++ b/testcases/kernel/syscalls/fcntl/fcntl20.c
@@ -214,11 +214,11 @@ char *str_type(int type)
 	static char buf[20];
 
 	switch (type) {
-	case 1:
+	case F_RDLCK:
 		return ("F_RDLCK");
-	case 2:
+	case F_WRLCK:
 		return ("F_WRLCK");
-	case 3:
+	case F_UNLCK:
 		return ("F_UNLCK");
 	default:
 		sprintf(buf, "BAD VALUE: %d", type);
diff --git a/testcases/kernel/syscalls/fcntl/fcntl21.c b/testcases/kernel/syscalls/fcntl/fcntl21.c
index 8f1a67cf6..824b8c059 100644
--- a/testcases/kernel/syscalls/fcntl/fcntl21.c
+++ b/testcases/kernel/syscalls/fcntl/fcntl21.c
@@ -222,11 +222,11 @@ char *str_type(int type)
 	static char buf[20];
 
 	switch (type) {
-	case 1:
+	case F_RDLCK:
 		return ("F_RDLCK");
-	case 2:
+	case F_WRLCK:
 		return ("F_WRLCK");
-	case 3:
+	case F_UNLCK:
 		return ("F_UNLCK");
 	default:
 		sprintf(buf, "BAD VALUE: %d", type);
-- 
2.31.1


-- 
Mailing list info: https://lists.linux.it/listinfo/ltp

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

* Re: [LTP] [PATCH] fcntl: fix lock type interpretation
  2023-06-06  6:51 [LTP] [PATCH] fcntl: fix lock type interpretation Murphy Zhou
@ 2023-06-06  7:35 ` Li Wang
  0 siblings, 0 replies; 2+ messages in thread
From: Li Wang @ 2023-06-06  7:35 UTC (permalink / raw)
  To: Murphy Zhou; +Cc: ltp

Thanks for fixing this, pushed.

-- 
Regards,
Li Wang

-- 
Mailing list info: https://lists.linux.it/listinfo/ltp

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

end of thread, other threads:[~2023-06-06  7:35 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-06-06  6:51 [LTP] [PATCH] fcntl: fix lock type interpretation Murphy Zhou
2023-06-06  7:35 ` Li Wang

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.