diff options
-rw-r--r-- | src/tet3/tcc/proctab.h | 3 | ||||
-rw-r--r-- | src/tet3/tcc/proctc.c | 13 | ||||
-rw-r--r-- | src/tet3/tcc/scenario.c | 42 |
3 files changed, 57 insertions, 1 deletions
diff --git a/src/tet3/tcc/proctab.h b/src/tet3/tcc/proctab.h index c8316c0d..1762c4ad 100644 --- a/src/tet3/tcc/proctab.h +++ b/src/tet3/tcc/proctab.h @@ -75,6 +75,9 @@ struct proctab { time_t pr_nextattn; /* time for next attention */ int pr_waitinterval; /* interval between waits */ int pr_waitcount; /* no of waits to do after a kill */ + int pr_ntests; /* number of tests run */ + int pr_nfail; /* number of tests failed */ + int pr_nskip; /* number of tests skip */ struct { int prc_modes; /* modes of operation */ int prc_loopcount; /* loop counter (for REPEAT, diff --git a/src/tet3/tcc/proctc.c b/src/tet3/tcc/proctc.c index 0dc1292f..15c1e9e6 100644 --- a/src/tet3/tcc/proctc.c +++ b/src/tet3/tcc/proctc.c @@ -62,6 +62,7 @@ MODIFICATIONS: #include "scentab.h" #include "proctab.h" #include "tcc.h" +#include "tet_api.h" #include "tet_jrnl.h" #ifndef NOTRACE @@ -305,8 +306,18 @@ register struct proctab *prp; if (rc < 0) prp->pr_scen->sc_flags |= SCF_SKIP_EXEC; break; - case TCS_BUILD: case TCS_EXEC: + prp->pr_ntests++; + switch (prp->pr_exitcode) { + case TET_EXIT_FAILURE: + prp->pr_nfail++; + break; + case TET_EXIT_SKIP: + prp->pr_nskip++; + break; + } + /* fall through */ + case TCS_BUILD: case TCS_CLEAN: rc = 0; break; diff --git a/src/tet3/tcc/scenario.c b/src/tet3/tcc/scenario.c index 43fa3908..1754eefe 100644 --- a/src/tet3/tcc/scenario.c +++ b/src/tet3/tcc/scenario.c @@ -51,6 +51,7 @@ MODIFICATIONS: #include <stdio.h> #include <stdlib.h> +#include <string.h> #include <limits.h> #include <sys/types.h> #include <time.h> @@ -80,6 +81,7 @@ static int ncmdscen; /* scenario file name */ static char *scenario_file = "tet_scen"; +static void print_summary PROTOLIST((struct proctab *)); /* ** proclopt() - store a -l command-line option for later processing @@ -247,6 +249,7 @@ int execscen() next = q->pr_nextattn; delay = (int) (next - now); } + print_summary(prp); /* all finished so free the proctab and return */ prfree(prp); @@ -303,3 +306,42 @@ register struct proctab *prp; return(1); } +/* +** print_summary() - print a summary of the testing to stdout +*/ + +static void print_summary(struct proctab *prp) +{ + char dashes[80], report[80], skipped[80]; + int rlen, slen = 0, dlen;; + + /* build the report line */ + if (prp->pr_nfail > 0) + rlen = snprintf(report, sizeof(report), + "%d of %d %s failed", + prp->pr_ntests, prp->pr_nfail, + (prp->pr_ntests > 0) ? "tests" : "test"); + else + rlen = snprintf(report, sizeof(report), + "%s%d %s passed", + (prp->pr_ntests > 0) ? "All " : "", + prp->pr_ntests, + (prp->pr_ntests > 0) ? "tests" : "test"); + + /* build the skipped line */ + if (prp->pr_nskip > 0) + slen = snprintf(skipped, sizeof(skipped), "(%d %s not run)", + prp->pr_nskip, + (prp->pr_ntests > 0) ? "tests were" : "test was"); + + /* build the dashes */ + dlen = TET_MAX(rlen, slen); + memset(dashes, '=', dlen); + dashes[dlen] = '\0'; + + puts(dashes); + puts(report); + if (slen > 0) + puts(skipped); + puts(dashes); +} |