[Libreoffice-commits] online.git: Branch 'distro/collabora/collabora-online-4' - test/test.cpp

Libreoffice Gerrit user logerrit at kemper.freedesktop.org
Mon May 6 18:08:23 UTC 2019


 test/test.cpp |   14 ++++++++++----
 1 file changed, 10 insertions(+), 4 deletions(-)

New commits:
commit f39cebd66013850b824aa641bfcb1b20a7110733
Author:     Michael Meeks <michael.meeks at collabora.com>
AuthorDate: Sat May 4 20:16:36 2019 +0100
Commit:     Jan Holesovsky <kendy at collabora.com>
CommitDate: Mon May 6 20:08:06 2019 +0200

    test: recommend --verbose mode, and interleave output chronologically.
    
    Avoids a number of unpleasant attempts to interleave output.
    
    Change-Id: I84b25e338b576d88f7f5fc47fbfcae34c3d377fd
    Reviewed-on: https://gerrit.libreoffice.org/71801
    Reviewed-by: Ashod Nakashian <ashnakash at gmail.com>
    Tested-by: Jan Holesovsky <kendy at collabora.com>

diff --git a/test/test.cpp b/test/test.cpp
index 1dde93600..5ee19cf12 100644
--- a/test/test.cpp
+++ b/test/test.cpp
@@ -82,17 +82,24 @@ bool isStandalone()
 }
 
 static std::mutex errorMutex;
+static bool IsVerbose = false;
 static std::stringstream errors;
 
 void tstLog(const std::ostringstream &stream)
 {
-    std::lock_guard<std::mutex> lock(errorMutex);
-    errors << stream.str();
+    if (IsVerbose)
+        std::cerr << stream.str() << std::endl;
+    else
+    {
+        std::lock_guard<std::mutex> lock(errorMutex);
+        errors << stream.str();
+    }
 }
 
 // returns true on success
 bool runClientTests(bool standalone, bool verbose)
 {
+    IsVerbose = verbose;
     IsStandalone = standalone;
 
     CPPUNIT_NS::TestResult controller;
@@ -129,7 +136,6 @@ bool runClientTests(bool standalone, bool verbose)
 
     if (!verbose)
     {
-        // redirect std::cerr temporarily
         runner.run(controller);
 
         // output the errors we got during the testing
@@ -149,7 +155,7 @@ bool runClientTests(bool standalone, bool verbose)
     if (!envar && failures.size() > 0)
     {
         std::cerr << "\nTo reproduce the first test failure use:\n\n";
-        std::cerr << "(cd test; CPPUNIT_TEST_NAME=\"" << (*failures.begin())->failedTestName() << "\" ./run_unit.sh)\n\n";
+        std::cerr << "(cd test; CPPUNIT_TEST_NAME=\"" << (*failures.begin())->failedTestName() << "\" ./run_unit.sh --verbose)\n\n";
     }
 
     return result.wasSuccessful();


More information about the Libreoffice-commits mailing list