summaryrefslogtreecommitdiffstats
path: root/src/testlib
diff options
context:
space:
mode:
authorFrederik Gladhorn <frederik.gladhorn@digia.com>2014-01-10 18:27:48 +0100
committerFrederik Gladhorn <frederik.gladhorn@digia.com>2014-01-10 18:27:49 +0100
commit7917dfbf1c54150d0ca3a79285767c22e6f9d770 (patch)
treea05973334097df480afe32d07db42f381b460e74 /src/testlib
parentb9362903b339e57362a7a3296904504521d0e26f (diff)
parentb088e4827f427189334e8a1c5b4f2b8b0b713fc2 (diff)
Merge remote-tracking branch 'origin/stable' into dev
Diffstat (limited to 'src/testlib')
-rw-r--r--src/testlib/qbenchmarkperfevents.cpp20
-rw-r--r--src/testlib/qtestlog.cpp7
2 files changed, 17 insertions, 10 deletions
diff --git a/src/testlib/qbenchmarkperfevents.cpp b/src/testlib/qbenchmarkperfevents.cpp
index acc11b09ac..30a0d3ea9c 100644
--- a/src/testlib/qbenchmarkperfevents.cpp
+++ b/src/testlib/qbenchmarkperfevents.cpp
@@ -515,16 +515,18 @@ void QBenchmarkPerfEventsMeasurer::start()
{
initPerf();
- // pid == 0 -> attach to the current process
- // cpu == -1 -> monitor on all CPUs
- // group_fd == -1 -> this is the group leader
- // flags == 0 -> reserved, must be zero
- fd = perf_event_open(&attr, 0, -1, -1, 0);
if (fd == -1) {
- perror("QBenchmarkPerfEventsMeasurer::start: perf_event_open");
- exit(1);
- } else {
- ::fcntl(fd, F_SETFD, FD_CLOEXEC);
+ // pid == 0 -> attach to the current process
+ // cpu == -1 -> monitor on all CPUs
+ // group_fd == -1 -> this is the group leader
+ // flags == 0 -> reserved, must be zero
+ fd = perf_event_open(&attr, 0, -1, -1, 0);
+ if (fd == -1) {
+ perror("QBenchmarkPerfEventsMeasurer::start: perf_event_open");
+ exit(1);
+ } else {
+ ::fcntl(fd, F_SETFD, FD_CLOEXEC);
+ }
}
// enable the counter
diff --git a/src/testlib/qtestlog.cpp b/src/testlib/qtestlog.cpp
index b2efa1ac9c..037bed643d 100644
--- a/src/testlib/qtestlog.cpp
+++ b/src/testlib/qtestlog.cpp
@@ -58,6 +58,8 @@
QT_BEGIN_NAMESPACE
+Q_CORE_EXPORT QString qMessageFormatString(QtMsgType type, const QMessageLogContext &context, const QString& msg);
+
static void saveCoverageTool(const char * appname, bool testfailed, bool installedTestCoverage)
{
#ifdef __COVERAGESCANNER__
@@ -267,7 +269,7 @@ namespace QTest {
return false;
}
- static void messageHandler(QtMsgType type, const QMessageLogContext & /*context*/, const QString &message)
+ static void messageHandler(QtMsgType type, const QMessageLogContext & context, const QString &message)
{
static QBasicAtomicInt counter = Q_BASIC_ATOMIC_INITIALIZER(QTest::maxWarnings);
@@ -282,6 +284,9 @@ namespace QTest {
// the message is expected, so just swallow it.
return;
+ msg = qMessageFormatString(type, context, message).toLocal8Bit();
+ msg.chop(1); // remove trailing newline
+
if (type != QtFatalMsg) {
if (counter.load() <= 0)
return;