* Used to set the compilation flags for the given task, this
* must be provided, this tag is NOT optional.
*
+ * F: Used to set some test suite flags, currently the only option
+ * is -no-defs (to including of defs.qh)
+ *
* E:
* Used to set the execution flags for the given task. This tag
* must be provided if T == -execute, otherwise it's erroneous
char *tempfilename;
char **comparematch;
char *rulesfile;
+ char *testflags;
} task_template_t;
/*
case 'C': destval = &template->compileflags; break;
case 'E': destval = &template->executeflags; break;
case 'I': destval = &template->sourcefile; break;
+ case 'F': destval = &template->testflags; break;
default:
con_printmsg(LVL_ERROR, __FILE__, __LINE__, "internal error",
"invalid tag `%c:` during code generation\n",
case 'C':
case 'E':
case 'I':
+ case 'F':
if (data[1] != ':') {
con_printmsg(LVL_ERROR, file, line, "template parse error",
"expected `:` after `%c`",
template->sourcefile = NULL;
template->tempfilename = NULL;
template->rulesfile = NULL;
+ template->testflags = NULL;
}
task_template_t *task_template_compile(const char *file, const char *dir, size_t *pad) {
if ((*template)->executeflags) mem_d((*template)->executeflags);
if ((*template)->sourcefile) mem_d((*template)->sourcefile);
if ((*template)->rulesfile) mem_d((*template)->rulesfile);
+ if ((*template)->testflags) mem_d((*template)->testflags);
/*
* Delete all allocated string for task template then destroy the
* Read a directory and searches for all template files in it
* which is later used to run all tests.
*/
-bool task_propagate(const char *curdir, size_t *pad) {
+bool task_propagate(const char *curdir, size_t *pad, const char *defs) {
bool success = true;
DIR *dir;
struct dirent *files;
*/
memset (buf,0,sizeof(buf));
if (qcflags) {
- snprintf(buf, sizeof(buf), "%s %s/%s %s %s -o %s",
- task_bins[TASK_COMPILE],
- curdir,
- template->sourcefile,
- qcflags,
- template->compileflags,
- template->tempfilename
- );
+ if (template->testflags && !strcmp(template->testflags, "-no-defs")) {
+ snprintf(buf, sizeof(buf), "%s %s/%s %s %s -o %s",
+ task_bins[TASK_COMPILE],
+ curdir,
+ template->sourcefile,
+ qcflags,
+ template->compileflags,
+ template->tempfilename
+ );
+ } else {
+ snprintf(buf, sizeof(buf), "%s %s/%s %s/%s %s %s -o %s",
+ task_bins[TASK_COMPILE],
+ curdir,
+ defs,
+ curdir,
+ template->sourcefile,
+ qcflags,
+ template->compileflags,
+ template->tempfilename
+ );
+ }
} else {
- snprintf(buf, sizeof(buf), "%s %s/%s %s -o %s",
- task_bins[TASK_COMPILE],
- curdir,
- template->sourcefile,
- template->compileflags,
- template->tempfilename
- );
+ if (template->testflags && !strcmp(template->testflags, "-no-defs")) {
+ snprintf(buf, sizeof(buf), "%s %s/%s %s -o %s",
+ task_bins[TASK_COMPILE],
+ curdir,
+ template->sourcefile,
+ template->compileflags,
+ template->tempfilename
+ );
+ } else {
+ snprintf(buf, sizeof(buf), "%s %s/%s %s/%s %s -o %s",
+ task_bins[TASK_COMPILE],
+ curdir,
+ defs,
+ curdir,
+ template->sourcefile,
+ template->compileflags,
+ template->tempfilename
+ );
+ }
}
/*
*
* It expects con_init() was called before hand.
*/
-GMQCC_WARN bool test_perform(const char *curdir) {
+GMQCC_WARN bool test_perform(const char *curdir, const char *defs) {
+ static const char *default_defs = "defs.qh";
+
size_t pad[] = {
0, 0
};
+ /*
+ * If the default definition file isn't set to anything. We will
+ * use the default_defs here, which is "defs.qc"
+ */
+ if (!defs) {
+ defs = default_defs;
+ }
+
+
task_precleanup(curdir);
- if (!task_propagate(curdir, pad)) {
+ if (!task_propagate(curdir, pad, defs)) {
con_err("error: failed to propagate tasks\n");
task_destroy();
return false;
bool succeed = false;
char *redirout = (char*)stdout;
char *redirerr = (char*)stderr;
+ char *defs = NULL;
con_init();
continue;
if (parsecmd("redirerr", &argc, &argv, &redirerr, 1, false))
continue;
+ if (parsecmd("defs", &argc, &argv, &defs, 1, false))
+ continue;
con_change(redirout, redirerr);
}
}
con_change(redirout, redirerr);
- succeed = test_perform("tests");
+ succeed = test_perform("tests", defs);
util_meminfo();