summaryrefslogtreecommitdiffstats
path: root/src/testlib
diff options
context:
space:
mode:
authorMorten Sørvig <msorvig@trolltech.com>2009-05-12 07:17:15 (GMT)
committerMorten Sørvig <msorvig@trolltech.com>2009-05-12 07:17:15 (GMT)
commit453abe70fec02456aba2219025f5202060eaece1 (patch)
tree1e14f1d76eafd07f6c7708ce1af0200e92cdab4a /src/testlib
parent4af513212d9ca9ed88e18bddaabd90006aca8541 (diff)
downloadQt-453abe70fec02456aba2219025f5202060eaece1.zip
Qt-453abe70fec02456aba2219025f5202060eaece1.tar.gz
Qt-453abe70fec02456aba2219025f5202060eaece1.tar.bz2
Add the chart utility from qtestlib-tools.
It is now possible run the benchmarks with "-chart" to generate charts for benchmarks that produce chartable data. See examples/qtestlib/tutorial5 for an example. This patch has minimal inpact on QTestLib itself. Most of the functionality is implemented in a separate tool which QTestLIb calls after detecting the chart command line option.
Diffstat (limited to 'src/testlib')
-rw-r--r--src/testlib/qtestcase.cpp29
1 files changed, 10 insertions, 19 deletions
diff --git a/src/testlib/qtestcase.cpp b/src/testlib/qtestcase.cpp
index 936b936..8c76c5d 100644
--- a/src/testlib/qtestcase.cpp
+++ b/src/testlib/qtestcase.cpp
@@ -54,6 +54,7 @@
#include <QtCore/qdir.h>
#include <QtCore/qprocess.h>
#include <QtCore/qdebug.h>
+#include <QtCore/qlibraryinfo.h>
#include "QtTest/private/qtestlog_p.h"
#include "QtTest/private/qtesttable_p.h"
@@ -846,9 +847,8 @@ static void qParseArgs(int argc, char *argv[])
" -iterations n : Sets the number of accumulation iterations.\n"
" -median n : Sets the number of median iterations.\n"
" -vb : Print out verbose benchmarking information.\n"
-#ifndef QT_NO_PROCESS
-// Will be enabled when tools are integrated.
-// " -chart : Runs the chart generator after the test. No output is printed to the console\n"
+#if !defined(QT_NO_PROCESS) || !defined(QT_NO_SETTINGS)
+ " -chart : Create chart based on the benchmark result.\n"
#endif
"\n"
" -help : This help\n";
@@ -963,7 +963,7 @@ static void qParseArgs(int argc, char *argv[])
} else if (strcmp(argv[i], "-vb") == 0) {
QBenchmarkGlobalData::current->verboseOutput = true;
-#ifndef QT_NO_PROCESS
+#if !defined(QT_NO_PROCESS) || !defined(QT_NO_SETTINGS)
} else if (strcmp(argv[i], "-chart") == 0) {
QBenchmarkGlobalData::current->createChart = true;
QTestLog::setLogMode(QTestLog::XML);
@@ -1463,26 +1463,17 @@ int QTest::qExec(QObject *testObject, int argc, char **argv)
#endif
-#ifndef QT_NO_PROCESS
+#if !defined(QT_NO_PROCESS) || !defined(QT_NO_SETTINGS)
if (QBenchmarkGlobalData::current->createChart) {
-
-#define XSTR(s) STR(s)
-#define STR(s) #s
-#ifdef Q_OS_WIN
- const char * path = XSTR(QBENCHLIB_BASE) "/tools/generatereport/generatereport.exe";
-#else
- const char * path = XSTR(QBENCHLIB_BASE) "/tools/generatereport/generatereport";
-#endif
-#undef XSTR
-#undef STR
-
- if (QFile::exists(QLatin1String(path))) {
+ QString chartLocation = QLibraryInfo::location(QLibraryInfo::BinariesPath)
+ + QLatin1String("/../tools/qtestlib/chart/chart");
+ if (QFile::exists(chartLocation)) {
QProcess p;
p.setProcessChannelMode(QProcess::ForwardedChannels);
- p.start(QLatin1String(path), QStringList() << QLatin1String("results.xml"));
+ p.start(chartLocation, QStringList() << QLatin1String("results.xml"));
p.waitForFinished(-1);
} else {
- qWarning("Could not find %s, please make sure it is compiled.", path);
+ qDebug() << QLatin1String("Could not find the chart tool in ") + chartLocation + QLatin1String(", please make sure it is compiled.");
}
}
#endif