diff options
author | Xiaoguang Wang <wangxg.fnst@cn.fujitsu.com> | 2014-09-23 15:59:43 +0800 |
---|---|---|
committer | Cyril Hrubis <chrubis@suse.cz> | 2014-09-23 14:23:06 +0200 |
commit | 5f71cf97d5753c5506cdf8287812f28e2fffe4aa (patch) | |
tree | b787f4468ab68dc90ef7b89d0460069ce8e112f5 /pan | |
parent | cf0d626fe6224db3c714843dc7007e9f81d94a80 (diff) |
runltp, pan/ltp-pan.c: record test cases(not fully tested) into file
Since commit 6f6878f4e1406d79cae53564777c5e1245d2a124, we start to
differentiate TCONF from TFAIL, but in pan/ltp-pan.c, we still write
test cases that return TCONF into failcmdfile, this is wrong, fix this.
Meanwhile we add a '-T' option for runltp, to let user record test cases
that return TCONF, namely, by this file, users can know what cases are not
fully tested.
Reported-by: Shuang Qiu <shuang.qiu@oracle.com>
Signed-off-by: Xiaoguang Wang <wangxg.fnst@cn.fujitsu.com>
Acked-by: Cyril Hrubis <chrubis@suse.cz>
Diffstat (limited to 'pan')
-rw-r--r-- | pan/ltp-pan.c | 52 |
1 files changed, 43 insertions, 9 deletions
diff --git a/pan/ltp-pan.c b/pan/ltp-pan.c index 957199aa7..f495ef6d6 100644 --- a/pan/ltp-pan.c +++ b/pan/ltp-pan.c @@ -104,8 +104,9 @@ static struct collection *get_collection(char *file, int optind, int argc, static void pids_running(struct tag_pgrp *running, int keep_active); static int check_pids(struct tag_pgrp *running, int *num_active, int keep_active, FILE * logfile, FILE * failcmdfile, - struct orphan_pgrp *orphans, int fmt_print, - int *failcnt, int *tconfcnt, int quiet_mode); + FILE *tconfcmdfile, struct orphan_pgrp *orphans, + int fmt_print, int *failcnt, int *tconfcnt, + int quiet_mode); static void propagate_signal(struct tag_pgrp *running, int keep_active, struct orphan_pgrp *orphans); static void dump_coll(struct collection *coll); @@ -151,6 +152,7 @@ int main(int argc, char **argv) char *filename = "/dev/null"; /* filename to read test tags from */ char *logfilename = NULL; char *failcmdfilename = NULL; + char *tconfcmdfilename = NULL; char *outputfilename = NULL; struct collection *coll = NULL; struct tag_pgrp *running; @@ -158,6 +160,7 @@ int main(int argc, char **argv) struct utsname unamebuf; FILE *logfile = NULL; FILE *failcmdfile = NULL; + FILE *tconfcmdfile = NULL; int keep_active = 1; int num_active = 0; int failcnt = 0; /* count of total testcases that failed. */ @@ -182,7 +185,8 @@ int main(int argc, char **argv) struct sigaction sa; while ((c = - getopt(argc, argv, "AO:Sa:C:d:ef:hl:n:o:pqr:s:t:x:y")) != -1) { + getopt(argc, argv, "AO:Sa:C:T:d:ef:hl:n:o:pqr:s:t:x:y")) + != -1) { switch (c) { case 'A': /* all-stop flag */ has_brakes = 1; @@ -200,6 +204,13 @@ int main(int argc, char **argv) case 'C': /* name of the file where all failed commands will be */ failcmdfilename = strdup(optarg); break; + case 'T': + /* + * test cases that are not fully tested will be recorded + * in this file + */ + tconfcmdfilename = strdup(optarg); + break; case 'd': /* debug options */ sscanf(optarg, "%i", &Debug); break; @@ -442,6 +453,16 @@ int main(int argc, char **argv) } } + if (tconfcmdfilename) { + tconfcmdfile = fopen(tconfcmdfilename, "a+"); + if (!tconfcmdfile) { + fprintf(stderr, "pan(%s): Error %s (%d) opening " + "tconf cmd file '%s'\n", panname, + strerror(errno), errno, tconfcmdfilename); + exit(1); + } + } + if ((zoofile = zoo_open(zooname)) == NULL) { fprintf(stderr, "pan(%s): %s\n", panname, zoo_error); exit(1); @@ -564,8 +585,8 @@ int main(int argc, char **argv) } err = check_pids(running, &num_active, keep_active, logfile, - failcmdfile, orphans, fmt_print, &failcnt, - &tconfcnt, quiet_mode); + failcmdfile, tconfcmdfile, orphans, fmt_print, + &failcnt, &tconfcnt, quiet_mode); if (Debug & Drunning) { pids_running(running, keep_active); orphans_running(orphans); @@ -635,6 +656,11 @@ int main(int argc, char **argv) if (logfile && (logfile != stdout)) fclose(logfile); + if (failcmdfile) + fclose(failcmdfile); + + if (tconfcmdfile) + fclose(tconfcmdfile); exit(exit_stat); } @@ -676,8 +702,9 @@ propagate_signal(struct tag_pgrp *running, int keep_active, static int check_pids(struct tag_pgrp *running, int *num_active, int keep_active, - FILE * logfile, FILE * failcmdfile, struct orphan_pgrp *orphans, - int fmt_print, int *failcnt, int *tconfcnt, int quiet_mode) + FILE *logfile, FILE *failcmdfile, FILE *tconfcmdfile, + struct orphan_pgrp *orphans, int fmt_print, int *failcnt, + int *tconfcnt, int quiet_mode) { int w; pid_t cpid; @@ -802,10 +829,17 @@ check_pids(struct tag_pgrp *running, int *num_active, int keep_active, fflush(logfile); } - if ((failcmdfile != NULL) && (w != 0)) { - fprintf(failcmdfile, "%s %s\n", + if (w != 0) { + if (tconfcmdfile != NULL && + w == TCONF) { + fprintf(tconfcmdfile, "%s %s\n", + running[i].cmd->name, + running[i].cmd->cmdline); + } else if (failcmdfile != NULL) { + fprintf(failcmdfile, "%s %s\n", running[i].cmd->name, running[i].cmd->cmdline); + } } if (running[i].stopping) |