[Libreoffice-commits] online.git: test/test.cpp
Ashod Nakashian
ashod.nakashian at collabora.co.uk
Thu Apr 20 04:26:59 UTC 2017
test/test.cpp | 28 +++++++++++++++++-----------
1 file changed, 17 insertions(+), 11 deletions(-)
New commits:
commit bc0323731674d84aeea7b8487b4333e43a7a21e6
Author: Ashod Nakashian <ashod.nakashian at collabora.co.uk>
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 <ashnakash at gmail.com>
Tested-by: Ashod Nakashian <ashnakash at gmail.com>
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(&result, std::cerr);
outputter.setNoWrap();
More information about the Libreoffice-commits
mailing list