* [LTP] [PATCH] Fix bad strerror calls in testcases/kernel/syscalls/waitid01.c
@ 2009-07-19 4:38 Garrett Cooper
2009-07-30 12:44 ` Subrata Modak
2009-08-13 5:36 ` Mike Frysinger
0 siblings, 2 replies; 4+ messages in thread
From: Garrett Cooper @ 2009-07-19 4:38 UTC (permalink / raw)
To: LTP list
[-- Attachment #1: Type: text/plain, Size: 2596 bytes --]
For whatever reason the original author was using int casts to the
strerror strings. That's just plain wrong...
This corrects the issue by feeding back the proper strerror output,
which reduces noise at compile time and results in the same desired
behavior (because we shouldn't be negative testing strerror(3) in
waitid01.c:
gcooper@orangebox /scratch/ltp-nova2/ltp-nova $
/scratch/ltp-nova2/ltp-nova/testcases/kernel/syscalls/waitid/waitid01
waitid01 0 INFO : Process 29085 terminated:
waitid01 0 INFO : code = 1
waitid01 0 INFO : exit value = 123
waitid01 0 INFO : Process 29086 terminated:
waitid01 0 INFO : code = 2
waitid01 0 INFO : signal = 8
waitid01 0 INFO : Process 29087 terminated:
waitid01 0 INFO : code = 2
waitid01 0 INFO : signal = 1
waitid01 0 INFO : Process 29088 terminated:
waitid01 0 INFO : code = 1
waitid01 0 INFO : exit value = 123
waitid01 0 INFO : Process 29089 terminated:
waitid01 0 INFO : code = 2
waitid01 0 INFO : signal = 8
waitid01 0 INFO : Process 29090 terminated:
waitid01 0 INFO : code = 2
waitid01 0 INFO : signal = 1
waitid01 0 INFO : Process 29091 terminated:
waitid01 0 INFO : code = 1
waitid01 0 INFO : exit value = 123
waitid01 0 INFO : Process 29092 terminated:
waitid01 0 INFO : code = 2
waitid01 0 INFO : signal = 8
waitid01 0 INFO : Process 29093 terminated:
waitid01 0 INFO : code = 2
waitid01 0 INFO : signal = 1
waitid01 1 PASS : waitid(): system call passed
Signed-off-by: Garrett Cooper <yanegomi@gmail.com>
Index: testcases/kernel/syscalls/waitid/waitid01.c
===================================================================
RCS file: /cvsroot/ltp/ltp/testcases/kernel/syscalls/waitid/waitid01.c,v
retrieving revision 1.1
diff -u -r1.1 waitid01.c
--- testcases/kernel/syscalls/waitid/waitid01.c 15 Jun 2009 18:39:45 -0000 1.1
+++ testcases/kernel/syscalls/waitid/waitid01.c 19 Jul 2009 04:34:39 -0000
@@ -116,14 +116,9 @@
int errnochoose(void){ //choose the relative errno
switch (TEST_ERRNO){
- case 0: tst_exit();
- case ECHILD: strerror((int)"ECHILD");
- break;
- case EINTR: strerror((int)"EINTR");
- break;
- case EINVAL: strerror((int)"EINVAL");
- break;
- default: strerror((int)"Other Error");
+ case 0: tst_exit();
+ break;
+ default: strerror(TEST_ERRNO);
break;
}
TEST_RETURN = 0;
[-- Attachment #2: fix-waitid-strerror-call.diff --]
[-- Type: application/octet-stream, Size: 965 bytes --]
Index: testcases/kernel/syscalls/waitid/waitid01.c
===================================================================
RCS file: /cvsroot/ltp/ltp/testcases/kernel/syscalls/waitid/waitid01.c,v
retrieving revision 1.1
diff -u -r1.1 waitid01.c
--- testcases/kernel/syscalls/waitid/waitid01.c 15 Jun 2009 18:39:45 -0000 1.1
+++ testcases/kernel/syscalls/waitid/waitid01.c 19 Jul 2009 04:34:39 -0000
@@ -116,14 +116,9 @@
int errnochoose(void){ //choose the relative errno
switch (TEST_ERRNO){
- case 0: tst_exit();
- case ECHILD: strerror((int)"ECHILD");
- break;
- case EINTR: strerror((int)"EINTR");
- break;
- case EINVAL: strerror((int)"EINVAL");
- break;
- default: strerror((int)"Other Error");
+ case 0: tst_exit();
+ break;
+ default: strerror(TEST_ERRNO);
break;
}
TEST_RETURN = 0;
[-- Attachment #3: Type: text/plain, Size: 389 bytes --]
------------------------------------------------------------------------------
Enter the BlackBerry Developer Challenge
This is your chance to win up to $100,000 in prizes! For a limited time,
vendors submitting new applications to BlackBerry App World(TM) will have
the opportunity to enter the BlackBerry Developer Challenge. See full prize
details at: http://p.sf.net/sfu/Challenge
[-- 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 [flat|nested] 4+ messages in thread* Re: [LTP] [PATCH] Fix bad strerror calls in testcases/kernel/syscalls/waitid01.c
2009-07-19 4:38 [LTP] [PATCH] Fix bad strerror calls in testcases/kernel/syscalls/waitid01.c Garrett Cooper
@ 2009-07-30 12:44 ` Subrata Modak
2009-08-13 5:36 ` Mike Frysinger
1 sibling, 0 replies; 4+ messages in thread
From: Subrata Modak @ 2009-07-30 12:44 UTC (permalink / raw)
To: Garrett Cooper; +Cc: LTP list
On Sat, 2009-07-18 at 21:38 -0700, Garrett Cooper wrote:
> For whatever reason the original author was using int casts to the
> strerror strings. That's just plain wrong...
>
> This corrects the issue by feeding back the proper strerror output,
> which reduces noise at compile time and results in the same desired
> behavior (because we shouldn't be negative testing strerror(3) in
> waitid01.c:
>
> gcooper@orangebox /scratch/ltp-nova2/ltp-nova $
> /scratch/ltp-nova2/ltp-nova/testcases/kernel/syscalls/waitid/waitid01
> waitid01 0 INFO : Process 29085 terminated:
> waitid01 0 INFO : code = 1
> waitid01 0 INFO : exit value = 123
> waitid01 0 INFO : Process 29086 terminated:
> waitid01 0 INFO : code = 2
> waitid01 0 INFO : signal = 8
> waitid01 0 INFO : Process 29087 terminated:
> waitid01 0 INFO : code = 2
> waitid01 0 INFO : signal = 1
> waitid01 0 INFO : Process 29088 terminated:
> waitid01 0 INFO : code = 1
> waitid01 0 INFO : exit value = 123
> waitid01 0 INFO : Process 29089 terminated:
> waitid01 0 INFO : code = 2
> waitid01 0 INFO : signal = 8
> waitid01 0 INFO : Process 29090 terminated:
> waitid01 0 INFO : code = 2
> waitid01 0 INFO : signal = 1
> waitid01 0 INFO : Process 29091 terminated:
> waitid01 0 INFO : code = 1
> waitid01 0 INFO : exit value = 123
> waitid01 0 INFO : Process 29092 terminated:
> waitid01 0 INFO : code = 2
> waitid01 0 INFO : signal = 8
> waitid01 0 INFO : Process 29093 terminated:
> waitid01 0 INFO : code = 2
> waitid01 0 INFO : signal = 1
> waitid01 1 PASS : waitid(): system call passed
>
> Signed-off-by: Garrett Cooper <yanegomi@gmail.com>
I checked in this too. Thanks.
Regards--
Subrata
>
> Index: testcases/kernel/syscalls/waitid/waitid01.c
> ===================================================================
> RCS file: /cvsroot/ltp/ltp/testcases/kernel/syscalls/waitid/waitid01.c,v
> retrieving revision 1.1
> diff -u -r1.1 waitid01.c
> --- testcases/kernel/syscalls/waitid/waitid01.c 15 Jun 2009 18:39:45 -0000 1.1
> +++ testcases/kernel/syscalls/waitid/waitid01.c 19 Jul 2009 04:34:39 -0000
> @@ -116,14 +116,9 @@
> int errnochoose(void){ //choose the relative errno
>
> switch (TEST_ERRNO){
> - case 0: tst_exit();
> - case ECHILD: strerror((int)"ECHILD");
> - break;
> - case EINTR: strerror((int)"EINTR");
> - break;
> - case EINVAL: strerror((int)"EINVAL");
> - break;
> - default: strerror((int)"Other Error");
> + case 0: tst_exit();
> + break;
> + default: strerror(TEST_ERRNO);
> break;
> }
> TEST_RETURN = 0;
> ------------------------------------------------------------------------------
> Enter the BlackBerry Developer Challenge
> This is your chance to win up to $100,000 in prizes! For a limited time,
> vendors submitting new applications to BlackBerry App World(TM) will have
> the opportunity to enter the BlackBerry Developer Challenge. See full prize
> details at: http://p.sf.net/sfu/Challenge
> _______________________________________________ Ltp-list mailing list Ltp-list@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/ltp-list
------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day
trial. Simplify your report design, integration and deployment - and focus on
what you do best, core application coding. Discover what's new with
Crystal Reports now. http://p.sf.net/sfu/bobj-july
_______________________________________________
Ltp-list mailing list
Ltp-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ltp-list
^ permalink raw reply [flat|nested] 4+ messages in thread* Re: [LTP] [PATCH] Fix bad strerror calls in testcases/kernel/syscalls/waitid01.c
2009-07-19 4:38 [LTP] [PATCH] Fix bad strerror calls in testcases/kernel/syscalls/waitid01.c Garrett Cooper
2009-07-30 12:44 ` Subrata Modak
@ 2009-08-13 5:36 ` Mike Frysinger
2009-08-13 8:36 ` Garrett Cooper
1 sibling, 1 reply; 4+ messages in thread
From: Mike Frysinger @ 2009-08-13 5:36 UTC (permalink / raw)
To: ltp-list
[-- Attachment #1.1: Type: text/plain, Size: 838 bytes --]
On Sunday 19 July 2009 00:38:39 Garrett Cooper wrote:
> int errnochoose(void){ //choose the relative errno
>
> switch (TEST_ERRNO){
> - case 0: tst_exit();
> - case ECHILD: strerror((int)"ECHILD");
> - break;
> - case EINTR: strerror((int)"EINTR");
> - break;
> - case EINVAL: strerror((int)"EINVAL");
> - break;
> - default: strerror((int)"Other Error");
> + case 0: tst_exit();
> + break;
> + default: strerror(TEST_ERRNO);
> break;
> }
maybe i'm missing something, but strerror() doesnt write any output, it
returns a string. so ignoring the return value of strerror() makes it
pointless. which means this whole function is useless ?
-mike
[-- Attachment #1.2: This is a digitally signed message part. --]
[-- Type: application/pgp-signature, Size: 836 bytes --]
[-- Attachment #2: Type: text/plain, Size: 355 bytes --]
------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day
trial. Simplify your report design, integration and deployment - and focus on
what you do best, core application coding. Discover what's new with
Crystal Reports now. http://p.sf.net/sfu/bobj-july
[-- Attachment #3: 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 [flat|nested] 4+ messages in thread* Re: [LTP] [PATCH] Fix bad strerror calls in testcases/kernel/syscalls/waitid01.c
2009-08-13 5:36 ` Mike Frysinger
@ 2009-08-13 8:36 ` Garrett Cooper
0 siblings, 0 replies; 4+ messages in thread
From: Garrett Cooper @ 2009-08-13 8:36 UTC (permalink / raw)
To: Mike Frysinger; +Cc: ltp-list
On Wed, Aug 12, 2009 at 10:36 PM, Mike Frysinger<vapier@gentoo.org> wrote:
> On Sunday 19 July 2009 00:38:39 Garrett Cooper wrote:
>> int errnochoose(void){ //choose the relative errno
>>
>> switch (TEST_ERRNO){
>> - case 0: tst_exit();
>> - case ECHILD: strerror((int)"ECHILD");
>> - break;
>> - case EINTR: strerror((int)"EINTR");
>> - break;
>> - case EINVAL: strerror((int)"EINVAL");
>> - break;
>> - default: strerror((int)"Other Error");
>> + case 0: tst_exit();
>> + break;
>> + default: strerror(TEST_ERRNO);
>> break;
>> }
>
> maybe i'm missing something, but strerror() doesnt write any output, it
> returns a string. so ignoring the return value of strerror() makes it
> pointless. which means this whole function is useless ?
> -mike
Yes, you're absolutely correct now that I think about it. perror(3)
would be a whole different beast...
Thanks,
-Garrett
------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day
trial. Simplify your report design, integration and deployment - and focus on
what you do best, core application coding. Discover what's new with
Crystal Reports now. http://p.sf.net/sfu/bobj-july
_______________________________________________
Ltp-list mailing list
Ltp-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ltp-list
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2009-08-13 8:36 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-07-19 4:38 [LTP] [PATCH] Fix bad strerror calls in testcases/kernel/syscalls/waitid01.c Garrett Cooper
2009-07-30 12:44 ` Subrata Modak
2009-08-13 5:36 ` Mike Frysinger
2009-08-13 8:36 ` Garrett Cooper
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox