public inbox for ltp@lists.linux.it
 help / color / mirror / Atom feed
From: Xiaoguang Wang <wangxg.fnst@cn.fujitsu.com>
To: LTP <ltp-list@lists.sourceforge.net>
Subject: [LTP] [PATCH v2 2/2] pwrite/pwrite02.c: make EBADF error value tests sufficient
Date: Tue, 6 May 2014 16:14:55 +0800	[thread overview]
Message-ID: <536899FF.1040605@cn.fujitsu.com> (raw)

[-- 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:
&#149; 3 signs your SCM is hindering your productivity
&#149; Requirements for releasing software faster
&#149; 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

             reply	other threads:[~2014-05-06  8:19 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-05-06  8:14 Xiaoguang Wang [this message]
2014-05-28 16:24 ` [LTP] [PATCH v2 2/2] pwrite/pwrite02.c: make EBADF error value tests sufficient chrubis

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=536899FF.1040605@cn.fujitsu.com \
    --to=wangxg.fnst@cn.fujitsu.com \
    --cc=ltp-list@lists.sourceforge.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox