[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Method of executing Mauve
From: |
Andy Walter |
Subject: |
Re: Method of executing Mauve |
Date: |
Wed, 6 Nov 2002 19:04:41 +0200 |
Hi Brian,
On Wednesday 06 November 2002 04:48, Brian Jones wrote:
> Someone mentioned they had a method of executing Mauve that would
> appropriately time out and kill the bad VM. I'm guessing some use of
> expect/tcl here. If there is an example I could look at that would be
> great.
We use a simple shell script for this.
The relevant part is this:
#!/bin/bash
set -m
${YOUR_VM} ${TEST} || echo "FAIL: execution aborted" &
vm_pid=$!
sleep ${TIMEOUT} && kill -kill $vm_pid 2>/dev/null && echo "Test timed out" &
kill_pid=$!
fg ${YOUR_VM} 2>/dev/null
kill -kill $kill_pid 2>/dev/null && echo Test did not time out
Where TIMEOUT, YOUR_VM and TEST should have reasonable values.
What happens is this: set -m turns on job monitoring (off by default for
scripts)
The VM runs a test in the background, we remember the PID.
Also in background, we wait for some time, then kill the VM-process and
remember the PID of the "killer".
Then, we wait for the VM to finish the test.
If the "killer" is still running, we kill it.
As far as I see, this should run with /bin/sh as well, but I didn't test it.
Cheers,
Andy.
--
aicas GmbH * Hoepfner Burg /"\ ASCII Ribbon Campaign
Haid-und-Neu-Straße 18 * 76131 Karlsruhe \ / No HTML or RTF in mail
http://www.aicas.com X No MS-Word in mail
Tel: +49-721-663 968-24; Fax: +49-721-663 968-94 / \ Respect Open Standards