This is the mail archive of the ecos-patches@sources.redhat.com mailing list for the eCos project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: FWD: SNTP client package


On Tue, Feb 25, 2003 at 05:01:12PM +0100, Robin Farine wrote:
> On Tue, 2003-02-25 at 16:40, Jonathan Larmour wrote:
> 
> > > +	break;
> > > +    }
> > > +    tm.tm_mon = i;
> > > +    tm.tm_mday++;
> > > +
> > > +    build_time = mktime(&tm);
> > > +    CYG_ASSERT(-1 != build_time,"mktime returned -1");
> > > +
> > > +    if (build_time > time(NULL)) {
> > > +      CYG_TEST_FAIL_FINISH("Build time is ahead of SNTP time");
> > > +    } else {
> > > +      if ((build_time + 60 * 60 * 24 * 10) > time(NULL)) {
> > > +	CYG_TEST_FAIL_FINISH("Build time is more than 10 days old");
> > > +      }
> > 
> > Hmm... I'm not entirely happy with this. This implies tests can get out of 
> > date over time. Obviously it's useful to have some baseline to test, but 
> > I'm not sure this is advisable. Comments from anyone else on this?

My intention is to have some degree of sanity check. Have i decoded
the time correctly. So the test fails if the test was compiled
sometime in the future, or more than ten days ago. 10 days is an
arbitrary number. I could make it 1 month, a year etc...

 
> Uh, yes, shouldn't the second condition read (less instead of greater
> than)?
> 
> 	if ((build_time + 60 * 60 * 24 * 10) < time(NULL)) {

Don't think so. build_time is always in the past. So adding on 10 days
brings it towards the present or maybe into the future. If it still
less than the current time, it means the build was made more than 10
days ago. This probably means something is broken or you are keeping
old binaries around for a long time....

     Andrew


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]