]> git.xonotic.org Git - xonotic/gmqcc.git/blobdiff - test.c
Another peephole optimization
[xonotic/gmqcc.git] / test.c
diff --git a/test.c b/test.c
index 020cb2f1db1aad78e59290aa766b78c9fe1c684a..54fb2aaf3794d2fef6598b799ba6f933039fe5f6 100644 (file)
--- a/test.c
+++ b/test.c
@@ -25,8 +25,8 @@
 #include <sys/stat.h>
 #include <dirent.h>
 
-bool  opts_memchk = false;
-bool  opts_debug  = false;
+cmd_options opts;
+
 char *task_bins[] = {
     "./gmqcc",
     "./qcvm"
@@ -902,8 +902,7 @@ void task_schedualize() {
          * Generate a task from thin air if it requires execution in
          * the QCVM.
          */
-        if (!strcmp(task_tasks[i].template->proceduretype, "-execute"))
-            execute = true;
+        execute = !!(!strcmp(task_tasks[i].template->proceduretype, "-execute"));
 
         /*
          * We assume it compiled before we actually compiled :).  On error
@@ -943,7 +942,7 @@ void task_schedualize() {
             fflush(task_tasks[i].stdoutlog);
         }
 
-        if (!execute) {
+        if (!task_tasks[i].compiled) {
             con_err("test failure: `%s` [%s] (failed to compile) see %s.stdout and %s.stderr\n",
                 task_tasks[i].template->description,
                 (task_tasks[i].template->failuremessage) ?
@@ -953,6 +952,16 @@ void task_schedualize() {
             );
             continue;
         }
+
+        if (!execute) {
+            con_out("test succeeded: `%s` [%s]\n",
+                 task_tasks[i].template->description,
+                (task_tasks[i].template->successmessage) ?
+                 task_tasks[i].template->successmessage  : "unknown"
+            );
+            continue;
+        }
+
         /*
          * If we made it here that concludes the task is to be executed
          * in the virtual machine.
@@ -1086,11 +1095,11 @@ int main(int argc, char **argv) {
             con_change(redirout, redirerr);
 
             if (!strcmp(argv[0]+1, "debug")) {
-                opts_debug = true;
+                opts.debug = true;
                 continue;
             }
             if (!strcmp(argv[0]+1, "memchk")) {
-                opts_memchk = true;
+                opts.memchk = true;
                 continue;
             }
             if (!strcmp(argv[0]+1, "nocolor")) {