diff options
author | Dan Nicholson <dbn.lists@gmail.com> | 2009-05-09 15:45:41 -0700 |
---|---|---|
committer | Dan Nicholson <dbn.lists@gmail.com> | 2009-05-09 16:37:18 -0700 |
commit | 57e591c23b389d9fb79b89ed44a88aa2b4c1f7a8 (patch) | |
tree | 7c4c2a4a29e1e69e6d594212e42aadd25e1a8961 /src/tet3 | |
parent | f0e53ca2e5d245d4355a7c0ee1faab383fe659e7 (diff) |
tcc: Exit with a failure code if any of the tests failed
tcc was always exiting successfully so long as all the processes it was
governing were completing. However, we want it to fail if any of the
processes (tests) fail.
Changes have been made throughout the code to pass up results of tests
to tcc. The tet_addresult function allows multiple integer return codes
to be handled by prefering failing codes.
Diffstat (limited to 'src/tet3')
-rw-r--r-- | src/tet3/tcc/scenario.c | 8 | ||||
-rw-r--r-- | src/tet3/tcc/service.c | 8 | ||||
-rw-r--r-- | src/tet3/tcc/tcc.c | 6 | ||||
-rw-r--r-- | src/tet3/tcc/tcc.h | 4 | ||||
-rw-r--r-- | src/tet3/tcm/dtcm.c | 35 | ||||
-rw-r--r-- | src/tet3/tcm/ictp.c | 2 |
6 files changed, 40 insertions, 23 deletions
diff --git a/src/tet3/tcc/scenario.c b/src/tet3/tcc/scenario.c index 4a6ebfc0..ecea0ad1 100644 --- a/src/tet3/tcc/scenario.c +++ b/src/tet3/tcc/scenario.c @@ -175,11 +175,11 @@ char *scenario, *sopt, *cwd; ** execscen() - execute (process) the scenario */ -void execscen() +int execscen() { register struct proctab *prp, *q; static int sys0 = 0; - int delay, ndelay; + int delay, ndelay, status = EXIT_SUCCESS; time_t now, next; /* return now if the scenario is empty */ @@ -228,7 +228,7 @@ void execscen() #endif /* NOTRACE */ SLEEP((unsigned) ndelay); } - tcc_sloop(); + status = tet_addresult(status, tcc_sloop()); if (prp->pr_state == PRS_IDLE) break; now = time((time_t *) 0); @@ -245,6 +245,8 @@ void execscen() /* all finished so free the proctab and return */ prfree(prp); + + return status; } /* diff --git a/src/tet3/tcc/service.c b/src/tet3/tcc/service.c index 1f482653..9657370e 100644 --- a/src/tet3/tcc/service.c +++ b/src/tet3/tcc/service.c @@ -37,6 +37,7 @@ MODIFICATIONS: ************************************************************************/ #include <stdio.h> +#include <stdlib.h> #include <sys/types.h> #include <time.h> #include "dtmac.h" @@ -72,10 +73,11 @@ static void wakeup PROTOLIST((struct proctab *)); ** service all entries in the run queue which need attention */ -void tcc_sloop() +int tcc_sloop() { register struct proctab *prp, *rqforw; register int done; + int status = EXIT_SUCCESS; TRACE1(tet_Texec, 2, "tcc_sloop() START"); @@ -88,6 +90,8 @@ void tcc_sloop() if (prp->pr_flags & PRF_ATTENTION) { prp->pr_flags &= ~PRF_ATTENTION; tcc_service(prp); + status = tet_addresult(status, + prp->pr_jnlstatus); done = 0; } } @@ -95,6 +99,8 @@ void tcc_sloop() } while (!done); TRACE1(tet_Texec, 2, "tcc_sloop() END"); + + return status; } /* diff --git a/src/tet3/tcc/tcc.c b/src/tet3/tcc/tcc.c index a3071c36..c26ac565 100644 --- a/src/tet3/tcc/tcc.c +++ b/src/tet3/tcc/tcc.c @@ -121,7 +121,7 @@ char **argv; char *codelist = (char *) 0; char *old_journal_file = (char *) 0; char *scenario = "all"; - int errors = 0; + int errors = 0, status = EXIT_SUCCESS; /* ** initialise the global variables for use by the library - @@ -501,10 +501,10 @@ char **argv; initenviron(); /* fire up the execution engine and process the scenario */ - execscen(); + status = execscen(); /* here if all has been successful */ - tcc_exit(0); + tcc_exit(status); /* NOTREACHED */ return(1); } diff --git a/src/tet3/tcc/tcc.h b/src/tet3/tcc/tcc.h index f0561ddc..a8d5d86f 100644 --- a/src/tet3/tcc/tcc.h +++ b/src/tet3/tcc/tcc.h @@ -146,7 +146,7 @@ extern void distcfg PROTOLIST((void)); extern void doconfig PROTOLIST((void)); extern void engine_shutdown PROTOLIST((void)); extern void exec_block_signals PROTOLIST((void)); -extern void execscen PROTOLIST((void)); +extern int execscen PROTOLIST((void)); extern void execsigtrap PROTOLIST((void)); extern void exec_unblock_signals PROTOLIST((void)); extern void fullpath PROTOLIST((char *, char *, char [], int, int)); @@ -221,7 +221,7 @@ extern int tcc_mkdir PROTOLIST((int, char *)); extern int tcc_putenv PROTOLIST((int, char *)); extern int tcc_putenvv PROTOLIST((int, char **, int)); extern int tcc_rmdir PROTOLIST((int, char *)); -extern void tcc_sloop PROTOLIST((void)); +extern int tcc_sloop PROTOLIST((void)); extern int tcc_timeouts PROTOLIST((time_t)); extern int tcc_unlink PROTOLIST((int, char *)); extern int tcc_waitnohang PROTOLIST((int, long, int *)); diff --git a/src/tet3/tcm/dtcm.c b/src/tet3/tcm/dtcm.c index 43671300..43eebdf7 100644 --- a/src/tet3/tcm/dtcm.c +++ b/src/tet3/tcm/dtcm.c @@ -218,8 +218,8 @@ static long start_sequence; static void build_icl2 PROTOLIST((char *, int, int)); static void build_icl3 PROTOLIST((char *, int, int)); static void build_iclist PROTOLIST((char **, int)); -static void call_1tp PROTOLIST((int, int, int)); -static int call_tps PROTOLIST((int, int)); +static int call_1tp PROTOLIST((int, int, int)); +static int call_tps PROTOLIST((int, int *)); static struct iclist *iclalloc PROTOLIST((void)); static int split PROTOLIST((char *, char **, int, int)); @@ -243,7 +243,7 @@ char **argv; { char *cp; struct iclist *icp; - int iccount, tpcount, icnum, rc; + int iccount, tpcount, icnum, rc, ret = TET_PASS; #ifndef TET_LITE /* -START-LITE-CUT */ int nsys; #endif /* -END-LITE-CUT- */ @@ -366,7 +366,8 @@ char **argv; ASSERT_LITE(rc == 0); if (rc < 0) tet_docleanup(EXIT_FAILURE); - tpcount = call_tps(icnum, tpcount); + ret = tet_addresult(ret, + call_tps(icnum, &tpcount)); tet_icend(icnum, tpcount); } @@ -374,7 +375,7 @@ char **argv; setsigs(sigabandon); /* call the user-supplied cleanup routine (if any) and exit */ - tet_docleanup(EXIT_SUCCESS); + tet_docleanup(ret); /* NOTREACHED */ return(EXIT_SUCCESS); @@ -388,18 +389,20 @@ char **argv; */ static int call_tps(icnum, tpcount) -int icnum, tpcount; +int icnum, *tpcount; { - int testcount, testnum, tpnum; + int testcount, testnum, tpnum, result = TET_PASS; #ifndef TET_LITE /* -START-LITE-CUT- */ long spno; #endif /* -END-LITE-CUT- */ + ASSERT(tpcount) + TRACE3(tet_Ttcm, 6, "call_tps(): icnum = %s, tpcount = %s", - tet_i2a(icnum), tet_i2a(tpcount)); + tet_i2a(icnum), tet_i2a(*tpcount)); testcount = 0; - for (tpnum = 1; tpnum <= tpcount; tpnum++) { + for (tpnum = 1; tpnum <= *tpcount; tpnum++) { #ifndef TET_LITE /* -START-LITE-CUT- */ spno = MK_ASPNO(0, tpnum, S_TPSTART); if (EX_TPNO(spno) != tpnum) { @@ -408,20 +411,24 @@ int icnum, tpcount; } #endif /* -END-LITE-CUT- */ testnum = tet_gettestnum(icnum, tpnum); - call_1tp(icnum, tpnum, testnum); + result = tet_addresult(result, + call_1tp(icnum, tpnum, testnum)); testcount++; } - return(testcount); + *tpcount = testcount; + return(result); } /* ** call_1tp() - call a single test purpose function */ -static void call_1tp(icnum, tpnum, testnum) +static int call_1tp(icnum, tpnum, testnum) int icnum, tpnum, testnum; { + int result; + TRACE4(tet_Ttcm, 6, "call_1tp(): icnum = %s, tpnum = %s, testnum = %s", tet_i2a(icnum), tet_i2a(tpnum), tet_i2a(testnum)); @@ -522,8 +529,10 @@ int icnum, tpnum, testnum; ** if the action code for the result is ABORT, call the user-supplied ** cleanup function and exit */ - if (tet_tpend(icnum, tpnum, testnum) < 0) + if ((result = tet_tpend(icnum, tpnum, testnum)) < 0) tet_docleanup(EXIT_FAILURE); + + return result; } diff --git a/src/tet3/tcm/ictp.c b/src/tet3/tcm/ictp.c index 5b77514c..ec9737e1 100644 --- a/src/tet3/tcm/ictp.c +++ b/src/tet3/tcm/ictp.c @@ -565,7 +565,7 @@ int icno, tpno, testnum; return(-1); } - return(0); + return(result); } #else /* -START-LITE-CUT- */ |