* [LTP] [PATCH v2 2/2] pwrite/pwrite02.c: make EBADF error value tests sufficient
@ 2014-05-06 8:14 Xiaoguang Wang
2014-05-28 16:24 ` chrubis
0 siblings, 1 reply; 2+ messages in thread
From: Xiaoguang Wang @ 2014-05-06 8:14 UTC (permalink / raw)
To: LTP
[-- Attachment #1: Type: text/plain, Size: 104 bytes --]
Hi,
This is a patch following "[PATCH v2 1/2] pwrite/pwrite02.c: cleanup", thanks
Regards,
Wang
[-- Attachment #2: v2-0002-pwrite-pwrite02.c-make-EBADF-error-value-tests-su.patch --]
[-- Type: text/x-patch, Size: 2100 bytes --]
From 11e724ef0e7d18930d2f25f845d46f264feb69b8 Mon Sep 17 00:00:00 2001
From: Xiaoguang Wang <wangxg.fnst@cn.fujitsu.com>
Date: Tue, 6 May 2014 14:16:40 +0800
Subject: [PATCH v2 2/2] pwrite/pwrite02.c: make EBADF error value tests
sufficient
Signed-off-by: Xiaoguang Wang <wangxg.fnst@cn.fujitsu.com>
---
testcases/kernel/syscalls/pwrite/pwrite02.c | 25 ++++++++++++++++++++-----
1 file changed, 20 insertions(+), 5 deletions(-)
diff --git a/testcases/kernel/syscalls/pwrite/pwrite02.c b/testcases/kernel/syscalls/pwrite/pwrite02.c
index c9fc840..a934de8 100644
--- a/testcases/kernel/syscalls/pwrite/pwrite02.c
+++ b/testcases/kernel/syscalls/pwrite/pwrite02.c
@@ -26,8 +26,9 @@
* returns EINVAL.
* 3) pwrite() fails if fd is not a valid file descriptor,
* returns EBADF.
- * 4) pwrite() fails when attempted to write with buf outside
- * accessible address space, returns EFAULT.
+ * 4) pwrite() fails if fd is not open for writing, return EBADF.
+ * 5) pwrite() fails when attempted to write with buf outside
+ * accessible address space.
*/
#define _XOPEN_SOURCE 500
@@ -59,14 +60,15 @@ static int exp_enos[] = {
static void test_espipe(void);
static void test_einval(void);
-static void test_ebadf(void);
+static void test_ebadf1(void);
+static void test_ebadf2(void);
#if !defined(UCLINUX)
static void test_efault(void);
#endif
static void (*testfunc[])(void) = {
- test_espipe, test_einval, test_ebadf,
+ test_espipe, test_einval, test_ebadf1, test_ebadf2,
#if !defined(UCLINUX)
test_efault
#endif
@@ -179,7 +181,7 @@ static void test_einval(void)
SAFE_CLOSE(cleanup, fd);
}
-static void test_ebadf(void)
+static void test_ebadf1(void)
{
int fd = -1;
@@ -188,6 +190,19 @@ static void test_ebadf(void)
print_test_result(errno, EBADF);
}
+static void test_ebadf2(void)
+{
+ int fd;
+
+ fd = SAFE_OPEN(cleanup, TEMPFILE, O_RDONLY | O_CREAT, 0666);
+
+ TEST(pwrite(fd, write_buf, K1, 0));
+
+ print_test_result(errno, EBADF);
+
+ SAFE_CLOSE(cleanup, fd);
+}
+
#if !defined(UCLINUX)
static void test_efault(void)
{
--
1.8.2.1
[-- Attachment #3: Type: text/plain, Size: 346 bytes --]
------------------------------------------------------------------------------
Is your legacy SCM system holding you back? Join Perforce May 7 to find out:
• 3 signs your SCM is hindering your productivity
• Requirements for releasing software faster
• Expert tips and advice for migrating your SCM now
http://p.sf.net/sfu/perforce
[-- Attachment #4: Type: text/plain, Size: 155 bytes --]
_______________________________________________
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 v2 2/2] pwrite/pwrite02.c: make EBADF error value tests sufficient
2014-05-06 8:14 [LTP] [PATCH v2 2/2] pwrite/pwrite02.c: make EBADF error value tests sufficient Xiaoguang Wang
@ 2014-05-28 16:24 ` chrubis
0 siblings, 0 replies; 2+ messages in thread
From: chrubis @ 2014-05-28 16:24 UTC (permalink / raw)
To: Xiaoguang Wang; +Cc: LTP
Hi!
Pushed, thanks.
--
Cyril Hrubis
chrubis@suse.cz
------------------------------------------------------------------------------
Time is money. Stop wasting it! Get your web API in 5 minutes.
www.restlet.com/download
http://p.sf.net/sfu/restlet
_______________________________________________
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-05-28 16:24 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-05-06 8:14 [LTP] [PATCH v2 2/2] pwrite/pwrite02.c: make EBADF error value tests sufficient Xiaoguang Wang
2014-05-28 16:24 ` chrubis
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox