summaryrefslogtreecommitdiffstats
path: root/patches/ltp-full-20090131/ltp-full-20090131-pan-dont-run-infinite.diff
blob: 9c6d37a0fdc4c3d684685a04e70b87f7a6a3bad7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
Subject: limit starts when running for certain time, too
From: Marc Kleine-Budde <mkl@pengutronix.de>

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>
---
 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 {