aboutsummaryrefslogtreecommitdiff
path: root/pan
diff options
context:
space:
mode:
authorsubrata_modak <subrata_modak>2009-02-19 07:13:24 +0000
committersubrata_modak <subrata_modak>2009-02-19 07:13:24 +0000
commit27f88e7ef049d04e6a826232e7b78c0f77eeeb1e (patch)
tree646f05531c2f466bd0f8bac98b5ea26e56c67073 /pan
parentc11d2108c54cb722d7eb13d81305c5addd3e53e3 (diff)
Limit starts when running for certain time, too: 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<------. 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 <mkl@pengutronix.de>, Acked-by: Juergen Beisert <jbe@pengutronix.de>.
Diffstat (limited to 'pan')
-rw-r--r--pan/pan.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/pan/pan.c b/pan/pan.c
index a01ec92c9..1d6aae4fc 100644
--- a/pan/pan.c
+++ b/pan/pan.c
@@ -49,7 +49,7 @@
* - added option to create a command file with all failed tests.
*
*/
-/* $Id: pan.c,v 1.29 2009/01/19 09:05:34 subrata_modak Exp $ */
+/* $Id: pan.c,v 1.30 2009/02/19 07:13:24 subrata_modak Exp $ */
#include <errno.h>
#include <string.h>
@@ -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 {