[v4,02/12] support: Invent verbose_printf macro
Commit Message
Make it easier for tests to emit progress messages only when --verbose is
specified.
* support/test-driver.h: Add verbose_printf macro.
---
ChangeLog | 4 ++++
support/test-driver.h | 8 ++++++++
2 files changed, 12 insertions(+)
Comments
On 18/06/2019 13:33, Mike Crowe wrote:
> Make it easier for tests to emit progress messages only when --verbose is
> specified.
>
> * support/test-driver.h: Add verbose_printf macro.
LGTM, I will commit for you.
> ---
> ChangeLog | 4 ++++
> support/test-driver.h | 8 ++++++++
> 2 files changed, 12 insertions(+)
>
> diff --git a/ChangeLog b/ChangeLog
> index 17fd6ac..6943d5e 100644
> --- a/ChangeLog
> +++ b/ChangeLog
> @@ -1,3 +1,7 @@
> +2019-06-18 Mike Crowe <mac@mcrowe.com>
> +
> + * support/test-driver.h: Add verbose_printf macro.
> +
> 2019-05-30 Mike Crowe <mac@mcrowe.com>
>
> * support/xtime.h: Add xclock_now() helper function.
> diff --git a/support/test-driver.h b/support/test-driver.h
> index a9710af..55f355f 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
>
@@ -1,3 +1,7 @@
+2019-06-18 Mike Crowe <mac@mcrowe.com>
+
+ * support/test-driver.h: Add verbose_printf macro.
+
2019-05-30 Mike Crowe <mac@mcrowe.com>
* support/xtime.h: Add xclock_now() helper function.
@@ -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