PFA the patch for waitid02
On Tue, Aug 4, 2009 at 5:35 PM, Subrata Modak<[email protected]> wrote:
> On Tue, 2009-08-04 at 17:01 +0530, rohit verma wrote:
>> FYI
>
> unfortunately, you did not attach the patch itself ;-)
>
> Regards--
> Subrata
>
>>
>> ---------- Forwarded message ----------
>> From: Subrata Modak <[email protected]>
>> Date: Tue, Aug 4, 2009 at 4:54 PM
>> Subject: Re: [LTP] waitid02 testcase fails on 2.6.29 kernel
>> To: rohit verma <[email protected]>
>> Cc: [email protected], CAI Qian <[email protected]>
>>
>>
>> Rohit,
>>
>> Post this to ltp mailing list.
>>
>> Regards--
>> Subrata
>>
>> On Tue, 2009-08-04 at 16:52 +0530, rohit verma wrote:
>> > Dear Manas Kumar Nayak,
>> >
>> > Pls find attached patch for waitid02 test case.I have modified the
>> > test case.I have also added 2 test scenarios in the test case using
>> > WSTOPPED and WNOWAIT.
>> >
>> > Note:
>> > The testcase was failing in LTP July, 2009 release.
>> > The warning- "implicit declaration of function 'getpgid", has been removed
>> >
>> > Pls verify the patch.
>> >
>> > Regards--
>> > Rohit Verma
>> >
>> >
>> >
>> > On Thu, Jul 30, 2009 at 11:59 PM, Subrata
>> > Modak<[email protected]> wrote:
>> > > Fixed this now.
>> > >
>> > > Regards--
>> > > Subrata
>> > >
>> > > On Thu, 2009-07-23 at 14:00 +0530, rohit verma wrote:
>> > >> Hi,
>> > >>
>> > >> I am running waitid02.c
>> > >> (ltp-full-20090630/testcases/kernel/syscalls/waitid/ ) test case on
>> > >> 2.6.29 kernel.
>> > >> Test case gives following error:
>> > >> "Error. is your system >2.6.9 ?";
>> > >>
>> > >> Anybody facing the same issue?
>> > >>
>> > >> Code:
>> > >>
>> > >> TEST(waitid(P_ALL,0,&infop,WNOHANG));
>> > >> if(TEST_RETURN == 0)
>> > >> tst_resm(TPASS,"Success !");
>> > >> else{
>> > >> printf("value of return is %d\n",TEST_RETURN);
>> > >> tst_resm(TFAIL,"Error. is your system >2.6.9 ?");
>> > >> errnochoose();
>> > >> }
>> > >>
>> > >>
>> > >> Regards,
>> > >> Rohit
>> > >>
>> > >> ------------------------------------------------------------------------------
>> > >> _______________________________________________
>> > >> Ltp-list mailing list
>> > >> [email protected]
>> > >> 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
>> [email protected]
>> https://lists.sourceforge.net/lists/listinfo/ltp-list
>
>
--
Regards,
Rohit
Signed-off-by: rohit verma ([email protected])
===============================================================================
diff -ruNB ltp-full-20090731_p/testcases/kernel/syscalls/waitid/waitid02.c
ltp-full-20090731/testcases/kernel/syscalls/waitid/waitid02.c
--- ltp-full-20090731_p/testcases/kernel/syscalls/waitid/waitid02.c
2009-07-30 20:45:25.000000000 +0530
+++ ltp-full-20090731/testcases/kernel/syscalls/waitid/waitid02.c
2009-08-04 15:37:53.000000000 +0530
@@ -58,7 +57,7 @@
/* Global Variables */
char *TCID = "waitid02"; /* Test program identifier.*/
int testno;
-int TST_TOTAL = 7; /* total number of tests in this file.
*/
+int TST_TOTAL = 4; /* total number of tests in this file.
*/
/* Extern Global Functions */
/******************************************************************************/
@@ -106,114 +105,145 @@
/*
*/
/******************************************************************************/
void setup() {
- /* Capture signals if any */
- /* Create temporary directories */
- TEST_PAUSE;
- tst_tmpdir();
+ /* Capture signals if any */
+ /* Create temporary directories */
+ TEST_PAUSE;
+ tst_tmpdir();
}
int errnochoose(void){ //choose the relative errno
- switch (TEST_ERRNO){
- case ECHILD: strerror((int)"ECHILD");
- break;
- case EINTR: strerror((int)"EINTR");
- break;
- case EINVAL: strerror((int)"EINVAL");
- break;
- default: strerror((int)"Other Error");
- }
- tst_exit() ;
+ switch (TEST_ERRNO) {
+ case ECHILD: strerror((int)"ECHILD");
+ break;
+ case EINTR: strerror((int)"EINTR");
+ break;
+ case EINVAL: strerror((int)"EINVAL");
+ break;
+ default: strerror((int)"Other Error");
+ }
+ tst_exit() ;
}
int main(int ac, char **av) {
- id_t cpid;
- id_t id1,id2,id3;
- id_t gid1,gid2,gid3;
- siginfo_t infop;
- int i = 0;
+ id_t pgid;
+ id_t id1, id2, id3;
+ siginfo_t infop;
+ int i = 0;
- int lc; /* loop counter */
- char *msg; /* message returned from parse_opts */
+ int lc; /* loop counter */
+ char *msg; /* message returned from parse_opts */
/* parse standard options */
- if ((msg = parse_opts(ac, av, (option_t *)NULL, NULL)) != (char
*)NULL){
- tst_brkm(TBROK, cleanup, "OPTION PARSING ERROR - %s", msg);
- tst_exit();
- }
-
- setup();
-
- /* Check looping state if -i option given */
-
- for (lc = 0; TEST_LOOPING(lc); ++lc) {
- Tst_count = 0;
- for (testno = 0; testno < TST_TOTAL; ++testno) {
+ msg = parse_opts(ac, av, (option_t *)NULL, NULL);
+ if (msg != (char *)NULL) {
+ tst_brkm(TBROK, cleanup, "OPTION PARSING ERROR - %s", msg);
+ tst_exit();
+ }
+
+ setup();
+
+ /* Check looping state if -i option given */
+
+ for (lc = 0; TEST_LOOPING(lc); ++lc) {
+ Tst_count = 0;
+ for (testno = 0; testno < TST_TOTAL; ++testno) {
-
- TEST(waitid(P_ALL,0,&infop,WNOHANG));
- if(TEST_RETURN == 0)
- tst_resm(TPASS,"Success !");
- else{
- tst_resm(TFAIL,"%s failed", TCID);
- errnochoose();
- }
-
-// option == WEXITED | WCONTINUED | WSTOPPED | WNOHANG | WNOWAIT ;
-
- TEST(fork());
- if(TEST_RETURN == 0){
- tst_resm(TINFO,"I'm a child,my id is %d,gpid is
%d",id1=getpid(),gid1=getpgid(0));
+ TEST(waitid(P_ALL, 0, &infop, WNOHANG));
+ if (TEST_RETURN == -1)
+ tst_resm(TPASS, "Success1 ... -1 is returned. error is %d.",
+ TEST_ERRNO);
+ else {
+ tst_resm(TFAIL, "%s Failed1 ...", TCID);
+ }
+
+ /* option == WEXITED | WCONTINUED | WSTOPPED | WNOHANG | WNOWAIT*/
+
+ TEST(id1 = fork());
+ if (TEST_RETURN == 0) {
+ tst_resm(TINFO, "I'm a child 1,my id is %d,gpid is %d",
+ id1 = getpid(), __getpgid(0));
+ sleep(1);
exit(5);
- }
-
- TEST(fork());
- if(TEST_RETURN == 0){
- tst_resm(TINFO,"I'm a child,my id is %d,gpid is
%d",id2=getpid(),gid2=getpgid(0));
+ }
+
+ TEST(id2 = fork());
+ if (TEST_RETURN == 0) {
+ sleep(3);
+ tst_resm(TINFO, "I'm a child 2,my id is %d,gpid is %d",
+ id2 = getpid(), __getpgid(0));
exit(7);
- }
+ }
- TEST(fork());
- if(TEST_RETURN == 0){
- tst_resm(TINFO,"I'm a child,my id is %d,gpid is
%d",id3=getpid(),gid3=getpgid(0));
+ TEST(id3 = fork());
+ if (TEST_RETURN == 0) {
+ sleep(2);
+ TEST(kill(id2, SIGCONT));
+ tst_resm(TINFO, "I'm a child 3,my id is %d,gpid is %d",
+ id3 = getpid(), __getpgid(0));
exit(6);
- }
+ }
+
+ TEST(waitid(P_ALL, 0, &infop, WNOHANG | WEXITED));
+ if (TEST_RETURN == 0)
+ tst_resm(TPASS, "Success 2 ...0 is returned.. error is %d.",
+ TEST_ERRNO);
+ else {
+ tst_resm(TFAIL, "%s Failed 2", TCID);
+ errnochoose();
+ }
- tst_resm(TINFO,"I'm a father %d",cpid=getpid());
+ tst_resm(TINFO, "I'm a Parent,my id is %d,gpid is %d",
+ getpid(), pgid = __getpgid(0));
- TEST(waitid(P_PGID,cpid,&infop,WEXITED));
+ TEST(waitid(P_PGID, pgid, &infop, WEXITED));
if(TEST_RETURN == 0){
- tst_resm(TPASS,"Success ... 0 is returned.");
- tst_resm(TINFO,"si_pid = %d ; si_code = %d ; si_status =
%d",infop.si_pid,infop.si_code,infop.si_status);
- }else {
- tst_resm(TFAIL,"Fail... %d is returned",TEST_RETURN);
- errnochoose();
- }
-
- TEST(waitid(P_PGID,id2,&infop,WEXITED));
- if(TEST_RETURN == 0){ //NOCHILD
- tst_resm(TINFO,"si_pid = %d ; si_code = %d ; si_status =
%d",infop.si_pid,infop.si_code,infop.si_status);
- tst_resm(TPASS,"Success2 ... 0 is returned");
- }else {
- tst_resm(TFAIL,"Fail... %d is returned",TEST_RETURN);
- errnochoose();
- }
-
- TEST(i = waitid(P_PID,id1,&infop,WCONTINUED));
- if(TEST_RETURN == 0){ //EINVAL
- tst_resm(TINFO,"si_pid = %d ; si_code = %d ; si_status =
%d",infop.si_pid,infop.si_code,infop.si_status);
- tst_resm(TPASS,"Success3 ... 0 is returned");
- }else {
- tst_resm(TFAIL,"Fail... %d is returned",i);
- errnochoose();
- }
- }
- }
- cleanup();
+ tst_resm(TPASS, "Success3 ... 0 is returned.");
+ tst_resm(TINFO, "si_pid = %d ; si_code = %d ; si_status = %d",
+ infop.si_pid, infop.si_code, infop.si_status);
+ } else {
+ tst_resm(TFAIL, "Fail3 ... %d is returned", TEST_RETURN);
+ errnochoose();
+ }
+
+ TEST(kill(id2, SIGSTOP));
+
+ TEST(i = waitid(P_PID, id2, &infop, WSTOPPED | WNOWAIT));
+ if (TEST_RETURN == 0) { /*EINVAL*/
+ tst_resm(TINFO, "si_pid = %d, si_code = %d, si_status = %d",
+ infop.si_pid, infop.si_code, infop.si_status);
+ tst_resm(TPASS, "Success4 ... 0 is returned");
+ } else {
+ tst_resm(TFAIL, "Fail4 ... %d is returned", i);
+ errnochoose();
+ }
+
+
+ TEST(waitid(P_PID, id3, &infop, WEXITED));
+ if (TEST_RETURN == 0) { /*NOCHILD*/
+ tst_resm(TINFO, "si_pid = %d, si_code = %d, si_status = %d",
+ infop.si_pid, infop.si_code, infop.si_status);
+ tst_resm(TPASS, "Success5 ... 0 is returned");
+ } else {
+ tst_resm(TFAIL, "Fail5 ... %d is returned", TEST_RETURN);
+ errnochoose();
+ }
+
+ TEST(i = waitid(P_PID, id2, &infop, WCONTINUED));
+ if (TEST_RETURN == 0) { /*EINVAL*/
+ tst_resm(TINFO, "si_pid = %d, si_code = %d, si_status = %d",
+ infop.si_pid, infop.si_code, infop.si_status);
+ tst_resm(TPASS, "Success6 ... 0 is returned");
+ } else {
+ tst_resm(TFAIL, "Fail6 ... %d is returned", i);
+ errnochoose();
+ }
+
+ sleep(3);
+ }
+ }
+ cleanup();
tst_exit();
}
-
-
-
------------------------------------------------------------------------------
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
[email protected]
https://lists.sourceforge.net/lists/listinfo/ltp-list