* [LTP] [PATCH v3] fcntl/fcntl30.c: add F_SETPIPE_SZ, F_GETPIPE_SZ test for fcntl(2)
[not found] <52F8AF7E.4060304@cn.fujitsu.com>
@ 2014-02-12 10:01 ` Xiaoguang Wang
2014-02-18 9:05 ` Wanlong Gao
0 siblings, 1 reply; 2+ messages in thread
From: Xiaoguang Wang @ 2014-02-12 10:01 UTC (permalink / raw)
To: ltp-list
create a new case to test F_SETPIPE_SZ, F_GETPIPE_SZ for fcntl(2)
Signed-off-by: Xiaoguang Wang <wangxg.fnst@cn.fujitsu.com>
---
include/lapi/fcntl.h | 8 +++
runtest/ltplite | 1 +
runtest/stress.part3 | 1 +
runtest/syscalls | 2 +
testcases/kernel/syscalls/.gitignore | 2 +
testcases/kernel/syscalls/fcntl/fcntl30.c | 116 ++++++++++++++++++++++++++++++
6 files changed, 130 insertions(+)
create mode 100644 testcases/kernel/syscalls/fcntl/fcntl30.c
diff --git a/include/lapi/fcntl.h b/include/lapi/fcntl.h
index 7e923ab..f77871f 100644
--- a/include/lapi/fcntl.h
+++ b/include/lapi/fcntl.h
@@ -27,4 +27,12 @@
# define F_DUPFD_CLOEXEC 1030
#endif
+#ifndef F_SETPIPE_SZ
+#define F_SETPIPE_SZ 1031
+#endif
+
+#ifndef F_GETPIPE_SZ
+#define F_GETPIPE_SZ 1032
+#endif
+
#endif /* __LAPI_FCNTL_H__ */
diff --git a/runtest/ltplite b/runtest/ltplite
index f5a58cf..01dcba5 100644
--- a/runtest/ltplite
+++ b/runtest/ltplite
@@ -224,6 +224,7 @@ fcntl26 fcntl26
# fcntl27 fcntl27
# fcntl28 fcntl28
fcntl29 fcntl29
+fcntl30 fcntl30
fdatasync01 fdatasync01
fdatasync02 fdatasync02
diff --git a/runtest/stress.part3 b/runtest/stress.part3
index 24185f3..acae0cc 100644
--- a/runtest/stress.part3
+++ b/runtest/stress.part3
@@ -163,6 +163,7 @@ fcntl26 fcntl26
# fcntl27 fcntl27
# fcntl28 fcntl28
fcntl29 fcntl29
+fcntl30 fcntl30
fdatasync01 fdatasync01
fdatasync02 fdatasync02
diff --git a/runtest/syscalls b/runtest/syscalls
index f9c2f55..b0e7de3 100644
--- a/runtest/syscalls
+++ b/runtest/syscalls
@@ -254,6 +254,8 @@ fcntl28 fcntl28
fcntl28_64 fcntl28_64
fcntl29 fcntl29
fcntl29_64 fcntl29_64
+fcntl30 fcntl30
+fcntl30_64 fcntl30_64
fdatasync01 fdatasync01
fdatasync02 fdatasync02
diff --git a/testcases/kernel/syscalls/.gitignore b/testcases/kernel/syscalls/.gitignore
index 21535ae..cf446b0 100644
--- a/testcases/kernel/syscalls/.gitignore
+++ b/testcases/kernel/syscalls/.gitignore
@@ -216,6 +216,8 @@
/fcntl/fcntl28_64
/fcntl/fcntl29
/fcntl/fcntl29_64
+/fcntl/fcntl30
+/fcntl/fcntl30_64
/fdatasync/fdatasync01
/fdatasync/fdatasync02
/flock/flock01
diff --git a/testcases/kernel/syscalls/fcntl/fcntl30.c b/testcases/kernel/syscalls/fcntl/fcntl30.c
new file mode 100644
index 0000000..fa62abf
--- /dev/null
+++ b/testcases/kernel/syscalls/fcntl/fcntl30.c
@@ -0,0 +1,116 @@
+/*
+ * Copyright (c) 2014 Fujitsu Ltd.
+ * Author: Xiaoguang Wang <wangxg.fnst@cn.fujitsu.com>
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of version 2 of the GNU General Public License as
+ * published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it would be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ */
+
+/*
+ * Description:
+ * Verify that,
+ * Basic test for fcntl(2) using F_SETPIPE_SZ, F_GETPIPE_SZ argument.
+ */
+
+
+#include <stdio.h>
+#include <errno.h>
+#include <unistd.h>
+#include <fcntl.h>
+#include <string.h>
+#include <signal.h>
+#include <sys/types.h>
+#include <pwd.h>
+
+#include "test.h"
+#include "usctest.h"
+#include "safe_macros.h"
+#include "lapi/fcntl.h"
+
+char *TCID = "fcntl30";
+int TST_TOTAL = 1;
+
+static void setup(void);
+static void cleanup(void);
+
+int main(int ac, char **av)
+{
+ int lc;
+ char *msg;
+ int pipe_fds[2], test_fd;
+ int orig_pipe_size, new_pipe_size;
+
+
+ msg = parse_opts(ac, av, NULL, NULL);
+ if (msg != NULL)
+ tst_brkm(TBROK, NULL, "OPTION PARSING ERROR - %s", msg);
+
+ setup();
+
+ for (lc = 0; TEST_LOOPING(lc); lc++) {
+ tst_count = 0;
+
+ SAFE_PIPE(cleanup, pipe_fds);
+ test_fd = pipe_fds[1];
+
+ TEST(fcntl(test_fd, F_GETPIPE_SZ));
+ if (TEST_RETURN < 0) {
+ tst_brkm(TFAIL | TTERRNO, cleanup,
+ "fcntl get pipe size failed");
+ }
+
+ orig_pipe_size = TEST_RETURN;
+ new_pipe_size = orig_pipe_size * 2;
+ TEST(fcntl(test_fd, F_SETPIPE_SZ, new_pipe_size));
+ if (TEST_RETURN < 0) {
+ tst_brkm(TFAIL | TTERRNO, cleanup,
+ "fcntl test F_SETPIPE_SZ failed");
+ }
+
+ TEST(fcntl(test_fd, F_GETPIPE_SZ));
+ if (TEST_RETURN < 0) {
+ tst_brkm(TFAIL | TTERRNO, cleanup,
+ "fcntl test F_GETPIPE_SZ failed");
+ }
+ tst_resm(TINFO, "orig_pipe_size: %d new_pipe_size: %d",
+ orig_pipe_size, new_pipe_size);
+ if (TEST_RETURN >= new_pipe_size) {
+ tst_resm(TPASS, "fcntl test F_GETPIPE_SZ"
+ "and F_SETPIPE_SZ success");
+ } else {
+ tst_resm(TFAIL, "fcntl test F_GETPIPE_SZ"
+ "and F_SETPIPE_SZ fail");
+ }
+ SAFE_CLOSE(cleanup, pipe_fds[0]);
+ SAFE_CLOSE(cleanup, pipe_fds[1]);
+ }
+
+ cleanup();
+ tst_exit();
+}
+
+static void setup(void)
+{
+ if ((tst_kvercmp(2, 6, 35)) < 0) {
+ tst_brkm(TCONF, NULL, "This test can only run on kernels"
+ "that are 2.6.35 and higher");
+ }
+
+ tst_sig(NOFORK, DEF_HANDLER, cleanup);
+
+ TEST_PAUSE;
+}
+
+static void cleanup(void)
+{
+ TEST_CLEANUP;
+}
--
1.8.2.1
------------------------------------------------------------------------------
Android apps run on BlackBerry 10
Introducing the new BlackBerry 10.2.1 Runtime for Android apps.
Now with support for Jelly Bean, Bluetooth, Mapview and more.
Get your Android app in front of a whole new audience. Start now.
http://pubads.g.doubleclick.net/gampad/clk?id=124407151&iu=/4140/ostg.clktrk
_______________________________________________
Ltp-list mailing list
Ltp-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ltp-list
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [LTP] [PATCH v3] fcntl/fcntl30.c: add F_SETPIPE_SZ, F_GETPIPE_SZ test for fcntl(2)
2014-02-12 10:01 ` [LTP] [PATCH v3] fcntl/fcntl30.c: add F_SETPIPE_SZ, F_GETPIPE_SZ test for fcntl(2) Xiaoguang Wang
@ 2014-02-18 9:05 ` Wanlong Gao
0 siblings, 0 replies; 2+ messages in thread
From: Wanlong Gao @ 2014-02-18 9:05 UTC (permalink / raw)
To: Xiaoguang Wang; +Cc: ltp-list
On 02/12/2014 06:01 PM, Xiaoguang Wang wrote:
> create a new case to test F_SETPIPE_SZ, F_GETPIPE_SZ for fcntl(2)
>
> Signed-off-by: Xiaoguang Wang <wangxg.fnst@cn.fujitsu.com>
> ---
> include/lapi/fcntl.h | 8 +++
> runtest/ltplite | 1 +
> runtest/stress.part3 | 1 +
> runtest/syscalls | 2 +
> testcases/kernel/syscalls/.gitignore | 2 +
> testcases/kernel/syscalls/fcntl/fcntl30.c | 116 ++++++++++++++++++++++++++++++
> 6 files changed, 130 insertions(+)
> create mode 100644 testcases/kernel/syscalls/fcntl/fcntl30.c
Applied, thank you.
Wanlong Gao
------------------------------------------------------------------------------
Managing the Performance of Cloud-Based Applications
Take advantage of what the Cloud has to offer - Avoid Common Pitfalls.
Read the Whitepaper.
http://pubads.g.doubleclick.net/gampad/clk?id=121054471&iu=/4140/ostg.clktrk
_______________________________________________
Ltp-list mailing list
Ltp-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ltp-list
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2014-02-18 9:07 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <52F8AF7E.4060304@cn.fujitsu.com>
2014-02-12 10:01 ` [LTP] [PATCH v3] fcntl/fcntl30.c: add F_SETPIPE_SZ, F_GETPIPE_SZ test for fcntl(2) Xiaoguang Wang
2014-02-18 9:05 ` Wanlong Gao
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox