Lighthouse has a new layout. Prefer the old one? Return to the old layout, and switch back any time from the link at the top of each page.

`test_exceed_time` fails on JeOS

#15

On a minimal JeOS (Ubuntu-based) system, test_exceed_time fails. It fails in a particularly exciting way, in that it gets stuck in an infinite loop and sucks up 100% CPU checking to see if true ever happens to equal false. :)

Aside from tracking down the bug, I'd suggest rewriting the test such that it fails gracefully. Something like:

@t.cx()
def test_exceed_time(cx):
    cx.max_time(1)
    import time
    start = time.time()
    try:
        cx.execute("""
            var start = ( new Date() ).getTime(),
                end   = 0;
            while( ( end - start ) < 1500  ) {
                end = ( new Date() ).getTime();
            }
        """);
        assert ( time.time() - start ) < 1, "Execution exceeded 1 second without throwing an error."
    except RuntimeError:
        return "Yay!  We caught a runtime error!";

Is one way to do that, but there's likely a much cleverer solution. :)

What info can I pass over to help diagnose the failure?

Reported by Mike West · May 16th, 2009 @ 09:44 AM

State: resolved
Milestone: none
Assigned to: Paul J. Davis Paul J. Davis

Activity

  1. Mike West
    Mike West

    test_get_set_limits fails as well. I was going to file another bug for that issue, but now that I look at it, I think it's related. max_time doesn't appear to correctly set the maximum execution time, which means that the test_exceed_time never times out. Traceback follows:

    ======================================================================
    FAIL: test-context.test_get_set_limits
    ----------------------------------------------------------------------
    Traceback (most recent call last):
      File "/home/mikewest/src/python-spidermonkey/nose-0.11.1-py2.6.egg/nose/case.py", line 183, in runTest
        self.test(*self.arg)
      File "/home/mikewest/src/python-spidermonkey/nose-0.11.1-py2.6.egg/nose/util.py", line 630, in newfunc
        return func(*arg, **kw)
      File "/home/mikewest/src/python-spidermonkey/tests/t.py", line 12, in run
        func(*self.args())
      File "/home/mikewest/src/python-spidermonkey/tests/test-context.py", line 35, in test_get_set_limits
        t.eq(cx.max_time(), 10)
      File "/home/mikewest/src/python-spidermonkey/tests/t.py", line 45, in eq
        assert a == b, "%r != %r" % (a, b)
    AssertionError: -4294967286L != 10
    
    ----------------------------------------------------------------------
    

    May 16th, 2009 @ 09:48 AM

  2. Paul J. Davis
    Paul J. Davis
    • State changed from new to open

    (from [4134ea66e00b6c6b1d80266ef61073d836a81477]) Fix for time limit constraints.

    The root bug I think has to do with conversions between integral types. I
    changed the Context.max_time method to be a bit less clever which will hopefully
    fix things. I also updated the test_exceeds_time to fail more gracefully as per
    suggestion.

    Thanks to Mike West

    [#15 `test_exceed_time` fails on JeOS state:open] http://github.com/davisp/python-spidermonkey/commit/4134ea66e00b6c6...

    May 16th, 2009 @ 04:57 PM

  3. Paul J. Davis
    Paul J. Davis

    Mike,

    Can you pull trunk and see if the new test works for you? If not I'm pretty certain it has to do with the type conversions I'm doing in max_time. Are you by chance on a 64 bit architecture?

    May 16th, 2009 @ 04:59 PM

  4. Mike West
    Mike West

    Looks good, Paul. :)

    You're correct: I'm running JeOS 64 bit inside VMWare. I pulled the latest trunk, and the max time tests pass. Nice work.. and quick!

    May 16th, 2009 @ 05:52 PM

  5. Paul J. Davis
    Paul J. Davis
    • State changed from open to resolved

    Awesome. I'm gonna close this ticket but when I get a chance at work I'll see if I can't find something more better than to limit time ranges to int's.

    May 16th, 2009 @ 05:57 PM

Please Sign in or create a free account to add a new ticket.

With your very own profile, you can contribute to projects, track your activity, watch tickets, receive and update tickets through your email and much more.