tap: restore buffering to stdout
authorRusty Russell <rusty@rustcorp.com.au>
Wed, 27 Oct 2010 11:49:44 +0000 (22:19 +1030)
committerRusty Russell <rusty@rustcorp.com.au>
Wed, 27 Oct 2010 11:49:44 +0000 (22:19 +1030)
I noticed this when I straced something; we're doing 1-byte writes.
This reduced the time for "make check" from 12m37s to 11m48s.

ccan/tap/tap.c
ccan/tap/test/run.c

index a5156aa194a748ecdf8822d49fde91ce7a0a257f..857528a24429fa12e438e6844f356fa6fee40513 100644 (file)
@@ -260,7 +260,7 @@ _tap_init(void)
                /* stdout needs to be unbuffered so that the output appears
                   in the same place relative to stderr output as it does 
                   with Test::Harness */
-               setbuf(stdout, 0);
+//             setbuf(stdout, 0);
                run_once = 1;
        }
 }
index efc8134dcbd273edd34a8269220486ada6dbc278..37f26ae0277a418365cd46e6dc5c7d04759c59b6 100644 (file)
@@ -66,8 +66,8 @@ int main(int argc, char *argv[])
        int p[2];
        int stdoutfd;
 
+       setbuf(stdout, 0);
        printf("1..1\n");
-       fflush(stdout);
        stderrfd = dup(STDERR_FILENO);
        if (stderrfd < 0)
                err(1, "dup of stderr failed");