Replace QTESTLIB_USE_VALGRIND with a new feature 'valgrind'
Change-Id: I851788cb1872eef86c75c7bdb2de361a0ff2af6c Reviewed-by: Jörg Bornemann <joerg.bornemann@qt.io>
This commit is contained in:
parent
1798d3ddc8
commit
a8162e1f59
@ -16,6 +16,12 @@
|
||||
"purpose": "Provides a utility to test item models.",
|
||||
"condition": "features.itemmodel",
|
||||
"output": [ "publicFeature" ]
|
||||
},
|
||||
"valgrind": {
|
||||
"label": "Valgrind",
|
||||
"purpose": "Profiling support with callgrind.",
|
||||
"condition": "(config.linux || config.darwin) && features.process && features.regularexpression",
|
||||
"output": [ "publicFeature" ]
|
||||
}
|
||||
},
|
||||
|
||||
|
@ -82,7 +82,7 @@ QBenchmarkMeasurerBase * QBenchmarkGlobalData::createMeasurer()
|
||||
{
|
||||
QBenchmarkMeasurerBase *measurer = 0;
|
||||
if (0) {
|
||||
#ifdef QTESTLIB_USE_VALGRIND
|
||||
#if QT_CONFIG(valgrind)
|
||||
} else if (mode_ == CallgrindChildProcess || mode_ == CallgrindParentProcess) {
|
||||
measurer = new QBenchmarkCallgrindMeasurer;
|
||||
#endif
|
||||
|
@ -55,12 +55,6 @@
|
||||
|
||||
#include <QtCore/qglobal.h>
|
||||
|
||||
#if (defined(Q_OS_LINUX) || defined Q_OS_MACOS) && QT_CONFIG(process)
|
||||
#define QTESTLIB_USE_VALGRIND
|
||||
#else
|
||||
#undef QTESTLIB_USE_VALGRIND
|
||||
#endif
|
||||
|
||||
#if defined(Q_OS_LINUX) && !defined(QT_LINUXBASE) && !defined(Q_OS_ANDROID)
|
||||
#define QTESTLIB_USE_PERF_EVENTS
|
||||
#else
|
||||
@ -70,7 +64,7 @@
|
||||
#include <QtTest/private/qbenchmarkmeasurement_p.h>
|
||||
#include <QtCore/QMap>
|
||||
#include <QtTest/qttestglobal.h>
|
||||
#ifdef QTESTLIB_USE_VALGRIND
|
||||
#if QT_CONFIG(valgrind)
|
||||
#include <QtTest/private/qbenchmarkvalgrind_p.h>
|
||||
#endif
|
||||
#ifdef QTESTLIB_USE_PERF_EVENTS
|
||||
|
@ -39,8 +39,6 @@
|
||||
|
||||
#include <QtTest/private/qbenchmark_p.h>
|
||||
|
||||
#ifdef QTESTLIB_USE_VALGRIND
|
||||
|
||||
#include <QtTest/private/qbenchmarkvalgrind_p.h>
|
||||
#include <QtCore/qstringlist.h>
|
||||
#include <QtCore/qcoreapplication.h>
|
||||
@ -243,5 +241,3 @@ QTest::QBenchmarkMetric QBenchmarkCallgrindMeasurer::metricType()
|
||||
}
|
||||
|
||||
QT_END_NAMESPACE
|
||||
|
||||
#endif // QTESTLIB_USE_VALGRIND
|
||||
|
@ -58,6 +58,8 @@
|
||||
|
||||
class QStringList;
|
||||
|
||||
QT_REQUIRE_CONFIG(valgrind);
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
class QBenchmarkValgrindUtils
|
||||
|
@ -574,7 +574,7 @@ Q_TESTLIB_EXPORT void qtest_qParseArgs(int argc, const char *const argv[], bool
|
||||
" -nocrashhandler : Disables the crash handler. Useful for debugging crashes.\n"
|
||||
"\n"
|
||||
" Benchmarking options:\n"
|
||||
#ifdef QTESTLIB_USE_VALGRIND
|
||||
#if QT_CONFIG(valgrind)
|
||||
" -callgrind : Use callgrind to time benchmarks\n"
|
||||
#endif
|
||||
#ifdef QTESTLIB_USE_PERF_EVENTS
|
||||
@ -717,7 +717,7 @@ Q_TESTLIB_EXPORT void qtest_qParseArgs(int argc, const char *const argv[], bool
|
||||
}
|
||||
} else if (strcmp(argv[i], "-nocrashhandler") == 0) {
|
||||
QTest::noCrashHandler = true;
|
||||
#ifdef QTESTLIB_USE_VALGRIND
|
||||
#if QT_CONFIG(valgrind)
|
||||
} else if (strcmp(argv[i], "-callgrind") == 0) {
|
||||
if (QBenchmarkValgrindUtils::haveValgrind())
|
||||
if (QFileInfo(QDir::currentPath()).isWritable()) {
|
||||
@ -1459,7 +1459,7 @@ void TestMethods::invokeTests(QObject *testObject) const
|
||||
|
||||
QScopedPointer<WatchDog> watchDog;
|
||||
if (!debuggerPresent()
|
||||
#ifdef QTESTLIB_USE_VALGRIND
|
||||
#if QT_CONFIG(valgrind)
|
||||
&& QBenchmarkGlobalData::current->mode() != QBenchmarkGlobalData::CallgrindChildProcess
|
||||
#endif
|
||||
) {
|
||||
@ -1866,7 +1866,7 @@ int QTest::qRun()
|
||||
{
|
||||
QTEST_ASSERT(currentTestObject);
|
||||
|
||||
#ifdef QTESTLIB_USE_VALGRIND
|
||||
#if QT_CONFIG(valgrind)
|
||||
int callgrindChildExitCode = 0;
|
||||
#endif
|
||||
|
||||
@ -1886,7 +1886,7 @@ int QTest::qRun()
|
||||
} // !noCrashHandler
|
||||
#endif // Q_OS_WIN
|
||||
|
||||
#ifdef QTESTLIB_USE_VALGRIND
|
||||
#if QT_CONFIG(valgrind)
|
||||
if (QBenchmarkGlobalData::current->mode() == QBenchmarkGlobalData::CallgrindParentProcess) {
|
||||
if (Q_UNLIKELY(!qApp))
|
||||
qFatal("QtTest: -callgrind option is not available with QTEST_APPLESS_MAIN");
|
||||
@ -1944,7 +1944,7 @@ int QTest::qRun()
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef QTESTLIB_USE_VALGRIND
|
||||
#if QT_CONFIG(valgrind)
|
||||
if (QBenchmarkGlobalData::current->mode() == QBenchmarkGlobalData::CallgrindParentProcess)
|
||||
return callgrindChildExitCode;
|
||||
#endif
|
||||
|
@ -17,7 +17,6 @@ HEADERS = \
|
||||
qbenchmark_p.h \
|
||||
qbenchmarkmeasurement_p.h \
|
||||
qbenchmarktimemeasurers_p.h \
|
||||
qbenchmarkvalgrind_p.h \
|
||||
qbenchmarkevent_p.h \
|
||||
qbenchmarkperfevents_p.h \
|
||||
qbenchmarkmetric.h \
|
||||
@ -70,7 +69,6 @@ SOURCES = \
|
||||
qabstracttestlogger.cpp \
|
||||
qbenchmark.cpp \
|
||||
qbenchmarkmeasurement.cpp \
|
||||
qbenchmarkvalgrind.cpp \
|
||||
qbenchmarkevent.cpp \
|
||||
qbenchmarkperfevents.cpp \
|
||||
qbenchmarkmetric.cpp \
|
||||
@ -92,6 +90,13 @@ qtConfig(itemmodeltester) {
|
||||
qabstractitemmodeltester.cpp
|
||||
}
|
||||
|
||||
qtConfig(valgrind) {
|
||||
HEADERS += \
|
||||
qbenchmarkvalgrind_p.h
|
||||
SOURCES += \
|
||||
qbenchmarkvalgrind.cpp
|
||||
}
|
||||
|
||||
DEFINES *= QT_NO_CAST_TO_ASCII \
|
||||
QT_NO_CAST_FROM_ASCII \
|
||||
QT_NO_FOREACH \
|
||||
|
Loading…
x
Reference in New Issue
Block a user