diff options
author | Dan Nicholson <dbn.lists@gmail.com> | 2009-10-07 08:10:16 -0700 |
---|---|---|
committer | Dan Nicholson <dbn.lists@gmail.com> | 2009-10-07 08:10:16 -0700 |
commit | 799ccef3e2559f7c8a11f7e31800f6a2500be49e (patch) | |
tree | 12975369ea537a1327b74858870ae737f7c0f2fb /src | |
parent | a0ecc10f4ec24b6ffb16a2512c28a4ccb703e6f3 (diff) |
tcc: Print test suite and test case names in reports
tcc provides the test suite name (xts5) and test case name (e.g.
/Xproto/pAllocColor) to the test program via the environment. The test
program uses this information when outputting the results to stdout.
TET_TSNAME is a new global variable containing the test suite name
provided by tcc. This required a change to the config initialization to
only check if the value was an absolute path when necessary.
TET_TCNAME is a per-test-exec variable providing the test case name as
listed in the scenario file.
Diffstat (limited to 'src')
-rw-r--r-- | src/tet3/tcc/config.c | 39 | ||||
-rw-r--r-- | src/tet3/tcc/environ.c | 1 | ||||
-rw-r--r-- | src/tet3/tcc/exec.c | 11 | ||||
-rw-r--r-- | src/tet3/tcc/global.c | 3 | ||||
-rw-r--r-- | src/tet3/tcc/tcc.c | 21 | ||||
-rw-r--r-- | src/tet3/tcc/tcc.h | 3 | ||||
-rw-r--r-- | src/tet3/tcm/dtcm.c | 14 |
7 files changed, 62 insertions, 30 deletions
diff --git a/src/tet3/tcc/config.c b/src/tet3/tcc/config.c index 36b015ba..3accca12 100644 --- a/src/tet3/tcc/config.c +++ b/src/tet3/tcc/config.c @@ -161,16 +161,18 @@ static char *ecfname, *dcfname, *ccfname; struct dvar { char *dv_name; /* variable name */ int dv_needed; /* variable is needed on each system */ + int dv_pathvar; /* variable is a path */ int dv_len; /* strlen(mv_name) */ char *dv_value; /* value on master system */ }; static struct dvar dvar[] = { - { "TET_ROOT", 1 }, - { "TET_SUITE_ROOT", 0 }, - { "TET_TSROOT", 1 }, - { "TET_EXECUTE", 0 }, - { "TET_TMP_DIR", 0 }, - { "TET_RUN", 0 } + { "TET_ROOT", 1, 1 }, + { "TET_SUITE_ROOT", 0, 1 }, + { "TET_TSNAME", 0, 0 }, + { "TET_TSROOT", 1, 1 }, + { "TET_EXECUTE", 0, 1 }, + { "TET_TMP_DIR", 0, 1 }, + { "TET_RUN", 0, 1 } }; #define Ndvar (sizeof dvar / sizeof dvar[0]) @@ -179,9 +181,9 @@ static struct dvar dvar[] = { ** but should not be copied to the per-system distributed configurations */ static struct dvar mdvar[] = { - { "TET_LOCALHOST", 0 }, - { "TET_XTI_MODE", 0 }, - { "TET_XTI_TPI", 0 } + { "TET_LOCALHOST", 0, 1 }, + { "TET_XTI_MODE", 0, 1 }, + { "TET_XTI_TPI", 0, 1 } }; #define Nmdvar (sizeof mdvar / sizeof mdvar[0]) @@ -720,14 +722,16 @@ void distcfg() for (dvp = dvar; dvp < dvar + Ndvar; dvp++) { p = getdcfg(dvp->dv_name, sysid); if (p && *p) { - if (sysid == 0) - ASSERT(isabspathloc(p)); - else if (!isabspathrem(p)) { - (void) sprintf(buf, fmt1, - dvp->dv_name, sysid); - error(0, buf, - "is not an absolute path name"); - conferrors++; + if (dvp->dv_pathvar) { + if (sysid == 0) + ASSERT(isabspathloc(p)); + else if (!isabspathrem(p)) { + (void) sprintf(buf, fmt1, + dvp->dv_name, sysid); + error(0, buf, "is not an " + "absolute path name"); + conferrors++; + } } } else if (dvp->dv_needed) { @@ -2588,6 +2592,7 @@ static void initdvar() */ (dvp++)->dv_value = tet_root; (dvp++)->dv_value = tet_suite_root; + (dvp++)->dv_value = tet_tsname; (dvp++)->dv_value = tet_tsroot; (dvp++)->dv_value = tet_execute; (dvp++)->dv_value = tet_tmp_dir; diff --git a/src/tet3/tcc/environ.c b/src/tet3/tcc/environ.c index 24dc8bd7..e3fb940f 100644 --- a/src/tet3/tcc/environ.c +++ b/src/tet3/tcc/environ.c @@ -92,6 +92,7 @@ struct systab *sp; "TET_ROOT", "TET_EXECUTE", "TET_SUITE_ROOT", + "TET_TSNAME", "TET_RUN" }; diff --git a/src/tet3/tcc/exec.c b/src/tet3/tcc/exec.c index e7b018ff..6dda3844 100644 --- a/src/tet3/tcc/exec.c +++ b/src/tet3/tcc/exec.c @@ -76,6 +76,7 @@ char *path, **argv, *tcdir, *outfile; #endif /* TET_LITE */ /* -LITE-CUT-LINE- */ char buf[sizeof fmt + LNUMSZ]; char resbuf[MAXPATH + sizeof("TET_RESFILE=")]; + char tcbuf[MAXPATH + sizeof("TET_TCNAME=")]; struct systab *sp; long remid; #ifdef TET_LITE /* -LITE-CUT-LINE- */ @@ -115,6 +116,16 @@ char *path, **argv, *tcdir, *outfile; return(-1L); } + /* put the test case name into the environment */ + sprintf(tcbuf, "TET_TCNAME=%.*s", MAXPATH, prp->pr_scen->sc_tcname); + TRACE3(tet_Ttcc, 6, "putenv \"%s\" on system %s", + tcbuf, tet_i2a(*prp->pr_sys)); + if (tcc_putenv(*prp->pr_sys, tcbuf) < 0) { + prperror(prp, *prp->pr_sys, tet_tcerrno, + "tcc_putenv(TET_TCNAME) failed", NULL); + return(-1L); + } + /* change to the test case directory */ if (sychdir(sp, tcdir) < 0) { prperror(prp, *prp->pr_sys, errno ? errno : tet_tcerrno, diff --git a/src/tet3/tcc/global.c b/src/tet3/tcc/global.c index 262a79a3..a13c56fb 100644 --- a/src/tet3/tcc/global.c +++ b/src/tet3/tcc/global.c @@ -67,6 +67,9 @@ int tet_compat; */ char *tet_execute; +/* test suite name */ +char *tet_tsname; + /* test suite root on the local system */ char *tet_tsroot; diff --git a/src/tet3/tcc/tcc.c b/src/tet3/tcc/tcc.c index 7e84ee1a..eead1371 100644 --- a/src/tet3/tcc/tcc.c +++ b/src/tet3/tcc/tcc.c @@ -121,7 +121,6 @@ char **argv; char *jopt = (char *) 0; char *sopt = (char *) 0; char *xopt = (char *) 0; - char *tsname = (char *) 0; char *codelist = (char *) 0; char *old_journal_file = (char *) 0; char *scenario = "all"; @@ -326,39 +325,39 @@ char **argv; /* pick up the test suite name and the scenario name if they have been specified on the command line */ if (--argc > 0) - tsname = *++argv; + tet_tsname = *++argv; if (--argc > 0) scenario = *++argv; /* determine the test suite root */ - if (!tsname) { + if (!tet_tsname) { len = strlen(tet_suite_root); if ( !strncmp(cwd, tet_suite_root, len) && isdirsep(*(cwd + len)) ) { - tsname = cwd + strlen(tet_suite_root); - while (isdirsep(*tsname)) - tsname++; + tet_tsname = cwd + strlen(tet_suite_root); + while (isdirsep(*tet_tsname)) + tet_tsname++; (void) sprintf(fname, "%.*s", - (int) sizeof fname - 1, tsname); + (int) sizeof fname - 1, tet_tsname); for (p = fname; *p; p++) if (isdirsep(*p)) { *p = '\0'; break; } - tsname = rstrstore(fname); + tet_tsname = rstrstore(fname); } } - if (tsname && *tsname) { - fullpath(tet_suite_root, tsname, fname, sizeof fname, 0); + if (tet_tsname && *tet_tsname) { + fullpath(tet_suite_root, tet_tsname, fname, sizeof fname, 0); tet_tsroot = rstrstore(fname); } else fatal(0, "can't determine test suite name", (char *) 0); TRACE3(tet_Ttcc, 1, "test suite name = %s, test suite root = %s", - tsname, tet_tsroot); + tet_tsname, tet_tsroot); /* fix up tet_execute */ if (aopt && *aopt) { diff --git a/src/tet3/tcc/tcc.h b/src/tet3/tcc/tcc.h index a8d5d86f..05192737 100644 --- a/src/tet3/tcc/tcc.h +++ b/src/tet3/tcc/tcc.h @@ -52,6 +52,9 @@ extern char *tet_execute; /* test suite root on the local system */ extern char *tet_tsroot; +/* test suite name */ +extern char *tet_tsname; + /* test suite root on the local system from the environment ** (defaults to tet_root) */ diff --git a/src/tet3/tcm/dtcm.c b/src/tet3/tcm/dtcm.c index d78376b0..f40d8092 100644 --- a/src/tet3/tcm/dtcm.c +++ b/src/tet3/tcm/dtcm.c @@ -248,6 +248,7 @@ char **argv; char *cp; struct iclist *icp; int iccount, tpcount, icnum, rc, status = TET_EXIT_SUCCESS; + char *tsname, *tcname; #ifndef TET_LITE /* -START-LITE-CUT */ int nsys; #endif /* -END-LITE-CUT- */ @@ -295,6 +296,14 @@ char **argv; else tet_activity = atol(cp); + /* get the test suite and test case names from environment */ + tsname = getenv("TET_TSNAME"); + if (!tsname) + tsname = ""; + tcname = getenv("TET_TCNAME"); + if (!tcname) + tcname = tet_pname; + #ifdef TET_LITE /* open execution results file (do early, so tet_error() can use it) */ tet_openres(argv[0]); @@ -373,14 +382,15 @@ char **argv; if (rc < 0) tet_docleanup(EXIT_FAILURE); ret = call_tps(icnum, &tpcount); - printf("%s (%d/%d): %s\n", tet_pname, + printf("%s%s (%d/%d): %s\n", + tsname, tcname, 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)); + printf("%s%s: %s\n", tsname, tcname, tet_getstatusname(status)); /* unexpected signals are fatal during cleanup */ setsigs(sigabandon); |