]> git.xonotic.org Git - xonotic/gmqcc.git/blobdiff - test.c
Use hashtable for macro definitions in the preprocessor, this speeds up the search...
[xonotic/gmqcc.git] / test.c
diff --git a/test.c b/test.c
index 97ac09f9a6d8f8cc6e42a807370a5ef1789a4456..d853f41f09704927f91dddeed8c9e723d833d6bd 100644 (file)
--- a/test.c
+++ b/test.c
@@ -315,7 +315,7 @@ bool task_template_generate(task_template_t *tmpl, char tag, const char *file, s
     if (strchr(value, '\n'))
         *strrchr(value, '\n')='\0';
     else /* cppcheck: possible nullpointer dereference */
-        abort();
+        exit(EXIT_FAILURE);
 
     /*
      * Now allocate and set the actual value for the specific tag. Which
@@ -428,7 +428,7 @@ bool task_template_parse(const char *file, task_template_t *tmpl, FILE *fp, size
                 if (strrchr(value, '\n'))
                     *strrchr(value, '\n')='\0';
                 else /* cppcheck: possible null pointer dereference */
-                    abort();
+                    exit(EXIT_FAILURE);
 
                 vec_push(tmpl->comparematch, util_strdup(value));
 
@@ -644,9 +644,9 @@ bool task_propagate(const char *curdir, size_t *pad, const char *defs) {
     char             buffer[4096];
     size_t           found = 0;
 
-    dir = opendir(curdir);
+    dir = fs_dir_open(curdir);
 
-    while ((files = readdir(dir))) {
+    while ((files = fs_dir_read(dir))) {
         snprintf(buffer,   sizeof(buffer), "%s/%s", curdir, files->d_name);
 
         if (stat(buffer, &directory) == -1) {
@@ -777,7 +777,7 @@ bool task_propagate(const char *curdir, size_t *pad, const char *defs) {
         found
     );
 
-    closedir(dir);
+    fs_dir_close(dir);
     return success;
 }
 
@@ -790,9 +790,9 @@ void task_precleanup(const char *curdir) {
     struct dirent   *files;
     char             buffer[4096];
 
-    dir = opendir(curdir);
+    dir = fs_dir_open(curdir);
 
-    while ((files = readdir(dir))) {
+    while ((files = fs_dir_read(dir))) {
         if (strstr(files->d_name, "TMP")     ||
             strstr(files->d_name, ".stdout") ||
             strstr(files->d_name, ".stderr"))
@@ -805,7 +805,7 @@ void task_precleanup(const char *curdir) {
         }
     }
 
-    closedir(dir);
+    fs_dir_close(dir);
 }
 
 void task_destroy(void) {
@@ -945,6 +945,7 @@ bool task_execute(task_template_t *tmpl, char ***line) {
  */
 #include <math.h>
 void task_schedualize(size_t *pad) {
+    char   space[2][64];
     bool   execute  = false;
     char  *data     = NULL;
     char **match    = NULL;
@@ -952,8 +953,13 @@ void task_schedualize(size_t *pad) {
     size_t i        = 0;
     size_t j        = 0;
 
+    snprintf(space[0], sizeof(space[0]), "%d", (int)vec_size(task_tasks));
+
     for (; i < vec_size(task_tasks); i++) {
-        con_out("test #%u %*s", i + 1, (int)log10(vec_size(task_tasks)) - (int)(log10(i + 1)), "");
+        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]), "");
 
         util_debug("TEST", "executing task: %d: %s\n", i, task_tasks[i].tmpl->description);
         /*
@@ -979,8 +985,6 @@ void task_schedualize(size_t *pad) {
                 task_tasks[i].compiled = false;
                 execute                = false;
             }
-
-            fs_file_flush(task_tasks[i].stdoutlog);
         }
         while (fs_file_getline(&data, &size, task_tasks[i].runhandles[2]) != EOF) {
             /*
@@ -997,7 +1001,6 @@ void task_schedualize(size_t *pad) {
             }
 
             fs_file_puts (task_tasks[i].stderrlog, data);
-            fs_file_flush(task_tasks[i].stdoutlog);
         }
 
         if (!task_tasks[i].compiled && strcmp(task_tasks[i].tmpl->proceduretype, "-fail")) {