Skip to contentSkip to conversation

fcntl/fcntl29.c: add F_DUPFD_CLOEXEC test for fcntl(2)

PATCH In review Xiaoguang Wang 3 participants 3 messages Dec 5, 2013

lore
Share & tools
lore
#0 lore raw

PATCH 1/3 fcntl/fcntl29.c: add F_DUPFD_CLOEXEC test for fcntl(2)

create a new case to test F_DUPFD_CLOEXEC for fcntl(2)

---
 runtest/syscalls                          |   2 +
 testcases/kernel/syscalls/fcntl/fcntl29.c | 117 ++++++++++++++++++++++++++++++
 2 files changed, 119 insertions(+)
 create mode 100644 testcases/kernel/syscalls/fcntl/fcntl29.c
runtest/syscalls +2 -0
index 717342e..cace2ca 100644
@@ -251,6 +251,8 @@ fcntl27 fcntl27
 fcntl27_64 fcntl27_64
 fcntl28 fcntl28
 fcntl28_64 fcntl28_64
+fcntl29 fcntl29
+fcntl29_64 fcntl29_64
 
 fdatasync01 fdatasync01
 fdatasync02 fdatasync02
testcases/kernel/syscalls/fcntl/fcntl29.c new file +117 -0

117 lines not on this page · raw message

Signature · 12 lines
1.8.2.1


------------------------------------------------------------------------------
Sponsored by Intel(R) XDK 
Develop, test and display web and hybrid apps with a single code base.
Download it for free now!
http://pubads.g.doubleclick.net/gampad/clk?id=111408631&iu=/4140/ostg.clktrk
_______________________________________________
Ltp-list mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ltp-list
#1 lore raw

testcases/kernel/syscalls/fcntl/fcntl29.c line 117

Quoted 10 lines · On Wednesday 04 December 2013 22:43:33 Xiaoguang Wang wrote:
testcases/kernel/syscalls/fcntl/fcntl29.c new file +9 -0
+#if defined(F_DUPFD_CLOEXEC)
...
+#else
+
+int main(int ac, char **av)
+{
+	tst_brkm(TCONF, NULL, "This test can only run on kernels"
+		 "that are 2.6.24 and higher");
+}
+#endif

an ifdef test on a define provided by the C library is not a good marker to control kernel version functionality

testcases/kernel/syscalls/fcntl/fcntl29.c line 69

Quoted 5 lines
testcases/kernel/syscalls/fcntl/fcntl29.c new file +5 -0
+			TEST(fcntl(test_fd, F_DUPFD_CLOEXEC, dup_fd));
+			if (TEST_RETURN < 0) {
+				tst_brkm(TFAIL | TTERRNO, cleanup, "fcntl "
+					 "test F_DUPFD_CLOEXEC failed");
+			}

what happens when you run this on an older kernel ? should you be doing a runtime kernel version test here ?
-mike

------------------------------------------------------------------------------
Sponsored by Intel(R) XDK
Develop, test and display web and hybrid apps with a single code base. Download it for free now!
http://pubads.g.doubleclick.net/gampad/clk?id=111408631&iu=/4140/ostg.clktrk

_______________________________________________
Ltp-list mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ltp-list

#2 lore raw
Quoted 15 lines · Mike Frysinger

testcases/kernel/syscalls/fcntl/fcntl29.c line 117

Quoted 10 lines · On Wednesday 04 December 2013 22:43:33 Xiaoguang Wang wrote:
testcases/kernel/syscalls/fcntl/fcntl29.c new file +9 -0
+#if defined(F_DUPFD_CLOEXEC)
...
+#else
+
+int main(int ac, char **av)
+{
+	tst_brkm(TCONF, NULL, "This test can only run on kernels"
+		 "that are 2.6.24 and higher");
+}
+#endif

an ifdef test on a define provided by the C library is not a good marker to control kernel version functionality

Quoted 8 lines

testcases/kernel/syscalls/fcntl/fcntl29.c line 69

Quoted 5 lines
testcases/kernel/syscalls/fcntl/fcntl29.c new file +5 -0
+			TEST(fcntl(test_fd, F_DUPFD_CLOEXEC, dup_fd));
+			if (TEST_RETURN < 0) {
+				tst_brkm(TFAIL | TTERRNO, cleanup, "fcntl "
+					 "test F_DUPFD_CLOEXEC failed");
+			}

what happens when you run this on an older kernel ? should you be doing a runtime kernel version test here ?

Yeah, why not use "tst_kvercmp()" here?

Thanks,
Wanlong Gao

Quoted 12 lines

-mike

------------------------------------------------------------------------------
Sponsored by Intel(R) XDK
Develop, test and display web and hybrid apps with a single code base. Download it for free now!
http://pubads.g.doubleclick.net/gampad/clk?id=111408631&iu=/4140/ostg.clktrk

Quoted 5 lines

_______________________________________________
Ltp-list mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ltp-list

------------------------------------------------------------------------------
Sponsored by Intel(R) XDK
Develop, test and display web and hybrid apps with a single code base. Download it for free now!
http://pubads.g.doubleclick.net/gampad/clk?id=111408631&iu=/4140/ostg.clktrk
_______________________________________________
Ltp-list mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ltp-list