summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDan Nicholson <dbn.lists@gmail.com>2009-09-24 23:27:37 -0700
committerDan Nicholson <dbn.lists@gmail.com>2009-09-24 23:27:37 -0700
commit830f253234c94636c197617466c4b2910a39e574 (patch)
tree9ee89bdfc2178f4ae7bc10805110227404dfef53
parent0e0fda1799a566cb72f1575b49b06136cc365529 (diff)
tet: Print status of tests
Report the status of the test cases and the composite exit code of the test programs to stdout. The tet_getstatusname function is added to convert exit codes to a string.
-rw-r--r--src/tet3/dtet2lib/rescode.c33
-rw-r--r--src/tet3/tcm/dtcm.c4
2 files changed, 37 insertions, 0 deletions
diff --git a/src/tet3/dtet2lib/rescode.c b/src/tet3/dtet2lib/rescode.c
index 0715639b..7930c960 100644
--- a/src/tet3/dtet2lib/rescode.c
+++ b/src/tet3/dtet2lib/rescode.c
@@ -99,6 +99,23 @@ struct restab *tet_restab;
int tet_nrestab;
static int lrestab;
+/* structure of an entry in the status code table */
+struct statustab {
+ char *st_name; /* status name */
+ int st_code; /* status code */
+};
+
+/* default status code table */
+static struct statustab tet_statustab[] = {
+ "PASS", TET_EXIT_SUCCESS,
+ "FAIL", TET_EXIT_FAILURE,
+ "SKIP", TET_EXIT_SKIP,
+};
+
+#define Ntet_statustab (sizeof(tet_statustab) / sizeof(tet_statustab[0]))
+
+static char invalid_status[] = "INVALID STATUS";
+
/* static function declarations */
static void badresline PROTOLIST((char *, int, char *));
static struct restab *getrtbycode PROTOLIST((int));
@@ -502,6 +519,22 @@ register int lastresult, thisresult;
}
/*
+** tet_getstatusname() - look up status code in the status table;
+** return name if found, otherwise a default string
+*/
+
+char *tet_getstatusname(status)
+int status;
+{
+ register struct statustab *stp;
+
+ for (stp = tet_statustab; stp < tet_statustab + Ntet_statustab; stp++)
+ if (stp->st_code == status)
+ return stp->st_name;
+ return invalid_status;
+}
+
+/*
** tet_resulttostatus() - convert result code to exit status
**
** return exit status corresponding to result code
diff --git a/src/tet3/tcm/dtcm.c b/src/tet3/tcm/dtcm.c
index 490396ca..d78376b0 100644
--- a/src/tet3/tcm/dtcm.c
+++ b/src/tet3/tcm/dtcm.c
@@ -373,10 +373,14 @@ char **argv;
if (rc < 0)
tet_docleanup(EXIT_FAILURE);
ret = call_tps(icnum, &tpcount);
+ printf("%s (%d/%d): %s\n", tet_pname,
+ icnum, icp->ic_end,
+ tet_get_code(ret, NULL));
status = tet_addstatus(status,
tet_resulttostatus(ret));
tet_icend(icnum, tpcount);
}
+ printf("%s: %s\n", tet_pname, tet_getstatusname(status));
/* unexpected signals are fatal during cleanup */
setsigs(sigabandon);