aboutsummaryrefslogtreecommitdiff
path: root/pan
diff options
context:
space:
mode:
authorPeng Haitao <penght@cn.fujitsu.com>2012-05-17 09:59:22 +0800
committerCyril Hrubis <metan@ucw.cz>2012-05-17 13:04:24 +0200
commit204924aa4ba0bf51195405a66d6cd8d32bd17b91 (patch)
treebf36a49d07652e73c94f146c223fefe82a18265c /pan
parent3d3e94e7c0f056041a7138985871598f7715ad8a (diff)
ltp-pan.c: fix error of Total Tests
When execvp() fails, the testcases is counted in Total Tests, but not added in logfile. In fact the testcases result should be added in logfile. Signed-off-by: Peng Haitao <penght@cn.fujitsu.com> Acked-by: Wanlong Gao <gaowanlong@cn.fujitsu.com> Acked-by: Garrett Cooper <yanegomi@gmail.com>
Diffstat (limited to 'pan')
-rw-r--r--pan/ltp-pan.c30
1 files changed, 27 insertions, 3 deletions
diff --git a/pan/ltp-pan.c b/pan/ltp-pan.c
index 1b1456a9b..936949a4e 100644
--- a/pan/ltp-pan.c
+++ b/pan/ltp-pan.c
@@ -99,7 +99,8 @@ struct orphan_pgrp
};
static pid_t run_child(struct coll_entry *colle, struct tag_pgrp *active,
- int quiet_mode);
+ int quiet_mode, int *failcnt, int fmt_print,
+ FILE * logfile);
static char *slurp(char *file);
static struct collection *get_collection(char *file, int optind, int argc,
char **argv);
@@ -322,6 +323,7 @@ main(int argc, char **argv)
fprintf(logfile, "%-30.20s %-10.10s %-10.10s\n",
"--------", "------", "------------");
}
+ fflush(logfile);
}
coll = get_collection(filename, optind, argc, argv);
@@ -493,7 +495,8 @@ main(int argc, char **argv)
break;
}
- cpid = run_child(coll->ary[c], running + i, quiet_mode);
+ cpid = run_child(coll->ary[c], running + i, quiet_mode, &failcnt,
+ fmt_print, logfile);
if (cpid != -1)
++num_active;
if ((cpid != -1 || sequential) && starts > 0)
@@ -804,7 +807,8 @@ check_pids(struct tag_pgrp *running, int *num_active, int keep_active,
static pid_t
-run_child(struct coll_entry *colle, struct tag_pgrp *active, int quiet_mode)
+run_child(struct coll_entry *colle, struct tag_pgrp *active, int quiet_mode,
+ int *failcnt, int fmt_print, FILE * logfile)
{
ssize_t errlen;
int cpid;
@@ -978,6 +982,26 @@ run_child(struct coll_entry *colle, struct tag_pgrp *active, int quiet_mode)
termtype = "unknown";
}
time(&end_time);
+ if (logfile != NULL) {
+ if (!fmt_print) {
+ fprintf(logfile,
+ "tag=%s stime=%d dur=%d exit=%s "
+ "stat=%d core=%s cu=%d cs=%d\n",
+ colle->name, (int)(active->mystime),
+ (int) (end_time - active->mystime), termtype,
+ termid, (status & 0200) ? "yes" : "no",
+ 0, 0);
+ } else {
+ if (termid != 0)
+ ++*failcnt;
+
+ fprintf(logfile, "%-30.30s %-10.10s %-5d\n",
+ colle->name, ((termid != 0) ? "FAIL" : "PASS"),
+ termid);
+ }
+ fflush(logfile);
+ }
+
if (!quiet_mode)
{
//write_test_start(active, errbuf);