]> git.xonotic.org Git - xonotic/gmqcc.git/blobdiff - test.c
And there she goes, them space swallowing whores.
[xonotic/gmqcc.git] / test.c
diff --git a/test.c b/test.c
index f3aa6bb43e3cc9b0b217b3071a18a1367ab41a12..6fdee5134de3d07d85738035f881d62b2234a1a8 100644 (file)
--- a/test.c
+++ b/test.c
@@ -166,8 +166,8 @@ static int task_pclose(FILE **handles) {
         tmpnam(open->name_err);
         tmpnam(open->name_out);
 #else
-               tmpnam_s(open->name_err, L_tmpnam);
-               tmpnam_s(open->name_out, L_tmpnam);
+        tmpnam_s(open->name_err, L_tmpnam);
+        tmpnam_s(open->name_out, L_tmpnam);
 #endif
 
         (void)mode; /* excluded */
@@ -184,7 +184,7 @@ static int task_pclose(FILE **handles) {
         return open->handles;
     }
 
-    static void task_pclose(FILE **files) {
+    static int task_pclose(FILE **files) {
         popen_t *open = ((popen_t*)files);
         fs_file_close(files[1]);
         fs_file_close(files[2]);
@@ -192,9 +192,11 @@ static int task_pclose(FILE **handles) {
         remove(open->name_out);
 
         mem_d(open);
+
+        return EXIT_SUCCESS;
     }
-#      define popen _popen
-#      define pclose _pclose
+#   define popen _popen
+#   define pclose _pclose
 #endif /*! _WIN32 */
 
 #define TASK_COMPILE    0
@@ -443,9 +445,6 @@ static bool task_template_parse(const char *file, task_template_t *tmpl, FILE *f
                     goto failure;
                 }
 
-                if (value && (*value == ' ' || *value == '\t'))
-                    value++;
-
                 /*
                  * Value will contain a newline character at the end, we need to strip
                  * this otherwise kaboom, seriously, kaboom :P
@@ -964,6 +963,7 @@ static void task_destroy(void) {
 static bool task_trymatch(size_t i, char ***line) {
     bool             success = true;
     bool             process = true;
+    int              retval  = EXIT_SUCCESS;
     FILE            *execute;
     char             buffer[4096];
     task_template_t *tmpl = task_tasks[i].tmpl;
@@ -1085,16 +1085,20 @@ static bool task_trymatch(size_t i, char ***line) {
             data = NULL;
             size = 0;
         }
+
+        if (compare != vec_size(tmpl->comparematch))
+            success = false;
+
         mem_d(data);
         data = NULL;
     }
 
     if (process)
-        pclose(execute);
+        retval = pclose(execute);
     else
         fs_file_close(execute);
 
-    return success;
+    return success && retval == EXIT_SUCCESS;
 }
 
 static const char *task_type(task_template_t *tmpl) {
@@ -1419,6 +1423,5 @@ int main(int argc, char **argv) {
     succeed = test_perform("tests", defs);
     stat_info();
 
-
     return (succeed) ? EXIT_SUCCESS : EXIT_FAILURE;
 }