On 18 October 2004 01:46, Ian Lynagh wrote:
> Attached is a patch that can give a per-process CPU limit to things
> run
> by the testsuite. I use it like this (300 is a fairly conservative
> figure - 120-130 seems to be about what is necessary):
>
> echo 'import IO; main = hPutStr stderr ""' > foo.hs
> $(MAKE) -C testsuite boot
> $(MAKE) -C testsuite/tests/ghc-regress \
> TIMEOUT=`python -c "import os; import math; from os
> import *; from resource import *; \ spawnl(os.P_WAIT,
> 'ghc/compiler/ghc-inplace',
> 'ghc-inplace', \ 'foo.hs', \ '-o',
> 'foo', '-O2'); \ spawnl(os.P_WAIT, 'foo', 'foo'); \
> xs = getrusage(RUSAGE_CHILDREN); \
> print (300*int(math.ceil(xs[0] + xs[1])))"`
>
> I assume resource is not available on all OSes, in particular not
> Windows,
And neither is ok.fork(), presumably.
Nevertheless, doing something this is a good plan. But it should also
catch idle (deadlocked) processes, rather than just runaway CPU-eating
processes.
And while you're in there, could you make it so that ^C properly kills a
testsuite run? :-)
> but I'm not a python guru so I don't know what the best way
> to handle that is?
>
> Also, is runCmdNoFail meant to be different to runCmd?
maybe it was at one stage, I can't remember. Looks like dead code now.
Cheers,
Simon
_______________________________________________
Cvs-ghc mailing list
[EMAIL PROTECTED]
http://www.haskell.org/mailman/listinfo/cvs-ghc