PING: [Ada] Run ACATS tests through an expect script

Michael Chamberlain michael@chamberlain.net.au
Wed Dec 8 14:01:00 GMT 2004


On Tue, Dec 07, 2004 at 11:41:09AM +0100, Andreas Schwab wrote:
> Florian Weimer <fw@deneb.enyo.de> writes:
> 
> > * Laurent GUERBY:
> >
> >> Andreas on ia64 is using the following Bourne Shell magic
> >> to kill runaway tests.
> >
> > But the shell won't send SIGKILL to its child processes when it dies,
> > I think.  This means that not all possible hangs are taken care of.
> > (Testing continues, though, the hanging test is just not killed and
> > has to be terminated manually.)
> 
> That's right, it's just a band aid to avoid hanging completely.

The following appears to do the right thing, properly killing the child
process if the timeout occurs...

target_run () {
  sh -c "
(sleep $timeout && kill 2>/dev/null \$\$) &
watchdog=\$!
($*) &
child=\$!
trap \"kill 2>/dev/null \$child\" 0 1
wait \$child
status=\$?
trap \"\" 0 1
kill 2>/dev/null \$watchdog
exit \$status
"
}

Regards,
Michael.



More information about the Gcc-patches mailing list