cloudstack-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Daan Hoogland <daan.hoogl...@gmail.com>
Subject weird test failure
Date Tue, 06 Aug 2013 15:16:35 GMT
H,

I just had a time skew that seems impossible:

if in the folowing test the sleep is 1000 it reports a failure saying
the duration was 999. now I see at least some clock ticks around it so
whats heppening? An overeager optimizer, maybe? I had to set it to
1001 to make it work. This is not new code, it has been there since
jan 24! So i ran it a few times.

public class TestProfiler extends Log4jEnabledTestCase {
    protected final static Logger s_logger =
Logger.getLogger(TestProfiler.class);

    @Test
    public void testProfiler() {
        s_logger.info("testProfiler() started");

        Profiler pf = new Profiler();
        pf.start();
        try {
            Thread.sleep(1001);
        } catch (InterruptedException e) {
        }
        pf.stop();

        s_logger.info("Duration : " + pf.getDuration());

        Assert.assertTrue(pf.getDuration() >= 1000);

        s_logger.info("testProfiler() stopped");
    }
}

any clue welcome,
Daan

Mime
View raw message