From: Rusty Russell Date: Fri, 16 May 2008 04:35:04 +0000 (+1000) Subject: Fix test to flush stdout: sometimes goes into pipe, causing failure. X-Git-Url: http://git.ozlabs.org/?p=ccan;a=commitdiff_plain;h=38f39568eee13223d4e132354e6da90152f9326b Fix test to flush stdout: sometimes goes into pipe, causing failure. --- diff --git a/tap/test/run.c b/tap/test/run.c index 91f22e91..97af45c8 100644 --- a/tap/test/run.c +++ b/tap/test/run.c @@ -52,6 +52,7 @@ int main(int argc, char *argv[]) int stdoutfd; printf("1..1\n"); + fflush(stdout); stderrfd = dup(STDERR_FILENO); if (stderrfd < 0) err(1, "dup of stderr failed"); @@ -74,21 +75,21 @@ int main(int argc, char *argv[]) ok(0, "msg2"); expect(p[0], "not ok 2 - msg2\n" - "# Failed test (tap/test/run.c:main() at line 75)\n"); + "# Failed test (tap/test/run.c:main() at line 76)\n"); ok1(true); expect(p[0], "ok 3 - true\n"); ok1(false); expect(p[0], "not ok 4 - false\n" - "# Failed test (tap/test/run.c:main() at line 82)\n"); + "# Failed test (tap/test/run.c:main() at line 83)\n"); pass("passed"); expect(p[0], "ok 5 - passed\n"); fail("failed"); expect(p[0], "not ok 6 - failed\n" - "# Failed test (tap/test/run.c:main() at line 89)\n"); + "# Failed test (tap/test/run.c:main() at line 90)\n"); skip(2, "skipping %s", "test"); expect(p[0], "ok 7 # skip skipping test\n" @@ -97,7 +98,7 @@ int main(int argc, char *argv[]) todo_start("todo"); ok1(false); expect(p[0], "not ok 9 - false # TODO todo\n" - "# Failed (TODO) test (tap/test/run.c:main() at line 98)\n"); + "# Failed (TODO) test (tap/test/run.c:main() at line 99)\n"); ok1(true); expect(p[0], "ok 10 - true # TODO todo\n"); todo_end();