From a2a89814bd9b71612778cbb1fed3ae0d8cadc6b5 Mon Sep 17 00:00:00 2001 From: Rusty Russell Date: Fri, 21 Jan 2011 14:11:35 +1030 Subject: [PATCH] lca2011: use failtest This gives us one more line of coverate for very little cost. --- ccan/oserver/_info | 1 + ccan/oserver/test/run.c | 17 +++++++++++++---- 2 files changed, 14 insertions(+), 4 deletions(-) diff --git a/ccan/oserver/_info b/ccan/oserver/_info index a9c74fc..85ed0bf 100644 --- a/ccan/oserver/_info +++ b/ccan/oserver/_info @@ -43,6 +43,7 @@ int main(int argc, char *argv[]) printf("ccan/str\n"); printf("ccan/foreach\n"); printf("ccan/noerr\n"); + printf("ccan/failtest\n"); return 0; } diff --git a/ccan/oserver/test/run.c b/ccan/oserver/test/run.c index ee3959e..b8e9dc3 100644 --- a/ccan/oserver/test/run.c +++ b/ccan/oserver/test/run.c @@ -1,15 +1,22 @@ -#include +#include #include +#include #include #include #include #include #include +#include #include #include -#include +#include + +static void exit_test(void) +{ + failtest_exit(exit_status()); +} -int main(void) +int main(int argc, char *argv[]) { int fd; char buf[200]; @@ -17,6 +24,8 @@ int main(void) /* This is how many tests you plan to run */ plan_tests(3 * 6); + failtest_init(argc, argv); + tap_fail_callback = exit_test; foreach_ptr(input, "This is a test\n", @@ -41,5 +50,5 @@ int main(void) } /* This exits depending on whether all tests passed */ - return exit_status(); + failtest_exit(exit_status()); } -- 2.39.2