X-Git-Url: https://git.xonotic.org/?p=xonotic%2Fgmqcc.git;a=blobdiff_plain;f=test.c;h=631f5e3fb0b942a2024f1a1ab4d008a453d5fc3a;hp=310f9966b9490864a43bc7947d3aef29a00c5e98;hb=3f546df67723e2ff4c7132a80af99cba8f134408;hpb=8d59d7029d02fef54d905f2de9babcb571f7ead2 diff --git a/test.c b/test.c index 310f996..631f5e3 100644 --- a/test.c +++ b/test.c @@ -484,7 +484,6 @@ task_template_t *task_template_compile(const char *file, const char *dir, size_t FILE *tempfile = NULL; task_template_t *tmpl = NULL; - memset (fullfile, 0, sizeof(fullfile)); snprintf(fullfile, sizeof(fullfile), "%s/%s", dir, file); tempfile = fs_file_open(fullfile, "r"); @@ -648,7 +647,6 @@ bool task_propagate(const char *curdir, size_t *pad, const char *defs) { dir = opendir(curdir); while ((files = readdir(dir))) { - memset (buffer, 0,sizeof(buffer)); snprintf(buffer, sizeof(buffer), "%s/%s", curdir, files->d_name); if (stat(buffer, &directory) == -1) { @@ -695,7 +693,6 @@ bool task_propagate(const char *curdir, size_t *pad, const char *defs) { * which will be refered to with a handle in the task for * reading the data from the pipe. */ - memset (buf,0,sizeof(buf)); if (qcflags) { if (tmpl->testflags && !strcmp(tmpl->testflags, "-no-defs")) { snprintf(buf, sizeof(buf), "%s %s/%s %s %s -o %s", @@ -757,7 +754,6 @@ bool task_propagate(const char *curdir, size_t *pad, const char *defs) { * Open up some file desciptors for logging the stdout/stderr * to our own. */ - memset (buf,0,sizeof(buf)); snprintf(buf, sizeof(buf), "%s.stdout", tmpl->tempfilename); task.stdoutlogfile = util_strdup(buf); if (!(task.stdoutlog = fs_file_open(buf, "w"))) { @@ -765,7 +761,6 @@ bool task_propagate(const char *curdir, size_t *pad, const char *defs) { continue; } - memset (buf,0,sizeof(buf)); snprintf(buf, sizeof(buf), "%s.stderr", tmpl->tempfilename); task.stderrlogfile = util_strdup(buf); if (!(task.stderrlog = fs_file_open(buf, "w"))) { @@ -798,7 +793,6 @@ void task_precleanup(const char *curdir) { dir = opendir(curdir); while ((files = readdir(dir))) { - memset(buffer, 0, sizeof(buffer)); if (strstr(files->d_name, "TMP") || strstr(files->d_name, ".stdout") || strstr(files->d_name, ".stderr")) @@ -949,17 +943,24 @@ bool task_execute(task_template_t *tmpl, char ***line) { * execution this takes more work since a task needs to be generated * from thin air and executed INLINE. */ +#include void task_schedualize(size_t *pad) { + char space[2][64]; bool execute = false; char *data = NULL; char **match = NULL; size_t size = 0; - size_t i; - size_t j; + size_t i = 0; + size_t j = 0; - util_debug("TEST", "found %d tasks, preparing to execute\n", vec_size(task_tasks)); + snprintf(space[0], sizeof(space[0]), "%d", (int)vec_size(task_tasks)); + + for (; i < vec_size(task_tasks); i++) { + memset(space[1], 0, sizeof(space[1])); + snprintf(space[1], sizeof(space[1]), "%d", (int)(i + 1)); + + con_out("test #%u %*s", i + 1, strlen(space[0]) - strlen(space[1]), ""); - for (i = 0; i < vec_size(task_tasks); i++) { util_debug("TEST", "executing task: %d: %s\n", i, task_tasks[i].tmpl->description); /* * Generate a task from thin air if it requires execution in @@ -1006,7 +1007,7 @@ void task_schedualize(size_t *pad) { } if (!task_tasks[i].compiled && strcmp(task_tasks[i].tmpl->proceduretype, "-fail")) { - con_err("test failure: `%s` (failed to compile) see %s.stdout and %s.stderr [%s]\n", + con_err("failure: `%s` (failed to compile) see %s.stdout and %s.stderr [%s]\n", task_tasks[i].tmpl->description, task_tasks[i].tmpl->tempfilename, task_tasks[i].tmpl->tempfilename, @@ -1016,7 +1017,7 @@ void task_schedualize(size_t *pad) { } if (!execute) { - con_out("test succeeded: `%s` %*s\n", + con_out("succeeded: `%s` %*s\n", task_tasks[i].tmpl->description, (pad[0] + pad[1] - strlen(task_tasks[i].tmpl->description)) + (strlen(task_tasks[i].tmpl->rulesfile) - pad[1]), @@ -1033,7 +1034,7 @@ void task_schedualize(size_t *pad) { if (!task_execute(task_tasks[i].tmpl, &match)) { size_t d = 0; - con_err("test failure: `%s` (invalid results from execution) [%s]\n", + con_err("failure: `%s` (invalid results from execution) [%s]\n", task_tasks[i].tmpl->description, task_tasks[i].tmpl->rulesfile ); @@ -1080,7 +1081,7 @@ void task_schedualize(size_t *pad) { mem_d(match[j]); vec_free(match); - con_out("test succeeded: `%s` %*s\n", + con_out("succeeded: `%s` %*s\n", task_tasks[i].tmpl->description, (pad[0] + pad[1] - strlen(task_tasks[i].tmpl->description)) + (strlen(task_tasks[i].tmpl->rulesfile) - pad[1]),