about summary refs log tree commit diff
diff options
context:
space:
mode:
authorMike Crowe <mac@mcrowe.com>2019-06-19 18:06:14 -0300
committerAdhemerval Zanella <adhemerval.zanella@linaro.org>2019-06-21 09:59:50 -0300
commit8bf225d5832eda8fefce9361c53cb68a55150b96 (patch)
tree727955b9116eaec1b02334779a6c5f352094f098
parentdb13e32cb8d5f74fe61880459c7ddf8f47da436b (diff)
downloadglibc-8bf225d5832eda8fefce9361c53cb68a55150b96.tar.gz
glibc-8bf225d5832eda8fefce9361c53cb68a55150b96.tar.xz
glibc-8bf225d5832eda8fefce9361c53cb68a55150b96.zip
support: Invent verbose_printf macro
Make it easier for tests to emit progress messages only when --verbose is
specified.

* support/test-driver.h: Add verbose_printf macro.
-rw-r--r--ChangeLog2
-rw-r--r--support/test-driver.h8
2 files changed, 10 insertions, 0 deletions
diff --git a/ChangeLog b/ChangeLog
index de58169b61..a67ffe7c53 100644
--- 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>
diff --git a/support/test-driver.h b/support/test-driver.h
index a9710af0e1..55f355f50d 100644
--- a/support/test-driver.h
+++ b/support/test-driver.h
@@ -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