about summary refs log tree commit diff stats
path: root/tests
diff options
context:
space:
mode:
authorJames Booth <boothj5@gmail.com>2014-01-29 00:30:12 +0000
committerJames Booth <boothj5@gmail.com>2014-01-29 00:30:12 +0000
commitadb360072b99fddbec12e68ea38f1dc3a2e4ed7a (patch)
tree30397367ae60e7acc1b0236b696512b1d788aae4 /tests
parent571665eeac0c357fb1b9482531dc62c10ccdb595 (diff)
downloadprofani-tty-adb360072b99fddbec12e68ea38f1dc3a2e4ed7a.tar.gz
Move all test output to ./testsuite.out, show single line pass/fail
Diffstat (limited to 'tests')
-rw-r--r--tests/testsuite.c14
1 files changed, 12 insertions, 2 deletions
diff --git a/tests/testsuite.c b/tests/testsuite.c
index ea9a191e..f60e6d11 100644
--- a/tests/testsuite.c
+++ b/tests/testsuite.c
@@ -5,6 +5,7 @@
 #include <stddef.h>
 #include <setjmp.h>
 #include <cmocka.h>
+#include <sys/stat.h>
 
 #include "config/helpers.h"
 #include "test_autocomplete.h"
@@ -421,11 +422,16 @@ int main(int argc, char* argv[]) {
             close_preferences),
     };
 
-    int bak, new;
+    int bak, bak2, new;
     fflush(stdout);
+    fflush(stderr);
     bak = dup(1);
-    new = open("/dev/null", O_WRONLY);
+    bak2 = dup(2);
+    remove("./testsuite.out");
+    new = open("./testsuite.out", O_WRONLY | O_CREAT);
+    chmod("./testsuite.out", S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP | S_IROTH);
     dup2(new, 1);
+    dup2(new, 2);
     close(new);
 
     int result = 0;
@@ -448,11 +454,15 @@ int main(int argc, char* argv[]) {
 
     fflush(stdout);
     dup2(bak, 1);
+    dup2(bak2, 2);
     close(bak);
+    close(bak2);
 
     if (result > 0) {
+        printf("\n\nFAILED TESTS, see ./testsuite.out\n\n");
         return 1;
     } else {
+        printf("\n\nAll tests passed\n\n");
         return 0;
     }
 }