summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorDan Nicholson <dbn.lists@gmail.com>2009-05-16 10:46:38 -0700
committerDan Nicholson <dbn.lists@gmail.com>2009-05-16 10:46:38 -0700
commit57b2ffba5724dfbc20a360d89e40262e406008e3 (patch)
tree755a33ee6174b2a1d9f619da3410b38840726ea4 /src
parentc8a3fc56bab4e7b7652a4689f4f3f762ae819356 (diff)
tcc: Convert test results to exit codes
In order to play nice with automake's concept of test exit codes, convert the scenario results to exit codes and let them accumulate appropriately.
Diffstat (limited to 'src')
-rw-r--r--src/tet3/dtet2lib/rescode.c66
-rw-r--r--src/tet3/inc/dtetlib.h2
-rw-r--r--src/tet3/tcc/scenario.c5
-rw-r--r--src/tet3/tcc/service.c5
-rw-r--r--src/tet3/tcm/dtcm.c11
5 files changed, 81 insertions, 8 deletions
diff --git a/src/tet3/dtet2lib/rescode.c b/src/tet3/dtet2lib/rescode.c
index 8f62abae..f1ecb4a1 100644
--- a/src/tet3/dtet2lib/rescode.c
+++ b/src/tet3/dtet2lib/rescode.c
@@ -497,3 +497,69 @@ register int lastresult, thisresult;
}
}
+/*
+** tet_resulttostatus() - convert result code to exit status
+**
+** return exit status corresponding to result code
+*/
+
+int tet_resulttostatus(result)
+int result;
+{
+ switch (result) {
+ case TET_PASS:
+ return TET_EXIT_SUCCESS;
+ case TET_FAIL:
+ case TET_UNRESOLVED:
+ case TET_UNINITIATED:
+ return TET_EXIT_FAILURE;
+ case TET_NOTINUSE:
+ case TET_UNSUPPORTED:
+ case TET_UNTESTED:
+ return TET_EXIT_SKIP;
+ default:
+ /* Pass everything else (include TET_NORESULT) */
+ return result;
+ }
+}
+
+/*
+** tet_addstatus() - arbitrate between exit status codes
+**
+** return status with highest priority
+*/
+
+int tet_addstatus(laststatus, thisstatus)
+register int laststatus, thisstatus;
+{
+ if (laststatus < 0)
+ return(thisstatus);
+
+ switch (thisstatus) {
+ case TET_EXIT_SUCCESS:
+ /* lowest priority */
+ return(laststatus);
+
+ case TET_EXIT_FAILURE:
+ /* highest priority */
+ return(thisstatus);
+
+ case TET_EXIT_SKIP:
+ /* low priority */
+ switch (laststatus) {
+ case TET_EXIT_SUCCESS:
+ return(thisstatus);
+ default:
+ return(laststatus);
+ }
+
+ default:
+ /* user-supplied codes: high priority */
+ switch (laststatus) {
+ case TET_EXIT_FAILURE:
+ return(laststatus);
+ default:
+ return(thisstatus);
+ }
+ }
+}
diff --git a/src/tet3/inc/dtetlib.h b/src/tet3/inc/dtetlib.h
index 7f299069..9ab3b817 100644
--- a/src/tet3/inc/dtetlib.h
+++ b/src/tet3/inc/dtetlib.h
@@ -57,6 +57,8 @@ MODIFICATIONS:
/* extern function declarations */
extern char **tet_addargv PROTOLIST((char **, char **));
extern int tet_addresult PROTOLIST((int, int));
+extern int tet_resulttostatus PROTOLIST((int));
+extern int tet_addstatus PROTOLIST((int, int));
TET_IMPORT_FUNC(char *, tet_basename, PROTOLIST((char *)));
TET_IMPORT_FUNC(int, tet_bufchk, PROTOLIST((char **, int *, int)));
TET_IMPORT_FUNC(int, tet_buftrace,
diff --git a/src/tet3/tcc/scenario.c b/src/tet3/tcc/scenario.c
index ecea0ad1..2d50386a 100644
--- a/src/tet3/tcc/scenario.c
+++ b/src/tet3/tcc/scenario.c
@@ -58,6 +58,7 @@ MODIFICATIONS:
#include "dirtab.h"
#include "proctab.h"
#include "tcc.h"
+#include "tet_api.h"
#ifndef NOTRACE
#include "ltoa.h"
@@ -179,7 +180,7 @@ int execscen()
{
register struct proctab *prp, *q;
static int sys0 = 0;
- int delay, ndelay, status = EXIT_SUCCESS;
+ int delay, ndelay, status = TET_EXIT_SUCCESS;
time_t now, next;
/* return now if the scenario is empty */
@@ -228,7 +229,7 @@ int execscen()
#endif /* NOTRACE */
SLEEP((unsigned) ndelay);
}
- status = tet_addresult(status, tcc_sloop());
+ status = tet_addstatus(status, tcc_sloop());
if (prp->pr_state == PRS_IDLE)
break;
now = time((time_t *) 0);
diff --git a/src/tet3/tcc/service.c b/src/tet3/tcc/service.c
index 9657370e..973b71d5 100644
--- a/src/tet3/tcc/service.c
+++ b/src/tet3/tcc/service.c
@@ -46,6 +46,7 @@ MODIFICATIONS:
#include "scentab.h"
#include "dirtab.h"
#include "tcc.h"
+#include "tet_api.h"
#ifndef NOTRACE
#include "ltoa.h"
@@ -77,7 +78,7 @@ int tcc_sloop()
{
register struct proctab *prp, *rqforw;
register int done;
- int status = EXIT_SUCCESS;
+ int status = TET_EXIT_SUCCESS;
TRACE1(tet_Texec, 2, "tcc_sloop() START");
@@ -90,7 +91,7 @@ int tcc_sloop()
if (prp->pr_flags & PRF_ATTENTION) {
prp->pr_flags &= ~PRF_ATTENTION;
tcc_service(prp);
- status = tet_addresult(status,
+ status = tet_addstatus(status,
prp->pr_jnlstatus);
done = 0;
}
diff --git a/src/tet3/tcm/dtcm.c b/src/tet3/tcm/dtcm.c
index 43eebdf7..0ce9380d 100644
--- a/src/tet3/tcm/dtcm.c
+++ b/src/tet3/tcm/dtcm.c
@@ -243,7 +243,7 @@ char **argv;
{
char *cp;
struct iclist *icp;
- int iccount, tpcount, icnum, rc, ret = TET_PASS;
+ int iccount, tpcount, icnum, rc, status = TET_EXIT_SUCCESS;
#ifndef TET_LITE /* -START-LITE-CUT */
int nsys;
#endif /* -END-LITE-CUT- */
@@ -361,13 +361,16 @@ char **argv;
for (icp = iclist; icp < iclist + niclist; icp++)
for (icnum = icp->ic_start; icnum <= icp->ic_end; icnum++)
if (tet_isdefic(icnum)) {
+ int ret;
+
tpcount = tet_gettpcount(icnum);
rc = tet_icstart(icnum, tpcount);
ASSERT_LITE(rc == 0);
if (rc < 0)
tet_docleanup(EXIT_FAILURE);
- ret = tet_addresult(ret,
- call_tps(icnum, &tpcount));
+ ret = call_tps(icnum, &tpcount);
+ status = tet_addstatus(status,
+ tet_resulttostatus(ret));
tet_icend(icnum, tpcount);
}
@@ -375,7 +378,7 @@ char **argv;
setsigs(sigabandon);
/* call the user-supplied cleanup routine (if any) and exit */
- tet_docleanup(ret);
+ tet_docleanup(status);
/* NOTREACHED */
return(EXIT_SUCCESS);