[Libreoffice-commits] online.git: Branch 'distro/collabora/collabora-online-4-0' - test/countloolkits.hpp test/helpers.hpp

Ashod Nakashian (via logerrit) logerrit at kemper.freedesktop.org
Sat Oct 19 18:57:45 UTC 2019


 test/countloolkits.hpp |    9 ++++++++-
 test/helpers.hpp       |    5 ++++-
 2 files changed, 12 insertions(+), 2 deletions(-)

New commits:
commit b06ea528fe9dac854a18d4a9255ac598830dbb2c
Author:     Ashod Nakashian <ashod.nakashian at collabora.co.uk>
AuthorDate: Sat Oct 12 13:51:56 2019 -0400
Commit:     Andras Timar <andras.timar at collabora.com>
CommitDate: Sat Oct 19 20:57:26 2019 +0200

    test: log the time in tests
    
    Useful to match with the timestamps in WSD
    and align events when investigating.
    
    Change-Id: I73a0eb8e55ee7ca1b8935bd42468f53d7a82f80b
    Reviewed-on: https://gerrit.libreoffice.org/80893
    Reviewed-by: Andras Timar <andras.timar at collabora.com>
    Tested-by: Andras Timar <andras.timar at collabora.com>

diff --git a/test/countloolkits.hpp b/test/countloolkits.hpp
index 0f7010ff0..5822f8c50 100644
--- a/test/countloolkits.hpp
+++ b/test/countloolkits.hpp
@@ -59,7 +59,14 @@ static int countLoolKitProcesses(const int expected)
     TST_LOG_END;
     if (expected != count)
     {
-        TST_LOG("Found " << count << " LoKit processes but was expecting " << expected << ".");
+        TST_LOG_BEGIN("Found " << count << " LoKit processes but was expecting " << expected << ": [");
+        for (int i : getKitPids())
+        {
+            TST_LOG_APPEND(i << ' ');
+        }
+        TST_LOG_APPEND(']');
+        TST_LOG_END;
+
     }
 
     return count;
diff --git a/test/helpers.hpp b/test/helpers.hpp
index 5b526b01b..06dff21f8 100644
--- a/test/helpers.hpp
+++ b/test/helpers.hpp
@@ -42,7 +42,10 @@
 // Logging in unit-tests go to cerr, for now at least.
 static std::mutex MutexLog;
 #define TST_LOG_MUTEX std::unique_lock<std::mutex> lock(MutexLog)
-#define TST_LOG_NAME_BEGIN(NAME, X) do { TST_LOG_MUTEX; std::cerr << NAME << "(@" << helpers::timeSinceTestStartMs() << "ms) " << X; } while (false)
+#define TST_LOG_NAME_BEGIN(NAME, X) do { TST_LOG_MUTEX; \
+                        char t[64]; Poco::DateTime time; snprintf(t, sizeof(t), "%.2u:%.2u:%.2u.%.6u (@%lums) ", \
+                        time.hour(), time.minute(), time.second(), time.millisecond() * 1000 + time.microsecond(), helpers::timeSinceTestStartMs()); \
+                        std::cerr << NAME << t << X; } while (false)
 #define TST_LOG_BEGIN(X) TST_LOG_NAME_BEGIN(testname, X)
 #define TST_LOG_APPEND(X) do { TST_LOG_MUTEX; std::cerr << X; } while (false)
 #define TST_LOG_END do { TST_LOG_MUTEX; std::cerr << "| " << __FILE__ << ':' << __LINE__ << std::endl; } while (false)


More information about the Libreoffice-commits mailing list