On Mon, Aug 12, 2019 at 01:54:17PM +0200, Michal Privoznik wrote:
There is an inconsistency with VIR_TEST_DEBUG() calls. One half
(roughly) of calls does have the newline character the other one
doesn't. Well, it doesn't have it because it assumed blindly that
new line will be printed, which is not the case.

Signed-off-by: Michal Privoznik <mpriv...@redhat.com>
---
tests/bhyveargv2xmltest.c       |  6 +++---
tests/bhyvexml2argvtest.c       |  4 ++--
tests/bhyvexml2xmltest.c        |  2 +-
tests/cputest.c                 |  2 +-
tests/qemuxml2argvtest.c        |  2 +-
tests/qemuxml2xmltest.c         |  4 ++--
tests/storagepoolxml2argvtest.c |  8 ++++----
tests/testutils.c               |  2 +-
tests/testutils.h               |  4 +++-
tests/testutilsqemu.c           |  2 +-
tests/testutilsqemuschema.c     |  2 +-
tests/utiltest.c                | 32 ++++++++++++++++----------------
tests/virbuftest.c              |  8 ++++----
tests/virhostcputest.c          |  2 +-
tests/virjsontest.c             |  6 +++---
tests/virlogtest.c              | 14 +++++++-------
tests/virnetdaemontest.c        |  4 ++--
tests/virpcitest.c              |  2 +-
tests/virresctrltest.c          |  2 +-
19 files changed, 55 insertions(+), 53 deletions(-)


This change breaks the build with my Clang:
cputest.c:981:1: error: stack frame size of 34216 bytes in function 'mymain'
     [-Werror,-Wframe-larger-than=]
mymain(void)
^
1 error generated.

diff --git a/tests/testutils.h b/tests/testutils.h
index 8c12fd7c12..cfc60084b2 100644
--- a/tests/testutils.h
+++ b/tests/testutils.h
@@ -89,8 +89,10 @@ unsigned int virTestGetRegenerate(void);

#define VIR_TEST_DEBUG(...) \
    do { \
-        if (virTestGetDebug()) \
+        if (virTestGetDebug()) { \
            fprintf(stderr, __VA_ARGS__); \
+            fprintf(stderr, "\n"); \
+        } \
    } while (0)

#define VIR_TEST_VERBOSE(...) \

This can be done with a single invocation of fprintf:
diff --git a/tests/testutils.h b/tests/testutils.h
index 7d8d7bbece..be20d3168d 100644
--- a/tests/testutils.h
+++ b/tests/testutils.h
@@ -87,11 +87,10 @@ unsigned int virTestGetVerbose(void);
unsigned int virTestGetExpensive(void);
unsigned int virTestGetRegenerate(void);

-#define VIR_TEST_DEBUG(...) \
+#define VIR_TEST_DEBUG(fmt, ...) \
    do { \
        if (virTestGetDebug()) { \
-            fprintf(stderr, __VA_ARGS__); \
-            fprintf(stderr, "\n"); \
+            fprintf(stderr, fmt "\n", ## __VA_ARGS__); \
        } \
    } while (0)

Alternatively, the limit might need tweaking.

Reviewed-by: Ján Tomko <jto...@redhat.com>

Jano

Attachment: signature.asc
Description: PGP signature

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list

Reply via email to