[Libreoffice-commits] online.git: test/test.cpp

2019-11-14 Thread Jan Holesovsky (via logerrit)
 test/test.cpp |7 ++-
 1 file changed, 6 insertions(+), 1 deletion(-)

New commits:
commit cd81d78ccc1a44b512c5be3a85c895cda0457e53
Author: Jan Holesovsky 
AuthorDate: Thu Nov 14 08:46:48 2019 +0100
Commit: Jan Holesovsky 
CommitDate: Thu Nov 14 10:07:17 2019 +0100

Add a 'how to debug' to the whitebox unit tests.

Change-Id: I373ae9e7268b108eedcae2805b0c1681845542cb
Reviewed-on: https://gerrit.libreoffice.org/82651
Reviewed-by: Jan Holesovsky 
Tested-by: Jan Holesovsky 

diff --git a/test/test.cpp b/test/test.cpp
index 71d058e4e..cc00b2fde 100644
--- a/test/test.cpp
+++ b/test/test.cpp
@@ -176,7 +176,12 @@ bool runClientTests(bool standalone, bool verbose)
 const char *cmd = "./run_unit.sh --verbose";
 if (getenv("UNITTEST"))
 cmd = "./unittest";
-std::cerr << "(cd test; CPPUNIT_TEST_NAME=\"" << 
(*failures.begin())->failedTestName() << "\" " << cmd << ")\n\n";
+std::cerr << "  (cd test; CPPUNIT_TEST_NAME=\"" << 
(*failures.begin())->failedTestName() << "\" " << cmd << ")\n\n";
+if (getenv("UNITTEST"))
+{
+std::cerr << "To debug:\n\n";
+std::cerr << "  (cd test; CPPUNIT_TEST_NAME=\"" << 
(*failures.begin())->failedTestName() << "\" gdb --args " << cmd << ")\n\n";
+}
 #else
 std::cerr << "(cd test; CPPUNIT_TEST_NAME=\"" << 
(*failures.begin())->failedTestName() << "\" make check)\n\n";
 #endif
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

[Libreoffice-commits] online.git: test/test.cpp

2019-09-22 Thread Ashod Nakashian (via logerrit)
 test/test.cpp |   17 ++---
 1 file changed, 14 insertions(+), 3 deletions(-)

New commits:
commit 3c52aff8cfc4c9b9a965dc1723c14de6c6f9fe58
Author: Ashod Nakashian 
AuthorDate: Sun Sep 22 12:37:32 2019 -0400
Commit: Ashod Nakashian 
CommitDate: Sun Sep 22 20:23:49 2019 +0200

wsd: test: support test command-line args in any order

No longer is it necessary to run with --verbose
in case we need --debugrun.

Also, by default the log level is now warning instead
of error, which should hopefully be more useful in
troubleshooting issues (or at least to force us
better categorize log messages).

Change-Id: Iad4279ecf3bf77780adcd786d4f46d9c964f302d
Reviewed-on: https://gerrit.libreoffice.org/79351
Reviewed-by: Ashod Nakashian 
Tested-by: Ashod Nakashian 

diff --git a/test/test.cpp b/test/test.cpp
index 8df5d1e79..d5c85710c 100644
--- a/test/test.cpp
+++ b/test/test.cpp
@@ -69,10 +69,21 @@ static bool IsDebugrun = false;
 
 int main(int argc, char** argv)
 {
-const bool verbose = (argc > 1 && std::string("--verbose") == argv[1]);
-IsDebugrun = (argc > 2 && std::string("--debugrun") == argv[2]);
-const char* loglevel = verbose ? "trace" : "error";
+bool verbose = false;
+for (int i = 1; i < argc; ++i)
+{
+const std::string arg(argv[i]);
+if (arg == "--verbose")
+{
+verbose = true;
+}
+else if (arg == "--debugrun")
+{
+IsDebugrun = true;
+}
+}
 
+const char* loglevel = verbose ? "trace" : "warning";
 Log::initialize("tst", loglevel, true, false, {});
 
 return runClientTests(true, verbose)? 0: 1;
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

[Libreoffice-commits] online.git: test/test.cpp

2019-09-12 Thread Miklos Vajna (via logerrit)
 test/test.cpp |4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

New commits:
commit e310e76cfc4e07aeb09d48808e7654bc2650c305
Author: Miklos Vajna 
AuthorDate: Thu Sep 12 11:43:49 2019 +0200
Commit: Miklos Vajna 
CommitDate: Thu Sep 12 11:43:49 2019 +0200

test: fix memory leak

==18134==ERROR: LeakSanitizer: detected memory leaks

Direct leak of 8 byte(s) in 1 object(s) allocated from:
#0 0x514db8 in operator new(unsigned long) 
/git/libreoffice/lode/packages/llvm-472c6ef8b0f53061b049039f9775ab127beafbe4.src/compiler-rt/lib/asan/asan_new_delete.cc:105
#1 0x9f836c in runClientTests(bool, bool) 
/git/libreoffice/online-san/test/test.cpp:113:28
#2 0x9f7975 in main /git/libreoffice/online-san/test/test.cpp:77:12

Change-Id: Ib93625e2a77e37733b9bb052dd73ecbc2a71

diff --git a/test/test.cpp b/test/test.cpp
index 621ff6351..f5824b1d1 100644
--- a/test/test.cpp
+++ b/test/test.cpp
@@ -14,6 +14,7 @@
 
 #include 
 #include 
+#include 
 
 #include 
 #include 
@@ -110,7 +111,8 @@ bool runClientTests(bool standalone, bool verbose)
 controller.addListener();
 CPPUNIT_NS::BriefTestProgressListener progress;
 controller.addListener();
-controller.addListener(new CPPUNIT_NS::TextTestProgressListener());
+CPPUNIT_NS::TextTestProgressListener listener;
+controller.addListener();
 
 CPPUNIT_NS::Test* testRegistry = 
CPPUNIT_NS::TestFactoryRegistry::getRegistry().makeTest();
 
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

[Libreoffice-commits] online.git: test/test.cpp

2019-08-29 Thread Miklos Vajna (via logerrit)
 test/test.cpp |6 +-
 1 file changed, 5 insertions(+), 1 deletion(-)

New commits:
commit 38e06bf94efe6a86a154faf47a5428289ee15161
Author: Miklos Vajna 
AuthorDate: Thu Aug 29 09:00:16 2019 +0200
Commit: Miklos Vajna 
CommitDate: Thu Aug 29 09:00:16 2019 +0200

test: add --debugrun switch

Normally we use getgrp() to find out which lool* processes are ours when
running 'make check', to support running multiple of these in parallel.

However, in case you try to debug a failure, it's handy to start loolwsd
manually and invoke ./test manually in two different shells.

So add a switch which allows this: the result is that the failing test
doesn't fail early in an uninteresting way (complaining that it can't
find any loolkit processes) but fails the same way as during 'make
check'.

Let's call this --debugrun, since core has similar
gb_UITest_DEBUGRUN/gb_JunitTest_DEBUGRUN switches, which also allow
connecting to an already running "main" process.

Change-Id: Ic7e29eb143ae70f199ef3a09ec9d6b6f8ee0650d

diff --git a/test/test.cpp b/test/test.cpp
index 6fb933dde..b04555ac7 100644
--- a/test/test.cpp
+++ b/test/test.cpp
@@ -64,9 +64,12 @@ bool filterTests(CPPUNIT_NS::TestRunner& runner, 
CPPUNIT_NS::Test* testRegistry,
 return haveTests;
 }
 
+static bool IsDebugrun = false;
+
 int main(int argc, char** argv)
 {
 const bool verbose = (argc > 1 && std::string("--verbose") == argv[1]);
+IsDebugrun = (argc > 2 && std::string("--debugrun") == argv[2]);
 const char* loglevel = verbose ? "trace" : "error";
 
 Log::initialize("tst", loglevel, true, false, {});
@@ -203,7 +206,8 @@ std::vector getProcPids(const char* exec_filename)
 {
 // We could have several make checks running at once.
 int kidGrp = std::atoi(tokens[4].c_str());
-if (kidGrp != grp)
+// Don't require matching grp for --debugrun invocations.
+if (kidGrp != grp && !IsDebugrun)
 continue;
 
 switch (tokens[2].c_str()[0])
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

[Libreoffice-commits] online.git: test/test.cpp

2019-05-14 Thread Libreoffice Gerrit user
 test/test.cpp |   39 +--
 1 file changed, 21 insertions(+), 18 deletions(-)

New commits:
commit 65540da9dc7fdd533ae0a374ebe6c0b67ce25871
Author: Michael Meeks 
AuthorDate: Mon May 13 15:39:14 2019 +0100
Commit: Michael Meeks 
CommitDate: Tue May 14 21:29:12 2019 +0100

test: use process groups as well to allow concurrent make checks.

Change-Id: Ib1a55f53c51835a8f9fb1c17146f30e887103906

diff --git a/test/test.cpp b/test/test.cpp
index b76bbb02d..6fb933dde 100644
--- a/test/test.cpp
+++ b/test/test.cpp
@@ -168,11 +168,14 @@ bool runClientTests(bool standalone, bool verbose)
 // Versions assuming a single user, on a single machine
 #ifndef UNIT_CLIENT_TESTS
 
-std::vector getProcPids(const char* exec_filename, bool ignoreZombies = 
true)
+std::vector getProcPids(const char* exec_filename)
 {
 std::vector pids;
 
-// Crash all lokit processes.
+// Ensure we're in the same group.
+int grp = getpgrp();
+
+// Get all lokit processes.
 for (auto it = Poco::DirectoryIterator(std::string("/proc")); it != 
Poco::DirectoryIterator(); ++it)
 {
 try
@@ -196,24 +199,24 @@ std::vector getProcPids(const char* exec_filename, 
bool ignoreZombies = tru
 std::string statString;
 Poco::StreamCopier::copyToString(stat, statString);
 Poco::StringTokenizer tokens(statString, " ");
-if (tokens.count() > 3 && tokens[1] == exec_filename)
+if (tokens.count() > 6 && tokens[1] == exec_filename)
 {
-if (ignoreZombies)
+// We could have several make checks running at once.
+int kidGrp = std::atoi(tokens[4].c_str());
+if (kidGrp != grp)
+continue;
+
+switch (tokens[2].c_str()[0])
 {
-switch (tokens[2].c_str()[0])
-{
-// Dead & zombie markers for old and new kernels.
-case 'x':
-case 'X':
-case 'Z':
-break;
-default:
-pids.push_back(pid);
-break;
-}
-}
-else
+// Dead & zombie markers for old and new kernels.
+case 'x':
+case 'X':
+case 'Z':
+break;
+default:
 pids.push_back(pid);
+break;
+}
 }
 }
 }
@@ -235,7 +238,7 @@ std::vector getKitPids()
 
 int getLoolKitProcessCount()
 {
-return getProcPids("(loolkit)", true).size();
+return getProcPids("(loolkit)").size();
 }
 
 std::vector getForKitPids()
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

[Libreoffice-commits] online.git: test/test.cpp

2019-05-04 Thread Libreoffice Gerrit user
 test/test.cpp |   14 ++
 1 file changed, 10 insertions(+), 4 deletions(-)

New commits:
commit 92603013de1a44153a9855bbfd9fc9ae9a92f834
Author: Michael Meeks 
AuthorDate: Sat May 4 20:16:36 2019 +0100
Commit: Michael Meeks 
CommitDate: Sat May 4 22:57:00 2019 +0100

test: recommend --verbose mode, and interleave output chronologically.

Avoids a number of unpleasant attempts to interleave output.

Change-Id: I84b25e338b576d88f7f5fc47fbfcae34c3d377fd

diff --git a/test/test.cpp b/test/test.cpp
index 39b726352..31a248d84 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 )
 {
-std::lock_guard lock(errorMutex);
-errors << stream.str();
+if (IsVerbose)
+std::cerr << stream.str() << std::endl;
+else
+{
+std::lock_guard 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
@@ -150,7 +156,7 @@ bool runClientTests(bool standalone, bool verbose)
 {
 std::cerr << "\nTo reproduce the first test failure use:\n\n";
 #ifndef UNIT_CLIENT_TESTS
-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";
 #else
 std::cerr << "(cd test; CPPUNIT_TEST_NAME=\"" << 
(*failures.begin())->failedTestName() << "\" make check)\n\n";
 #endif
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

[Libreoffice-commits] online.git: test/test.cpp

2019-05-01 Thread Libreoffice Gerrit user
 test/test.cpp |8 
 1 file changed, 8 insertions(+)

New commits:
commit 95e1034d27e39e080ac25ddd88099e12db89d3d3
Author: Michael Meeks 
AuthorDate: Wed May 1 22:12:56 2019 +0100
Commit: Michael Meeks 
CommitDate: Wed May 1 23:14:04 2019 +0200

test: help people run just the one that matters.

Change-Id: I1916e250613f8d50377180e38505045f71f51fd0
Reviewed-on: https://gerrit.libreoffice.org/71642
Reviewed-by: Michael Meeks 
Tested-by: Michael Meeks 

diff --git a/test/test.cpp b/test/test.cpp
index 0b905fb54..91e3251c7 100644
--- a/test/test.cpp
+++ b/test/test.cpp
@@ -18,6 +18,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -144,6 +145,13 @@ bool runClientTests(bool standalone, bool verbose)
 outputter.setNoWrap();
 outputter.write();
 
+const std::deque  = result.failures();
+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";
+}
+
 return result.wasSuccessful();
 }
 
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

[Libreoffice-commits] online.git: test/test.cpp

2018-11-29 Thread Libreoffice Gerrit user
 test/test.cpp |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit 84d224d995c8a08d6ae9d5f8a712e2f353a8b388
Author: Miklos Vajna 
AuthorDate: Fri Nov 30 08:37:50 2018 +0100
Commit: Miklos Vajna 
CommitDate: Fri Nov 30 08:38:00 2018 +0100

test: no need to copy procEntry

Change-Id: Iac7bca9ebcf104975d01bcd1cdfe8e0f4d2a742e

diff --git a/test/test.cpp b/test/test.cpp
index 4a4ba9421..f09e1f855 100644
--- a/test/test.cpp
+++ b/test/test.cpp
@@ -154,7 +154,7 @@ std::vector getProcPids(const char* exec_filename, 
bool ignoreZombies = fal
 {
 try
 {
-Poco::Path procEntry = it.path();
+const Poco::Path& procEntry = it.path();
 const std::string& fileName = procEntry.getFileName();
 int pid;
 std::size_t endPos = 0;
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] online.git: test/test.cpp

2017-06-19 Thread Miklos Vajna
 test/test.cpp |4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

New commits:
commit 902411e2ec8ca6cfbb11e5a4750f12ab93f03ab1
Author: Miklos Vajna 
Date:   Mon Jun 19 14:55:07 2017 +0200

test: make sure own header is self-contained

By including it before anything else.

Change-Id: I0fa37dcee7828a05e3ba7aac4eec3b63d1203468

diff --git a/test/test.cpp b/test/test.cpp
index b506b20c..ed2f15af 100644
--- a/test/test.cpp
+++ b/test/test.cpp
@@ -7,6 +7,8 @@
  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
  */
 
+#include "test.hpp"
+
 #include "config.h"
 
 #include 
@@ -24,8 +26,6 @@
 
 #include 
 
-#include "test.hpp"
-
 class HTTPGetTest;
 
 bool filterTests(CPPUNIT_NS::TestRunner& runner, CPPUNIT_NS::Test* 
testRegistry, const std::string testName)
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] online.git: test/test.cpp

2017-04-19 Thread Ashod Nakashian
 test/test.cpp |   28 +---
 1 file changed, 17 insertions(+), 11 deletions(-)

New commits:
commit bc0323731674d84aeea7b8487b4333e43a7a21e6
Author: Ashod Nakashian 
Date:   Thu Apr 20 00:06:28 2017 -0400

wsd: fix verbose test output

Change-Id: I089c31555a90c99c89745529c6df6552fd0bd7f9
Reviewed-on: https://gerrit.libreoffice.org/36709
Reviewed-by: Ashod Nakashian 
Tested-by: Ashod Nakashian 

diff --git a/test/test.cpp b/test/test.cpp
index fc0a6dfb..4d6fc505 100644
--- a/test/test.cpp
+++ b/test/test.cpp
@@ -58,9 +58,8 @@ bool filterTests(CPPUNIT_NS::TestRunner& runner, 
CPPUNIT_NS::Test* testRegistry,
 
 int main(int argc, char** argv)
 {
-const char* loglevel = "error";
-if (argc > 0 && std::string("--verbose") == argv[0])
-loglevel = "trace";
+const bool verbose = (argc > 1 && std::string("--verbose") == argv[1]);
+const char* loglevel = verbose ? "trace" : "error";
 
 Log::initialize("tst", loglevel, true, false, {});
 
@@ -96,17 +95,24 @@ int main(int argc, char** argv)
 }
 }
 
-// redirect std::cerr temporarily
-std::stringstream errorBuffer;
-std::streambuf* oldCerr = std::cerr.rdbuf(errorBuffer.rdbuf());
+if (!verbose)
+{
+// redirect std::cerr temporarily
+std::stringstream errorBuffer;
+std::streambuf* oldCerr = std::cerr.rdbuf(errorBuffer.rdbuf());
 
-runner.run(controller);
+runner.run(controller);
 
-std::cerr.rdbuf(oldCerr);
+std::cerr.rdbuf(oldCerr);
 
-// output the errors we got during the testing
-if (!result.wasSuccessful())
-std::cerr << errorBuffer.str() << std::endl;
+// output the errors we got during the testing
+if (!result.wasSuccessful())
+std::cerr << errorBuffer.str() << std::endl;
+}
+else
+{
+runner.run(controller);
+}
 
 CPPUNIT_NS::CompilerOutputter outputter(, std::cerr);
 outputter.setNoWrap();
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits