Skip to contentSkip to conversation

syscalls/creat/creat09: fix error check of create syscall

PATCH New TAKAHASHI Tetsuya 3 participants 4 messages Dec 17, 2015

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 syscalls/creat/creat09: fix error check of create syscall

Hello.

I think that a create syscall check of syscalls/creat/creat09 is wrong.

When create syscall cannot make a file, the test result becomes PASS. In this case, the test result becomes FAIL is right.

testcases/kernel/syscalls/creat/creat09.c +5 -1
diff -uprN a/testcases/kernel/syscalls/creat/creat09.c b/testcases/kernel/syscalls/creat/creat09.c
@@ -139,9 +139,13 @@ int main(int ac, char **av)
 
 		TEST(creat(fname, 0700));
 
-		if (TEST_RETURN == -1) {
+		if (TEST_RETURN != -1) {
 			tst_resm(TPASS, "creat(%s, 0700) returned %ld",
 				 fname, TEST_RETURN);
+		} else {
+			tst_resm(TFAIL | TTERRNO, "creat(%s, 0700) FAILED",
+				 fname);
+			continue;
 		}
 
 		/* close and remove file, possibly for next loop */
#1 lore raw

PATCH 1/1 syscalls/creat/creat09: fix error check of create syscall

Hi,

Quoted 7 lines · TAKAHASHI Tetsuya

Hello.

I think that a create syscall check of syscalls/creat/creat09 is wrong.

When create syscall cannot make a file, the test result becomes PASS. In this case, the test result becomes FAIL is right.

yes, I agree with u.

Quoted 10 lines

diff -uprN a/testcases/kernel/syscalls/creat/creat09.c b/testcases/kernel/syscalls/creat/creat09.c
--- a/testcases/kernel/syscalls/creat/creat09.c 2015-12-03 05:53:41.000000000 +0900
+++ b/testcases/kernel/syscalls/creat/creat09.c 2015-12-06 01:48:34.757125367 +0900

(quoted diff) +0 -0
@@ -139,9 +139,13 @@ int main(int ac, char **av)
 

Review int main(int ac, char **av) · line 148

Quoted 10 lines
(quoted diff) +5 -1
                TEST(creat(fname, 0700));
 
-               if (TEST_RETURN == -1) {
+               if (TEST_RETURN != -1) {
                        tst_resm(TPASS, "creat(%s, 0700) returned %ld",
                                 fname, TEST_RETURN);
+               } else {
+                       tst_resm(TFAIL | TTERRNO, "creat(%s, 0700) FAILED",
+                                fname);
+                       continue;

why using continue here? it will skip some cleanup codes in the following.

so, how about make something like:
------------$ git diff

(quoted diff) +0 -0

b/testcases/kernel/syscalls/creat/creat09.c
index e52ad34..f680a78 100644

testcases/kernel/syscalls/creat/creat09.c +4 -3
@@ -139,10 +139,12 @@ int main(int ac, char **av)
 
                TEST(creat(fname, 0700));
 
-               if (TEST_RETURN == -1) {
+               if (TEST_RETURN != -1)
                        tst_resm(TPASS, "creat(%s, 0700) returned %ld",
                                 fname, TEST_RETURN);
-               }
+               else
+                       tst_resm(TFAIL | TTERRNO, "creat(%s, 0700) FAILED",
+                               fname);
 
 
-- 

Regards,
Li Wang
Email: [email protected]
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.linux.it/pipermail/ltp/attachments/20151217/7764e58c/attachment.html>

#2 lore raw

PATCH 1/1 syscalls/creat/creat09: fix error check of create syscall

Hi,

Quoted 14 lines · Li Wang

Hi,

Quoted 12 lines

diff -uprN a/testcases/kernel/syscalls/creat/creat09.c b/testcases/kernel/syscalls/creat/creat09.c
--- a/testcases/kernel/syscalls/creat/creat09.c 2015-12-03 05:53:41.000000000 +0900
+++ b/testcases/kernel/syscalls/creat/creat09.c 2015-12-06 01:48:34.757125367 +0900

testcases/kernel/syscalls/creat/creat09.c +0 -0
@@ -139,9 +139,13 @@ int main(int ac, char **av)
 
                TEST(creat(fname, 0700));
 
Quoted 15 lines

Review int main(int ac, char **av) · line 149

Quoted 9 lines
(quoted diff) +5 -1
-               if (TEST_RETURN == -1) {
+               if (TEST_RETURN != -1) {
                        tst_resm(TPASS, "creat(%s, 0700) returned %ld",
                                 fname, TEST_RETURN);
+               } else {
+                       tst_resm(TFAIL | TTERRNO, "creat(%s, 0700)
 FAILED",
+                                fname);
+                       continue;

why using continue here? it will skip some cleanup codes in the
following.

oops!! if no "continue" here, the process will going to handle wrong file descriptor.

you are right, sorry for make noise here, pls ignore my comments.

---
Li Wang
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.linux.it/pipermail/ltp/attachments/20151217/a1b8e7aa/attachment.html>

#3 lore raw

PATCH 1/1 syscalls/creat/creat09: fix error check of create syscall

In reply to TAKAHASHI Tetsuya

----- Original Message -----

Quoted 6 lines

From: "TAKAHASHI Tetsuya" <[email protected]>
To: "[email protected]" <[email protected]>
Cc: "TAKEISHI Kazuhiro" <[email protected]>
Sent: Thursday, 17 December, 2015 6:54:55 AM
Subject: [LTP] [PATCH] syscalls/creat/creat09: fix error check of create syscall

Quoted 6 lines

Hello.

I think that a create syscall check of syscalls/creat/creat09 is wrong.

When create syscall cannot make a file, the test result becomes PASS. In this case, the test result becomes FAIL is right.

Pushed with modified commit message and your signed-off-by.

Regards,
Jan

Quoted 29 lines

diff -uprN a/testcases/kernel/syscalls/creat/creat09.c b/testcases/kernel/syscalls/creat/creat09.c
--- a/testcases/kernel/syscalls/creat/creat09.c 2015-12-03 05:53:41.000000000
+0900
+++ b/testcases/kernel/syscalls/creat/creat09.c 2015-12-06 01:48:34.757125367
+0900

testcases/kernel/syscalls/creat/creat09.c +5 -2
@@ -139,9 +139,13 @@ int main(int ac, char **av)
 
 		TEST(creat(fname, 0700));
 
-		if (TEST_RETURN == -1) {
+		if (TEST_RETURN != -1) {
 			tst_resm(TPASS, "creat(%s, 0700) returned %ld",
 				 fname, TEST_RETURN);
+		} else {
+			tst_resm(TFAIL | TTERRNO, "creat(%s, 0700) FAILED",
+				 fname);
+			continue;
 		}
 
 		/* close and remove file, possibly for next loop */
 
 
 
--

Mailing list info: http://lists.linux.it/listinfo/ltp