public inbox for ltp@lists.linux.it
 help / color / mirror / Atom feed
* [LTP] [PATCH] llseek/llseek03.c: cleanup
@ 2014-02-25  2:37 Xiaoguang Wang
  2014-02-27  6:06 ` Wanlong Gao
  0 siblings, 1 reply; 2+ messages in thread
From: Xiaoguang Wang @ 2014-02-25  2:37 UTC (permalink / raw)
  To: ltp-list

Remove the meaningless code using strcpy in setup() and
fix some output messages.

Signed-off-by: Xiaoguang Wang <wangxg.fnst@cn.fujitsu.com>
---
 testcases/kernel/syscalls/llseek/llseek03.c | 13 +++++--------
 1 file changed, 5 insertions(+), 8 deletions(-)

diff --git a/testcases/kernel/syscalls/llseek/llseek03.c b/testcases/kernel/syscalls/llseek/llseek03.c
index 02f5d95..8ab2899 100644
--- a/testcases/kernel/syscalls/llseek/llseek03.c
+++ b/testcases/kernel/syscalls/llseek/llseek03.c
@@ -85,7 +85,6 @@ int main(int ac, char **av)
 static void setup(void)
 {
 	int fd;
-	char write_buf[BUFSIZ];
 	struct stat stat_buf;
 
 	tst_sig(NOFORK, DEF_HANDLER, cleanup);
@@ -94,12 +93,10 @@ static void setup(void)
 
 	TEST_PAUSE;
 
-	if (strcpy(write_buf, "abcdefgh") != write_buf)
-		tst_brkm(TBROK | TERRNO, NULL, "strcpy failed");
-
 	fd = SAFE_CREAT(cleanup, TEST_FILE, 0644);
 
-	SAFE_WRITE(cleanup, 1, fd, write_buf, strlen(write_buf));
+	#define STR "abcdefgh"
+	SAFE_WRITE(cleanup, 1, fd, STR, sizeof(STR) - 1);
 
 	SAFE_FSTAT(cleanup, fd, &stat_buf);
 
@@ -137,7 +134,7 @@ static void testfunc_seekcur(void)
 	SAFE_READ(cleanup, 1, fd, read_buf, 3);
 
 	if (strcmp(read_buf, "fgh"))
-		tst_resm(TFAIL, "test SEEK_SET for llseek failed");
+		tst_resm(TFAIL, "Read wrong bytes after llseek");
 	else
 		tst_resm(TPASS, "test SEEK_SET for llseek success");
 
@@ -162,7 +159,7 @@ static void testfunc_seekend(void)
 		goto cleanup_seekend;
 	}
 
-	if (TEST_RETURN != file_size) {
+	if (TEST_RETURN != (long)file_size) {
 		tst_resm(TFAIL, "llseek return a incorrect file offset");
 		goto cleanup_seekend;
 	}
@@ -171,7 +168,7 @@ static void testfunc_seekend(void)
 
 	nread = SAFE_READ(cleanup, 0, fd, read_buf, file_size);
 	if (nread > 0)
-		tst_resm(TFAIL, "test SEEK_END for llseek failed");
+		tst_resm(TFAIL, "Read bytes after llseek to end of file");
 	else
 		tst_resm(TPASS, "test SEEK_END for llseek success");
 
-- 
1.8.2.1


------------------------------------------------------------------------------
Flow-based real-time traffic analytics software. Cisco certified tool.
Monitor traffic, SLAs, QoS, Medianet, WAAS etc. with NetFlow Analyzer
Customize your own dashboards, set traffic alerts and generate reports.
Network behavioral analysis & security monitoring. All-in-one tool.
http://pubads.g.doubleclick.net/gampad/clk?id=126839071&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] llseek/llseek03.c: cleanup
  2014-02-25  2:37 [LTP] [PATCH] llseek/llseek03.c: cleanup Xiaoguang Wang
@ 2014-02-27  6:06 ` Wanlong Gao
  0 siblings, 0 replies; 2+ messages in thread
From: Wanlong Gao @ 2014-02-27  6:06 UTC (permalink / raw)
  To: Xiaoguang Wang; +Cc: ltp-list

On 02/25/2014 10:37 AM, Xiaoguang Wang wrote:
> Remove the meaningless code using strcpy in setup() and
> fix some output messages.
> 
> Signed-off-by: Xiaoguang Wang <wangxg.fnst@cn.fujitsu.com>
> ---
>  testcases/kernel/syscalls/llseek/llseek03.c | 13 +++++--------
>  1 file changed, 5 insertions(+), 8 deletions(-)

Applied, thank you.

Wanlong Gao


------------------------------------------------------------------------------
Flow-based real-time traffic analytics software. Cisco certified tool.
Monitor traffic, SLAs, QoS, Medianet, WAAS etc. with NetFlow Analyzer
Customize your own dashboards, set traffic alerts and generate reports.
Network behavioral analysis & security monitoring. All-in-one tool.
http://pubads.g.doubleclick.net/gampad/clk?id=126839071&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-27  6:07 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-02-25  2:37 [LTP] [PATCH] llseek/llseek03.c: cleanup Xiaoguang Wang
2014-02-27  6:06 ` Wanlong Gao

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox