]> git.ipfire.org Git - thirdparty/glibc.git/commitdiff
support: Invent verbose_printf macro
authorMike Crowe <mac@mcrowe.com>
Wed, 19 Jun 2019 21:06:14 +0000 (18:06 -0300)
committerAdhemerval Zanella <adhemerval.zanella@linaro.org>
Fri, 21 Jun 2019 12:59:50 +0000 (09:59 -0300)
Make it easier for tests to emit progress messages only when --verbose is
specified.

* support/test-driver.h: Add verbose_printf macro.

ChangeLog
support/test-driver.h

index de58169b6129e79c2214a8aef10399aae72f5efd..a67ffe7c538337a9f76f9eddcf5545afd6afbe14 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,7 @@
 2019-06-20  Mike Crowe  <mac@mcrowe.com>
 
+       * support/test-driver.h: Add verbose_printf macro.
+
        * support/xtime.h: Add xclock_now() helper function.
 
 2019-06-20  Dmitry V. Levin  <ldv@altlinux.org>
index a9710af0e1cfdf110f8062538e9e0bbaab25a9ef..55f355f50ddedb0f7a729b962757e11742b1564a 100644 (file)
@@ -69,6 +69,14 @@ extern const char *test_dir;
    tests.  */
 extern unsigned int test_verbose;
 
+/* Output that is only emitted if at least one --verbose argument was
+   specified. */
+#define verbose_printf(...)                      \
+  do {                                           \
+    if (test_verbose > 0)                        \
+      printf (__VA_ARGS__);                      \
+  } while (0);
+
 int support_test_main (int argc, char **argv, const struct test_config *);
 
 __END_DECLS