Allow tests to log to multiple destinations
authorJason McDonald <jason.mcdonald@nokia.com>
Fri, 2 Sep 2011 09:08:21 +0000 (19:08 +1000)
committerQt by Nokia <qt-info@nokia.com>
Thu, 22 Sep 2011 22:34:23 +0000 (00:34 +0200)
commit51589e834e086de93a121a1c628c3492d88a15a7
tree6d1506f12c3dc9eb37d8471e8e0b1d1a821c2cac
parent157fc88f90c42c6ff1b47b1bad018565fe63f626
Allow tests to log to multiple destinations

Each destination and the format of output to write there is specified by
adding "-o filename,format" to the command-line.  The special filename
"-" indicates that the log output is written to the standard output
stream, though standard output can be used as a destination at most
once.

The old-style testlib output options are still supported, but can only
be used to specify one logging destination, as before.

If no logging options are given on the command-line, a plain text log
will go to the console, as before.

To log to the console in plain text and to the file "test_output" in
xunit format, one would invoke a test in the following way:

    tst_foo -o test_output,xunitxml -o -,txt

This commit also enhances the selftests to test with multiple loggers,
but negative tests (e.g. bad combinations of command-line options) are
left for future task QTBUG-21567.

Task-number: QTBUG-20615
Change-Id: If91e752bc7001657e15e427aba9d25ab0a29a0b0
Reviewed-on: http://codereview.qt-project.org/4125
Reviewed-by: Qt Sanity Bot <qt_sanity_bot@ovi.com>
Reviewed-by: Rohan McGovern <rohan.mcgovern@nokia.com>
src/testlib/qtestcase.cpp
src/testlib/qtestlog.cpp
src/testlib/qtestlog_p.h
tests/auto/testlib/selftests/tst_selftests.cpp