public inbox for ltp@lists.linux.it
 help / color / mirror / Atom feed
From: Garrett Cooper <yanegomi@gmail.com>
To: LTP list <ltp-list@lists.sourceforge.net>
Subject: [LTP] [PATCH] Fix bad strerror calls in testcases/kernel/syscalls/waitid01.c
Date: Sat, 18 Jul 2009 21:38:39 -0700	[thread overview]
Message-ID: <364299f40907182138w484cc898gac9fe00dbde75afd@mail.gmail.com> (raw)

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

             reply	other threads:[~2009-07-19  4:38 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-07-19  4:38 Garrett Cooper [this message]
2009-07-30 12:44 ` [LTP] [PATCH] Fix bad strerror calls in testcases/kernel/syscalls/waitid01.c Subrata Modak
2009-08-13  5:36 ` Mike Frysinger
2009-08-13  8:36   ` Garrett Cooper

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=364299f40907182138w484cc898gac9fe00dbde75afd@mail.gmail.com \
    --to=yanegomi@gmail.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