mirror of
https://github.com/DarkPlacesEngine/gmqcc.git
synced 2025-02-12 06:42:18 +00:00
More preprocessor testsuite support and our first preprocessor test!
This commit is contained in:
parent
c53fa31a0a
commit
e27eebe0f9
3 changed files with 26 additions and 7 deletions
25
test.c
25
test.c
|
@ -568,7 +568,7 @@ task_template_t *task_template_compile(const char *file, const char *dir, size_t
|
||||||
if (tmpl->comparematch)
|
if (tmpl->comparematch)
|
||||||
con_err("template compile warning: %s erroneous tag `M:` when only failing\n", file);
|
con_err("template compile warning: %s erroneous tag `M:` when only failing\n", file);
|
||||||
} else if (!strcmp(tmpl->proceduretype, "-pp")) {
|
} else if (!strcmp(tmpl->proceduretype, "-pp")) {
|
||||||
if (!tmpl->executeflags)
|
if (tmpl->executeflags)
|
||||||
con_err("template compile warning: %s erroneous tag `E:` when only preprocessing\n", file);
|
con_err("template compile warning: %s erroneous tag `E:` when only preprocessing\n", file);
|
||||||
if (!tmpl->comparematch) {
|
if (!tmpl->comparematch) {
|
||||||
con_err("template compile error: %s missing `M:` tag (use `$null` for exclude)\n", file);
|
con_err("template compile error: %s missing `M:` tag (use `$null` for exclude)\n", file);
|
||||||
|
@ -955,6 +955,13 @@ bool task_trymatch(task_template_t *tmpl, char ***line) {
|
||||||
if (strrchr(data, '\n'))
|
if (strrchr(data, '\n'))
|
||||||
*strrchr(data, '\n') = '\0';
|
*strrchr(data, '\n') = '\0';
|
||||||
|
|
||||||
|
/*
|
||||||
|
* If data is just null now, that means the line was an empty
|
||||||
|
* one and for that, we just ignore it.
|
||||||
|
*/
|
||||||
|
if (!*data)
|
||||||
|
continue;
|
||||||
|
|
||||||
if (vec_size(tmpl->comparematch) > compare) {
|
if (vec_size(tmpl->comparematch) > compare) {
|
||||||
if (strcmp(data, tmpl->comparematch[compare++]))
|
if (strcmp(data, tmpl->comparematch[compare++]))
|
||||||
success = false;
|
success = false;
|
||||||
|
@ -986,12 +993,12 @@ bool task_trymatch(task_template_t *tmpl, char ***line) {
|
||||||
|
|
||||||
const char *task_type(task_template_t *tmpl) {
|
const char *task_type(task_template_t *tmpl) {
|
||||||
if (!strcmp(tmpl->proceduretype, "-pp"))
|
if (!strcmp(tmpl->proceduretype, "-pp"))
|
||||||
return "type: preprocessor test";
|
return "type: preprocessor";
|
||||||
if (!strcmp(tmpl->proceduretype, "-execute"))
|
if (!strcmp(tmpl->proceduretype, "-execute"))
|
||||||
return "type: execution test";
|
return "type: execution";
|
||||||
if (!strcmp(tmpl->proceduretype, "-compile"))
|
if (!strcmp(tmpl->proceduretype, "-compile"))
|
||||||
return "type: compile test";
|
return "type: compile";
|
||||||
return "type: fail test";
|
return "type: fail";
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -1085,13 +1092,17 @@ void task_schedualize(size_t *pad) {
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* If we made it here that concludes the task is to be executed
|
* If we made it here that concludes the task is to be executed
|
||||||
* in the virtual machine.
|
* in the virtual machine (or the preprocessor output needs to
|
||||||
|
* be matched).
|
||||||
*/
|
*/
|
||||||
if (!task_trymatch(task_tasks[i].tmpl, &match)) {
|
if (!task_trymatch(task_tasks[i].tmpl, &match)) {
|
||||||
size_t d = 0;
|
size_t d = 0;
|
||||||
|
|
||||||
con_err("failure: `%s` (invalid results from execution) [%s]\n",
|
con_err("failure: `%s` (invalid results from %s) [%s]\n",
|
||||||
task_tasks[i].tmpl->description,
|
task_tasks[i].tmpl->description,
|
||||||
|
(strcmp(task_tasks[i].tmpl->proceduretype, "-pp"))
|
||||||
|
? "execution"
|
||||||
|
: "preprocessing",
|
||||||
task_tasks[i].tmpl->rulesfile
|
task_tasks[i].tmpl->rulesfile
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
2
tests/ppcat.qc
Normal file
2
tests/ppcat.qc
Normal file
|
@ -0,0 +1,2 @@
|
||||||
|
#define CAT(X, Y) X##Y
|
||||||
|
CAT(hello, world)
|
6
tests/ppcat.tmpl
Normal file
6
tests/ppcat.tmpl
Normal file
|
@ -0,0 +1,6 @@
|
||||||
|
I: ppcat.qc
|
||||||
|
D: test preprocessor concatenation
|
||||||
|
T: -pp
|
||||||
|
C: -std=gmqcc
|
||||||
|
M: helloworld
|
||||||
|
F: -no-defs
|
Loading…
Reference in a new issue