----- Original Message ----- > From: chru...@suse.cz > To: "Jan Stancek" <jstan...@redhat.com> > Cc: ltp-list@lists.sourceforge.net > Sent: Tuesday, 26 August, 2014 9:27:49 AM > Subject: Re: [LTP] [PATCH] sbrk02: check for ret code in setup() > > Hi! > > diff --git a/testcases/kernel/syscalls/sbrk/sbrk02.c > > b/testcases/kernel/syscalls/sbrk/sbrk02.c > > index caa8537..5e9d4b8 100644 > > --- a/testcases/kernel/syscalls/sbrk/sbrk02.c > > +++ b/testcases/kernel/syscalls/sbrk/sbrk02.c > > @@ -34,7 +34,7 @@ static void sbrk_verify(void); > > static void cleanup(void); > > static int exp_enos[] = { ENOMEM, 0 }; > > > > -static long increment; > > +static long increment = INC; > > > > int main(int argc, char *argv[]) > > { > > @@ -60,12 +60,19 @@ int main(int argc, char *argv[]) > > > > static void setup(void) > > { > > + void *ret = NULL; > > + > > tst_sig(NOFORK, DEF_HANDLER, cleanup); > > > > TEST_PAUSE; > > > > - for (increment = INC; errno == 0; increment+=INC) > > - sbrk(increment); > > + /* call sbrk until it fails or increment overflows */ > > + while (ret != (void *)-1 && increment > 0) { > > + ret = sbrk(increment); > > + increment += INC; > > + } > > + tst_resm(TINFO | TERRNO, "setup() bailing inc: %ld, ret: %p, sbrk: %p", > > + increment, ret, sbrk(0)); > > > > errno = 0; > > Ok, this fixes the inifinite loop, but doesn't the testcase still fail > afterwards? The sbrk_verify() expects it to fail with ENOMEM and when > the setup fails to prepare the condition it may not fail, or am I > mistaken?
You are right, the testcase still fails, but that looks like genuine problem in sbrk. Man page says: "On error, -1 is returned, and errno is set to ENOMEM.". Regards, Jan > > -- > Cyril Hrubis > chru...@suse.cz > ------------------------------------------------------------------------------ Slashdot TV. Video for Nerds. Stuff that matters. http://tv.slashdot.org/ _______________________________________________ Ltp-list mailing list Ltp-list@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/ltp-list