Rishi, The stime01 test case actually exposed a kernel bug. While calling sys_stime, there is an intra-tick correction that is compensated in the gettimeofday path but not handled in the sys_time path. However, the above commit modifies some of the timekeeping.c functions, including do_settimeofday and has fixed the issue. On the latest kernel, the stime01 test passes. So I dont suggest any changes to the test.
Thanks, Vinay On Fri, 2008-12-12 at 10:29 +0530, Rishikesh K. Rajak wrote: > On Thu, 2008-12-11 at 20:32 -0800, CAI Qian wrote: > > Hi, > > > > Settimeofday()/gettimeofday() and time() are known not to keep > > consistent time against one another in RHEL 5 kernel[1]. As the > > result, stime01 test case failed because the date of time() returned > > was less than the date that stime() (settimeofday() on x86-64) set. > > > > # uname -ra > > > > # ./stime01 > > stime01 1 FAIL : stime() fails to set system's time > > Hi Vinay, > > As per our discussion i feel it is a kernel problem not ltp issue. > can you clarify here? Is this commit is working fine for you ? > > http://git.kernel.org/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commitdiff;h=9a055117d3d9cb562f83f8d4cd88772761f4cab0 > > I feel you have tested it and it works fine for you. Then i think > there is no requirement of ltp testcase modification here if it is a > kernel issue. > > -Rishi > > > > > Some debug information: > > curr_time = 1228827598 > > pres_time = 1228827607 > > > > We can see that "pres_time != curr_time + 10". > > > > [1] https://bugzilla.redhat.com/show_bug.cgi?id=475477 > > > > Signed-off-by: CAI Qian <[email protected]> > > > > --- testcases/kernel/syscalls/stime/stime01.c.orig 2008-12-12 > > 11:25:49.952135991 +0800 > > +++ testcases/kernel/syscalls/stime/stime01.c 2008-12-12 > > 11:42:43.456151307 +0800 > > @@ -73,6 +73,7 @@ > > #include <time.h> > > #include <string.h> > > #include <sys/stat.h> > > +#include <sys/time.h> > > #include <signal.h> > > > > #include "test.h" > > @@ -83,9 +84,8 @@ > > char *TCID="stime01"; /* Test program identifier. */ > > int TST_TOTAL=1; /* Total number of test cases. */ > > extern int Tst_count; /* Test Case counter for tst_* routines > > */ > > -time_t curr_time; /* system's current time in seconds */ > > time_t new_time; /* system's new time */ > > -time_t tloc; /* argument var. for time() */ > > +struct timeval tv; /* argument var. for gettimeofday() */ > > int exp_enos[]={0}; > > > > void setup(); /* Main setup function of test */ > > @@ -96,8 +96,7 @@ > > { > > int lc; /* loop counter */ > > char *msg; /* message returned from parse_opts */ > > - time_t pres_time; /* system's present time */ > > - > > + > > /* Parse standard options given to run the test. */ > > msg = parse_opts(ac, av, (option_t *) NULL, NULL); > > if (msg != (char *) NULL) { > > @@ -138,7 +137,7 @@ > > * Get the system's current time after call > > * to stime(). > > */ > > - if ((pres_time = time(&tloc)) < 0) { > > + if ((gettimeofday(&tv, NULL)) < 0) { > > tst_brkm(TFAIL, cleanup, > > "time() failed to get " > > "system's time after stime, " > > @@ -147,8 +146,8 @@ > > } > > > > /* Now do the actual verification */ > > - if ((pres_time != new_time) && > > - (pres_time != new_time + 1)) { > > + if ((tv.tv_sec != new_time) && > > + (tv.tv_sec != new_time + 1)) { > > tst_resm(TFAIL, "stime() fails to set " > > "system's time"); > > } else { > > @@ -194,15 +193,15 @@ > > TEST_PAUSE; > > > > /* Get the current time */ > > - if ((curr_time = time(&tloc)) < 0) { > > + if ((gettimeofday(&tv, NULL)) < 0) { > > tst_brkm(TBROK, cleanup, > > - "time() failed to get current time, errno=%d", > > + "gettimeofday() failed to get current time, errno=%d", > > errno); > > /*NOTREACHED*/ > > } > > > > /* Get the system's new time */ > > - new_time = curr_time + INCR_TIME; > > + new_time = tv.tv_sec + INCR_TIME; > > } /* End setup() */ > > > > /* > > > > > > ------------------------------------------------------------------------------ > > SF.Net email is Sponsored by MIX09, March 18-20, 2009 in Las Vegas, Nevada. > > The future of the web can't happen without you. Join us at MIX09 to help > > pave the way to the Next Web now. Learn more and register at > > http://ad.doubleclick.net/clk;208669438;13503038;i?http://2009.visitmix.com/ > > _______________________________________________ > > Ltp-list mailing list > > [email protected] > > https://lists.sourceforge.net/lists/listinfo/ltp-list ------------------------------------------------------------------------------ SF.Net email is Sponsored by MIX09, March 18-20, 2009 in Las Vegas, Nevada. The future of the web can't happen without you. Join us at MIX09 to help pave the way to the Next Web now. Learn more and register at http://ad.doubleclick.net/clk;208669438;13503038;i?http://2009.visitmix.com/ _______________________________________________ Ltp-list mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/ltp-list
