Shitty testsuite support for windows the hacky way because there exists no sane simpl...
authorDale Weiler <killfieldengine@gmail.com>
Wed, 24 Apr 2013 14:04:00 +0000 (14:04 +0000)
committerDale Weiler <killfieldengine@gmail.com>
Wed, 24 Apr 2013 14:04:00 +0000 (14:04 +0000)
test.c
tests/vec_ops.tmpl

diff --git a/test.c b/test.c
index 6987bb3f6af9bd0b435d13c3bd60806fd65067b8..40bf79801c412b99167986da53935ed0a2e79107 100755 (executable)
--- a/test.c
+++ b/test.c
@@ -157,22 +157,39 @@ int task_pclose(FILE **handles) {
      * other hacks.
      */
     typedef struct {
-        int __dummy;
-        /* TODO: implement */
+        char name_err[L_tmpnam];
+        char name_out[L_tmpnam];
     } popen_t;
 
     FILE **task_popen(const char *command, const char *mode) {
-        (void)command;
-        (void)mode;
+        FILE   **handles = NULL;
+        char    *cmd     = NULL;
+        popen_t *open    = (popen_t*)mem_a(sizeof(popen_t) * 3);
 
-        /* TODO: implement */
-        return NULL;
+        tmpnam(open->name_err);
+        tmpnam(open->name_out);
+
+        (void)mode; /* excluded */
+
+        util_asprintf(&cmd, "%s -redirout=%s -redirerr=%s", command, open->name_out, open->name_err);
+
+        system(cmd); /* HACK */
+        handles    = (FILE**)(open + 1);
+        handles[0] = NULL;
+        handles[1] = fs_file_open(open->name_out, "r");
+        handles[2] = fs_file_open(open->name_err, "r");
+
+        return handles;
     }
 
     void task_pclose(FILE **files) {
-        /* TODO: implement */
-        (void)files;
-        return;
+        popen_t *open = ((popen_t*)files) - 1;
+        fs_file_close(files[1]);
+        fs_file_close(files[2]);
+        remove(open->name_err);
+        remove(open->name_out);
+
+        mem_d(open);
     }
 #endif /*! _WIN32 */
 
index 39e2750313eb439f9119ab7c67e8c84f70566fbd..7d8a501a45c6dcd96f5ff8116f0731174b6fea5a 100644 (file)
@@ -2,7 +2,7 @@ I: vec_ops.qc
 D: some additional vector operations
 T: -execute
 C: -std=fteqcc
-E: -vector '8 16 32'
+E: -vector "8 16 32"
 M: '8 16 32'
 M: '4 8 16'
 M: '2 4 8'