public inbox for ltp@lists.linux.it
 help / color / mirror / Atom feed
From: "Jiří Paleček" <jpalecek@web.de>
To: CAI Qian <caiqian@cclom.cn>
Cc: ltp-list@lists.sourceforge.net
Subject: Re: [LTP] [PATCH] Fix the splice02 test
Date: Fri, 15 May 2009 19:24:11 +0200	[thread overview]
Message-ID: <op.utzemhltu2flwt@debian> (raw)
In-Reply-To: <20090513.224735.226784134.caiqian@cclom.cn>

[-- Attachment #1: Type: text/plain, Size: 3130 bytes --]

On Wed, 13 May 2009 16:47:35 +0200, CAI Qian <caiqian@cclom.cn> wrote:

> From: Jiri Palecek <jpalecek@web.de>
> Subject: [LTP] [PATCH] Fix the splice02 test
> Date: Wed, 13 May 2009 00:34:15 +0200
>
>>   Particularly:
>>
>>    - TEST_ERRNO is only set when the syscall is executed using the
>>      TEST() macro. The tests gave bad error messages because of that.
>>
>>    - The end of the test was dead code; moved the TPASS code to pass at
>>      the end of file.
>>
>>    - The test assumes std. input is a pipe; reflect this in the runtest
>>      file
>>
>> Regards
>>      Jiri Palecek
>>
>> Signed-off-by: Jiri Palecek <jpalecek@web.de>
>> ---
>>   runtest/syscalls                            |    2 +-
>>   testcases/kernel/syscalls/splice/splice02.c |   16 ++++++----------
>>   2 files changed, 7 insertions(+), 11 deletions(-)
>>
>> diff --git a/runtest/syscalls b/runtest/syscalls
>> index 9b7b2ca..33beff0 100644
>> --- a/runtest/syscalls
>> +++ b/runtest/syscalls
>> @@ -1033,7 +1033,7 @@ sockioctl01 sockioctl01
>>    #splice test
>>   splice01 splice01
>> -splice02 echo "Test splice02()" > splice02-temp; splice02 splice02-temp
>> +splice02 seq 1 10000000 | splice02 splice02-temp
>>    tee01 tee01
>>   diff --git a/testcases/kernel/syscalls/splice/splice02.c
>> b/testcases/kernel/syscalls/splice/splice02.c
>> index 321d002..16bff86 100644
>> --- a/testcases/kernel/syscalls/splice/splice02.c
>> +++ b/testcases/kernel/syscalls/splice/splice02.c
>> @@ -108,7 +108,6 @@ void setup() {
>>    int main(int ac, char **av) {
>>   	int fd = 0;
>> -	int ret = 0;
>>   	
>>           setup();
>>   @@ -118,26 +117,23 @@ int main(int ac, char **av) {
>>   	}
>>   	fd=open(av[1], O_WRONLY | O_CREAT | O_TRUNC, 0644);
>>   	if(fd < 0 ) {
>> -           tst_resm(TFAIL, "%s failed - errno = %d : %s", TCID,  
>> TEST_ERRNO,
>> strerror(TEST_ERRNO));
>> +		tst_resm(TFAIL, "open(%s) failed - errno = %d : %s", av[1], errno,
>> strerror(errno));
>>   	   cleanup();
>>   	   tst_exit();
>>   	}
>>   			
>>           do {
>> -	    ret = splice(STDIN_FILENO, NULL, fd, NULL, SPLICE_SIZE, 0);
>> -	    if (ret < 0) {
>> -            	tst_resm(TFAIL, "%s failed - errno = %d : %s",TCID,  
>> TEST_ERRNO,
>> strerror(TEST_ERRNO));
>> +					TEST(splice(STDIN_FILENO, NULL, fd, NULL, SPLICE_SIZE, 0));
>> +	    if (TEST_RETURN < 0) {
>> +            	tst_resm(TFAIL, "splice failed - errno = %d : %s",  
>> TEST_ERRNO,
>> strerror(TEST_ERRNO));
>>   	        cleanup();
>>   		tst_exit();
>>   	    } else
>> -            if (ret < SPLICE_SIZE){
>> +            if (TEST_RETURN == 0){
>> +							tst_resm(TPASS, "splice() system call Passed");
>>   	        cleanup();
>>   	        tst_exit();
>>   	    }
>>   	} while(1);
>> -
>> -	close(fd);
>> -        tst_resm(TPASS, "splice() system call Passed");
>> -        tst_exit();
>>   }
>>   -- 1.6.2
>
> Can't apply this patch -- long lines are wrapped. Please re-send it.

It seems not to be caused by wrapped lines - I can still see them in the  
digest. However, some empty lines seem to be lost.

Anyway, it should be better now (see attachment).

Regards
    Jiri Palecek

[-- Attachment #2: 0020-Fix-the-splice02-test.patch --]
[-- Type: application/octet-stream, Size: 2612 bytes --]

From 140bfb4eaeca73e407f6a2c65a7ea2d0cb80fd38 Mon Sep 17 00:00:00 2001
From: Jiri Palecek <jpalecek@web.de>
Date: Tue, 12 May 2009 18:50:10 +0200
Subject: [PATCH] Fix the splice02 test
Cc: "ltp-list@lists.sourceforge.net" <ltp-list@lists.sourceforge.net>

 Particularly:

  - TEST_ERRNO is only set when the syscall is executed using the
    TEST() macro. The tests gave bad error messages because of that.

  - The end of the test was dead code; moved the TPASS code to pass at
    the end of file.

  - The test assumes std. input is a pipe; reflect this in the runtest
    file

Signed-off-by: Jiri Palecek <jpalecek@web.de>
---
 runtest/syscalls                            |    2 +-
 testcases/kernel/syscalls/splice/splice02.c |   16 ++++++----------
 2 files changed, 7 insertions(+), 11 deletions(-)

diff --git a/runtest/syscalls b/runtest/syscalls
index 9b7b2ca..33beff0 100644
--- a/runtest/syscalls
+++ b/runtest/syscalls
@@ -1033,7 +1033,7 @@ sockioctl01 sockioctl01
 
 #splice test
 splice01 splice01
-splice02 echo "Test splice02()" > splice02-temp; splice02 splice02-temp
+splice02 seq 1 10000000 | splice02 splice02-temp
 
 tee01 tee01
 
diff --git a/testcases/kernel/syscalls/splice/splice02.c b/testcases/kernel/syscalls/splice/splice02.c
index 321d002..16bff86 100644
--- a/testcases/kernel/syscalls/splice/splice02.c
+++ b/testcases/kernel/syscalls/splice/splice02.c
@@ -108,7 +108,6 @@ void setup() {
 
 int main(int ac, char **av) {
 	int fd = 0;
-	int ret = 0;
 	
         setup();
 
@@ -118,26 +117,23 @@ int main(int ac, char **av) {
 	}
 	fd=open(av[1], O_WRONLY | O_CREAT | O_TRUNC, 0644);
 	if(fd < 0 ) {
-           tst_resm(TFAIL, "%s failed - errno = %d : %s", TCID, TEST_ERRNO, strerror(TEST_ERRNO));
+		tst_resm(TFAIL, "open(%s) failed - errno = %d : %s", av[1], errno, strerror(errno));
 	   cleanup();
 	   tst_exit();
 	}
 			
         do {
-	    ret = splice(STDIN_FILENO, NULL, fd, NULL, SPLICE_SIZE, 0);
-	    if (ret < 0) {
-            	tst_resm(TFAIL, "%s failed - errno = %d : %s",TCID, TEST_ERRNO, strerror(TEST_ERRNO));
+					TEST(splice(STDIN_FILENO, NULL, fd, NULL, SPLICE_SIZE, 0));
+	    if (TEST_RETURN < 0) {
+            	tst_resm(TFAIL, "splice failed - errno = %d : %s", TEST_ERRNO, strerror(TEST_ERRNO));
 	        cleanup();
 		tst_exit();
 	    } else
-            if (ret < SPLICE_SIZE){
+            if (TEST_RETURN == 0){
+							tst_resm(TPASS, "splice() system call Passed");
 	        cleanup();
 	        tst_exit();
 	    }
 	} while(1);
-
-	close(fd);
-        tst_resm(TPASS, "splice() system call Passed");
-        tst_exit();
 }
 
-- 
1.6.2


[-- Attachment #3: Type: text/plain, Size: 334 bytes --]

------------------------------------------------------------------------------
Crystal Reports - New Free Runtime and 30 Day Trial
Check out the new simplified licensing option that enables 
unlimited royalty-free distribution of the report engine 
for externally facing server and web deployment. 
http://p.sf.net/sfu/businessobjects

[-- 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

  parent reply	other threads:[~2009-05-15 17:23 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <4A09F967.8030402@web.de>
     [not found] ` <20090513.224735.226784134.caiqian@cclom.cn>
2009-05-15  7:17   ` [LTP] [PATCH] Fix the splice02 test Subrata Modak
2009-05-15 17:24   ` Jiří Paleček [this message]
2009-05-18 11:59     ` Subrata Modak

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=op.utzemhltu2flwt@debian \
    --to=jpalecek@web.de \
    --cc=caiqian@cclom.cn \
    --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