]> git.rm.cloudns.org Git - xonotic/gmqcc.git/commitdiff
Initial preprocessor procedure option for testsuite implemented.
authorDale Weiler <killfieldengine@gmail.com>
Sun, 21 Apr 2013 06:20:17 +0000 (06:20 +0000)
committerDale Weiler <killfieldengine@gmail.com>
Sun, 21 Apr 2013 06:20:17 +0000 (06:20 +0000)
test.c

diff --git a/test.c b/test.c
index 7202efb4667d40c768fb31757f0dac0719e63c09..d4af984ab37d0da3d6bdc622663e944f4fdc9120 100644 (file)
--- a/test.c
+++ b/test.c
@@ -894,32 +894,41 @@ bool task_execute(task_template_t *tmpl, char ***line) {
     char     buffer[4096];
     memset  (buffer,0,sizeof(buffer));
 
-    /*
-     * Drop the execution flags for the QCVM if none where
-     * actually specified.
-     */
-    if (!strcmp(tmpl->executeflags, "$null")) {
-        snprintf(buffer,  sizeof(buffer), "%s %s",
-            task_bins[TASK_EXECUTE],
-            tmpl->tempfilename
+    if (strcmp(tmpl->proceduretype, "-pp")) {
+        /*
+         * Drop the execution flags for the QCVM if none where
+         * actually specified.
+         */
+        if (!strcmp(tmpl->executeflags, "$null")) {
+            snprintf(buffer,  sizeof(buffer), "%s %s",
+                task_bins[TASK_EXECUTE],
+                tmpl->tempfilename
+            );
+        } else {
+            snprintf(buffer,  sizeof(buffer), "%s %s %s",
+                task_bins[TASK_EXECUTE],
+                tmpl->executeflags,
+                tmpl->tempfilename
+            );
+        }
+
+        util_debug("TEST", "executing qcvm: `%s` [%s]\n",
+            tmpl->description,
+            buffer
         );
+
+        execute = popen(buffer, "r");
+        if (!execute)
+            return false;
     } else {
-        snprintf(buffer,  sizeof(buffer), "%s %s %s",
-            task_bins[TASK_EXECUTE],
-            tmpl->executeflags,
-            tmpl->tempfilename
-        );
+        /*
+         * we're preprocessing, which means we need to read int
+         * the produced file and do some really weird shit.
+         */
+        if (!(execute = fs_file_open(tmpl->tempfilename, "r")))
+            return false;
     }
 
-    util_debug("TEST", "executing qcvm: `%s` [%s]\n",
-        tmpl->description,
-        buffer
-    );
-
-    execute = popen(buffer, "r");
-    if (!execute)
-        return false;
-
     /*
      * Now lets read the lines and compare them to the matches we expect
      * and handle accordingly.
@@ -965,7 +974,12 @@ bool task_execute(task_template_t *tmpl, char ***line) {
         mem_d(data);
         data = NULL;
     }
-    pclose(execute);
+
+    if (strcmp(tmpl->proceduretype, "-pp"))
+        pclose(execute);
+    else
+        fs_file_close(execute);
+
     return success;
 }
 
@@ -1055,6 +1069,10 @@ void task_schedualize(size_t *pad) {
             continue;
         }
 
+        if (!strcmp(task_tasks[i].tmpl->proceduretype, "-pp")) {
+            /* this is a pain */
+        }
+
         if (!execute) {
             con_out("succeeded: `%s` %*s %*s\n",
                 task_tasks[i].tmpl->description,