From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from sfi-mx-3.v28.ch3.sourceforge.com ([172.29.28.123] helo=mx.sourceforge.net) by 235xhf1.ch3.sourceforge.com with esmtp (Exim 4.69) (envelope-from ) id 1MquvW-00043n-Uf for ltp-list@lists.sourceforge.net; Thu, 24 Sep 2009 20:28:30 +0000 Received: from mail-yx0-f198.google.com ([209.85.210.198]) by 3b2kzd1.ch3.sourceforge.com with esmtp (Exim 4.69) id 1MquvP-0004Nu-30 for ltp-list@lists.sourceforge.net; Thu, 24 Sep 2009 20:28:30 +0000 Received: by yxe36 with SMTP id 36so2569428yxe.11 for ; Thu, 24 Sep 2009 13:28:17 -0700 (PDT) MIME-Version: 1.0 In-Reply-To: <200909241229.32866.chandru@in.ibm.com> References: <200909241229.32866.chandru@in.ibm.com> Date: Thu, 24 Sep 2009 13:28:17 -0700 Message-ID: From: "K.D. Lucas" Subject: Re: [LTP] [PATCH] ppoll01: add signal() syscall to register the signal handler List-Id: Linux Test Project General Discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: multipart/mixed; boundary="===============6377939257368379663==" Errors-To: ltp-list-bounces@lists.sourceforge.net To: Chandru Cc: ltp-list@lists.sourceforge.net --===============6377939257368379663== Content-Type: multipart/alternative; boundary=001636c597c3f46d62047458ab43 --001636c597c3f46d62047458ab43 Content-Type: text/plain; charset=ISO-8859-1 I applied this patch, and it fixed ppoll01 on an Ubuntu Hardy box which had been failing. Kernel is 2.6.24. Kelly On Wed, Sep 23, 2009 at 11:59 PM, Chandru wrote: > The ppoll01 testcase has a signal handler in it but this signal handler is > not registered with the kernel through the signal() syscal. The testcase > fails when it sends a SIGINT to itself as part of one of the case of the > test run. > The following patch > 1. Adds a signal() syscall to register the signal handler > 2. Corrects the expected 'revents' for the case where ppoll() is called on > a file which is only opened in read/write mode, i.e case00. > 3. Takes away printing the type of error ( i.e strerror(errno) ) since it > only prints the last error seen and does not report the failures seen in the > cases before the last failed one. The reporting of NG or OK shoudl take care > of > letting the user know the cases that have passed and cases that have > failed. > > Signed-off-by: Chandru S > --- > > --- ppoll01.c.orig 2009-09-22 19:22:39.371235396 +0530 > +++ ppoll01.c 2009-09-24 01:24:38.706487228 +0530 > @@ -106,6 +106,8 @@ extern void cleanup() { > tst_exit(); > } > > +void sighandler(int sig); /* signals handler function for the test > */ > + > /* Local Functions */ > > /******************************************************************************/ > /* > */ > @@ -125,7 +127,8 @@ extern void cleanup() { > /* > */ > > /******************************************************************************/ > void setup() { > - /* Capture signals if any */ > + /* Capture signals*/ > + signal(SIGINT, &sighandler); > /* Create temporary directories */ > TEST_PAUSE; > tst_tmpdir(); > @@ -191,7 +194,7 @@ struct test_case { > static struct test_case tcase[] = { > { // case00 > .ttype = NORMAL, > - .expect_revents = POLLOUT, > + .expect_revents = POLLOUT | POLLIN, > .ret = 0, > .err = 0, > }, > @@ -463,7 +466,7 @@ int main(int ac, char **av) { > break; > > default: > - tst_resm(TFAIL, "%s failed - errno = %d : > %s", TCID, TEST_ERRNO, strerror(TEST_ERRNO)); > + tst_resm(TFAIL, "%s failed", TCID); > RPRINTF("NG"); > cleanup(); > tst_exit(); > > > > > ------------------------------------------------------------------------------ > Come build with us! The BlackBerry® Developer Conference in SF, CA > is the only developer event you need to attend this year. Jumpstart your > developing skills, take BlackBerry mobile applications to market and stay > ahead of the curve. Join us from November 9-12, 2009. Register now! > http://p.sf.net/sfu/devconf > _______________________________________________ > Ltp-list mailing list > Ltp-list@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/ltp-list > -- K.D. Lucas kdlucas@gmail.com --001636c597c3f46d62047458ab43 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable I applied this patch, and it fixed ppoll01 on an Ubuntu Hardy box which had= been failing. Kernel is 2.6.24.

Kelly

On Wed, Sep 23, 2009 at 11:59 PM, Chandru <chandru@in.ibm.com> wrote:
The ppoll01 testc= ase has a signal handler in it but this signal handler is not registered wi= th the kernel through the signal() syscal. The testcase fails when it sends= a SIGINT to itself as part of one of the case of the test run.
The following patch
1. Adds a signal() syscall to register the signal handler
2. Corrects the expected 'revents' for the case where ppoll() is ca= lled on a file which is only opened in read/write mode, i.e case00.
3. Takes away printing the type of error ( i.e strerror(errno) ) since it o= nly prints the last error seen and does not report the failures seen in the= cases before the last failed one. The reporting of NG or OK shoudl take ca= re of
=A0 =A0letting the user know the cases that have passed and cases that hav= e failed.

Signed-off-by: Chandru S <= chandru@linux.vnet.ibm.com>
---

--- ppoll01.c.orig =A0 =A0 =A02009-09-22 19:22:39.371235396 +0530
+++ ppoll01.c =A0 2009-09-24 01:24:38.706487228 +0530
@@ -106,6 +106,8 @@ extern void cleanup() {
=A0 =A0 =A0 =A0 tst_exit();
=A0}

+void sighandler(int sig); =A0 =A0 =A0 /* signals handler function for the = test */
+
=A0/* Local =A0Functions */
=A0/***********************************************************************= *******/
=A0/* =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 = =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0= =A0 =A0*/
@@ -125,7 +127,8 @@ extern void cleanup() {
=A0/* =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 = =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0= =A0 =A0*/
=A0/***********************************************************************= *******/
=A0void setup() {
- =A0 =A0 =A0 =A0/* Capture signals if any */
+ =A0 =A0 =A0 =A0/* Capture signals*/
+ =A0 =A0 =A0 signal(SIGINT, &sighandler);
=A0 =A0 =A0 =A0 /* Create temporary directories */
=A0 =A0 =A0 =A0 TEST_PAUSE;
=A0 =A0 =A0 =A0 tst_tmpdir();
@@ -191,7 +194,7 @@ struct test_case {
=A0static struct test_case tcase[] =3D {
=A0 =A0 =A0 =A0{ // case00
=A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 .ttype =A0 =A0 =A0 =A0 =A0=3D NORMAL,
- =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0.expect_revents =3D POLLOUT,
+ =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0.expect_revents =3D POLLOUT | POLLIN,
=A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 .ret =A0 =A0 =A0 =A0 =A0 =A0=3D 0,
=A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 .err =A0 =A0 =A0 =A0 =A0 =A0=3D 0,
=A0 =A0 =A0 =A0 },
@@ -463,7 +466,7 @@ int main(int ac, char **av) {
=A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0break;

=A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0default:
- =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 tst_resm(TFAI= L, "%s failed - errno =3D %d : %s", TCID, TEST_ERRNO, strerror(TE= ST_ERRNO));
+ =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 tst_resm(TFAI= L, "%s failed", TCID);
=A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0RPRINTF(&qu= ot;NG");
=A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0cleanup();<= br> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0tst_exit();=



---------------------------------------------------------------------------= ---
Come build with us! The BlackBerry&reg; Developer Conference in SF, CA<= br> is the only developer event you need to attend this year. Jumpstart your developing skills, take BlackBerry mobile applications to market and stay ahead of the curve. Join us from November 9&#45;12, 2009. Register now&= amp;#33;
http://p.sf.net/s= fu/devconf
_______________________________________________
Ltp-list mailing list
Ltp-list@lists.sourceforg= e.net
https://lists.sourceforge.net/lists/listinfo/ltp-list



--
K.D. Lucas
kdlucas@gmail.com
--001636c597c3f46d62047458ab43-- --===============6377939257368379663== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline ------------------------------------------------------------------------------ Come build with us! The BlackBerry® Developer Conference in SF, CA is the only developer event you need to attend this year. Jumpstart your developing skills, take BlackBerry mobile applications to market and stay ahead of the curve. Join us from November 9-12, 2009. Register now! http://p.sf.net/sfu/devconf --===============6377939257368379663== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ Ltp-list mailing list Ltp-list@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/ltp-list --===============6377939257368379663==--