const struct tvec_reg *rin, *rout;
for (rd = tv->test->regs; rd->name; rd++) {
- if (rd->i >= tv->nrout) {
+ if (rd->i >= tv->cfg.nrout) {
if (!(f&TVMF_IN)) continue;
rin = TVEC_REG(tv, in, rd->i);
tvec_dumpreg(tv, TVRD_INPUT, rin->f&TVRF_LIVE ? &rin->v : 0, rd);
struct tvec_reg *r;
for (rd = tv->test->regs; rd->name; rd++) {
- assert(rd->i < tv->nreg); r = TVEC_REG(tv, in, rd->i);
+ assert(rd->i < tv->cfg.nreg); r = TVEC_REG(tv, in, rd->i);
rd->ty->init(&r->v, rd); r->f = 0;
- if (rd->i < tv->nrout)
+ if (rd->i < tv->cfg.nrout)
{ r = TVEC_REG(tv, out, rd->i); rd->ty->init(&r->v, rd); r->f = 0; }
}
}
struct tvec_reg *r;
for (rd = tv->test->regs; rd->name; rd++) {
- assert(rd->i < tv->nreg); r = TVEC_REG(tv, in, rd->i);
+ assert(rd->i < tv->cfg.nreg); r = TVEC_REG(tv, in, rd->i);
rd->ty->release(&r->v, rd); r->f = 0;
- if (rd->i < tv->nrout)
+ if (rd->i < tv->cfg.nrout)
{ r = TVEC_REG(tv, out, rd->i); rd->ty->release(&r->v, rd); r->f = 0; }
}
}
struct tvec_reg *r;
for (rd = tv->test->regs; rd->name; rd++) {
- assert(rd->i < tv->nreg);
- if (rd->i >= tv->nrout) continue;
+ assert(rd->i < tv->cfg.nreg);
+ if (rd->i >= tv->cfg.nrout) continue;
r = TVEC_REG(tv, out, rd->i);
rd->ty->release(&r->v, rd);
rd->ty->init(&r->v, rd);
const struct tvec_reg *rin, *rout;
for (rd = tv->test->regs; rd->name; rd++) {
- if (rd->i >= tv->nrout) continue;
+ if (rd->i >= tv->cfg.nrout) continue;
rin = TVEC_REG(tv, in, rd->i); rout = TVEC_REG(tv, out, rd->i);
if (!rin->f&TVRF_LIVE) continue;
if (!(rout->f&TVRF_LIVE) || !rd->ty->eq(&rin->v, &rout->v, rd))
if (!(tv->f&TVSF_OPEN)) return;
for (rd = t->regs; rd->name; rd++) {
- if (TVEC_REG(tv, in, rd->i)->f&TVRF_LIVE)
- { if (rd->i < tv->nrout) TVEC_REG(tv, out, rd->i)->f |= TVRF_LIVE; }
- else if (!(rd->f&TVRF_OPT)) {
+ if (TVEC_REG(tv, in, rd->i)->f&TVRF_LIVE) {
+ if (rd->i < tv->cfg.nrout)
+ TVEC_REG(tv, out, rd->i)->f |= TVRF_LIVE;
+ } else if (!(rd->f&TVRF_OPT)) {
tvec_error(tv, "required register `%s' not set in test `%s'",
rd->name, t->name);
f |= f_err;
{ "test-outcome", outcome_assoc, &outcome_range };
static const struct tvec_vardef outcome_vardef =
{ sizeof(struct tvec_reg), core_setvar,
- { "@outcome", 0, &tvty_uenum, 0, { &outcome_enum } } };
+ { "@outcome", &tvty_uenum, -1, 0, { &outcome_enum } } };
static const struct tvec_vardef *core_findvar
(struct tvec_state *tv, const char *name, void **ctx_out, void *ctx)
ch = getc(tv->fp); if (ch != ']') tvec_syntax(tv, ch, "`]'");
/* Find the matching test definition. */
- for (test = tv->tests; test->name; test++)
+ for (test = tv->cfg.tests; test->name; test++)
if (STRCMP(d.buf, ==, test->name)) goto found_test;
/* There wasn't one. Report the error. Muffle errors about the
tv_out->f = 0;
assert(config->nrout <= config->nreg);
- tv_out->nrout = config->nrout; tv_out->nreg = config->nreg;
- tv_out->regsz = config->regsz;
- tv_out->in = xmalloc(tv_out->nreg*tv_out->regsz);
- tv_out->out = xmalloc(tv_out->nrout*tv_out->regsz);
- for (i = 0; i < tv_out->nreg; i++) {
+ tv_out->cfg = *config;
+ tv_out->in = xmalloc(tv_out->cfg.nreg*tv_out->cfg.regsz);
+ tv_out->out = xmalloc(tv_out->cfg.nrout*tv_out->cfg.regsz);
+ for (i = 0; i < tv_out->cfg.nreg; i++) {
TVEC_REG(tv_out, in, i)->f = 0;
- if (i < tv_out->nrout) TVEC_REG(tv_out, out, i)->f = 0;
+ if (i < tv_out->cfg.nrout) TVEC_REG(tv_out, out, i)->f = 0;
}
for (i = 0; i < TVOUT_LIMIT; i++)
tv_out->curr[i] = tv_out->all[i] = tv_out->grps[i] = 0;
- tv_out->tests = config->tests; tv_out->test = 0;
+ tv_out->test = 0;
tv_out->infile = 0; tv_out->lno = 0; tv_out->fp = 0;
tv_out->output = o; tv_out->output->ops->bsession(tv_out->output, tv_out);
}
void tvec_adhoc(struct tvec_state *tv, struct tvec_test *t)
{
t->name = "<unset>"; t->regs = &no_regs; t->env = 0; t->fn = fakefn;
- tv->tests = t;
+ tv->cfg.tests = t;
}
/* --- @tvec_begingroup@ --- *
void tvec_begingroup(struct tvec_state *tv, const char *name,
const char *file, unsigned lno)
{
- struct tvec_test *t = (/*unconst*/ struct tvec_test *)tv->tests;
+ struct tvec_test *t = (/*unconst*/ struct tvec_test *)tv->cfg.tests;
t->name = name; tv->test = t;
tv->infile = file; tv->lno = tv->test_lno = lno;