On Feb 18 12:12, Juergen Beisert wrote: > On Friday, 13. feb 2009, myself wrote: > > would it be possible to use 'pan' to monitoring a test? The timeout option > > (-t) would be a nice feature to force a kill after a specified amount of > > time to a test that might run amok (at least in my automated test > > environment without a human operator in front of the system under test). > > But when I'm using the -t option it runs the given command n times until > > the time is over. Is there a trick to let 'pan' run the given command only > > one times? > > Please find attached a small patch to add this simple feature to pan without > changing its previous behaviour. Running a test only once by pan for a > specific time is currently also possible without this patch. Just give the > '-t <time>' option *and* than the '-s 1' option. But it is racy yet, to do so. > Adding this patch removes this race. > > With > > $ pan <....> -t 60s -s 1 -- my_test > > the my_test will now run for one time only. If everyhing went ok, it returns > happy within the 60 seconds period. If my_test runs amok, it will never return > and pan will kill it after 60 seconds. > > --8<--------8<-------8<-------8<--------8<-------8<-----8<--------8<------ > > Subject: limit starts when running for certain time, too > From: Marc Kleine-Budde <[email protected]> > > This patches add a feature to limit the number of times a test is > started when running for a certain time instead of infinite runs. > > This could be used to give a timeout for a certain test. > > Signed-off-by: Marc Kleine-Budde <[email protected]> > Acked-by: Juergen Beisert <[email protected]>
Acked-by: Nathan Straz <[email protected]> > --- > pan/pan.c | 7 +++++-- > 1 file changed, 5 insertions(+), 2 deletions(-) > > Index: ltp-full-20090131/pan/pan.c > =================================================================== > --- ltp-full-20090131.orig/pan/pan.c > +++ ltp-full-20090131/pan/pan.c > @@ -164,6 +164,7 @@ main(int argc, char **argv) > int failcnt = 0; /* count of total testcases that failed. */ > int err, i; > int starts = -1; > + int timed = 0; > int run_time = -1; char modifier = 'm'; int ret = 0; > int stop; > int go_idle; > @@ -254,7 +255,7 @@ main(int argc, char **argv) > } > printf("PAN will run for %d seconds\n", run_time); > } > - starts = 0; //-t implies run as many starts as possible > + timed = 1; //-t implies run as many starts as possible, by > default > break; > case 'x': /* number of tags to keep running */ > keep_active = atoi(optarg); > @@ -347,7 +348,9 @@ main(int argc, char **argv) > /* Supply a default for starts. If we are in sequential mode, use > * the number of commands available; otherwise 1. > */ > - if (starts == -1) { > + if (timed == 1 && starts == -1) { /* timed, infinite by default */ > + starts = -1; > + } else if (starts == -1) { > if (sequential) { > starts = coll->cnt; > } else { ------------------------------------------------------------------------------ Open Source Business Conference (OSBC), March 24-25, 2009, San Francisco, CA -OSBC tackles the biggest issue in open source: Open Sourcing the Enterprise -Strategies to boost innovation and cut costs with open source participation -Receive a $600 discount off the registration fee with the source code: SFAD http://p.sf.net/sfu/XcvMzF8H _______________________________________________ Ltp-list mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/ltp-list
