tdb/test: always call fflush() after [f]printf() in tap-interface.h
authorStefan Metzmacher <metze@samba.org>
Thu, 30 Jan 2014 12:01:08 +0000 (13:01 +0100)
committerAndrew Bartlett <abartlet@samba.org>
Wed, 2 Apr 2014 07:03:42 +0000 (09:03 +0200)
Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
lib/tdb/test/tap-interface.h

index d9ed6e84ea5e88f58cf2aa67cbc8a8158d493820..b8ce7df609935766d3c17b4aa077ad02463ab352 100644 (file)
 #endif
 
 #define plan_tests(num)
-#define ok(e, ...) do { if (e) { (void)printf("."); } else { fprintf(stderr, __VA_ARGS__); exit(1); } } while(0)
+#define fail(...) do { \
+       fprintf(stderr, __VA_ARGS__); \
+       fprintf(stdout, "\n"); \
+       fflush(stderr); \
+       exit(1); \
+} while(0)
+#define diag(...) do { \
+       fprintf(stdout, __VA_ARGS__); \
+       fprintf(stdout, "\n"); \
+       fflush(stdout); \
+} while(0)
+#define pass(...) do { \
+       fprintf(stdout, "."); \
+       fflush(stdout); \
+} while(0)
+#define ok(e, ...) do { \
+       if (e) { \
+               pass(); \
+       } else { \
+               fail(__VA_ARGS__); \
+       } \
+} while(0)
 #define ok1(e) ok((e), "%s:%s", __location__, #e)
-#define pass(...) printf(".")
-#define fail(...) do { fprintf(stderr, __VA_ARGS__); exit(1); } while(0)
-#define diag printf
 #define exit_status() 0