Closed Bug 478192 Opened 16 years ago Closed 2 years ago

Add a timed-running thing to the js shell

Categories

(Core :: JavaScript Engine, enhancement)

x86
macOS
enhancement

Tracking

()

RESOLVED WONTFIX

People

(Reporter: jruderman, Unassigned)

Details

jsfunfuzz is constrained by the need to avoid generating code that hangs. It would be sweet if we used the infrastructure behind "timeout()" to give me a way to recover from having generated a function that hangs. Igor suggests timed(generatedFunction, 100) to run generatedFunction but return to this point (perhaps throwing an exception) if it takes more than 100ms. This would be especially helpful for testing upvar, because that's all about tangled messes of imperative and functional styles of programming.
You should be able to do that in the shell already. timeout(10) f() Will stop f after 10s and terminate. If you put some printing logic in the return path of f, you can see whether you got terminated or not.
(In reply to comment #1) > You should be able to do that in the shell already. Good point. The shell can also use a special exit code to indicate the exit after timeout.
With the patch from bug 477850 comment 33 the shell exits with code 6 when execution is canceled due to timeout expiration.
Assignee: general → nobody
Severity: normal → S3
Status: NEW → RESOLVED
Closed: 2 years ago
Resolution: --- → WONTFIX
You need to log in before you can comment on or make changes to this bug.