forked from qt-creator/qt-creator
Test: Make valgrind modeldemo test compile with cmake
As on it, correct the handling of the launcher interface. This still does not work due to wrong call of valgrind-fake. Change-Id: Id835e84eee29720579ac2947906bb95f84377185 Reviewed-by: hjk <hjk@qt.io> Reviewed-by: Christian Stenger <christian.stenger@qt.io>
This commit is contained in:
@@ -1,3 +1,5 @@
|
||||
include(../valgrind.cmake)
|
||||
|
||||
add_qtc_test(tst_callgrindparsertests
|
||||
DEPENDS Utils Core ProjectExplorer Debugger Qt5::Core Qt5::Network
|
||||
DEFINES
|
||||
@@ -7,31 +9,6 @@ add_qtc_test(tst_callgrindparsertests
|
||||
SOURCES callgrindparsertests.cpp callgrindparsertests.h
|
||||
)
|
||||
|
||||
extend_qtc_test(tst_callgrindparsertests
|
||||
SOURCES_PREFIX "${PROJECT_SOURCE_DIR}/src/plugins/valgrind/"
|
||||
SOURCES
|
||||
callgrind/callgrindcallmodel.h callgrind/callgrindcallmodel.cpp
|
||||
callgrind/callgrindcostitem.h callgrind/callgrindcostitem.cpp
|
||||
callgrind/callgrindcycledetection.h callgrind/callgrindcycledetection.cpp
|
||||
callgrind/callgrinddatamodel.h callgrind/callgrinddatamodel.cpp
|
||||
callgrind/callgrindfunction.h callgrind/callgrindfunction_p.h callgrind/callgrindfunction.cpp
|
||||
callgrind/callgrindfunctioncall.h callgrind/callgrindfunctioncall.cpp
|
||||
callgrind/callgrindfunctioncycle.h callgrind/callgrindfunctioncycle.cpp
|
||||
callgrind/callgrindparsedata.h callgrind/callgrindparsedata.cpp
|
||||
callgrind/callgrindparser.h callgrind/callgrindparser.cpp
|
||||
callgrind/callgrindproxymodel.h callgrind/callgrindproxymodel.cpp
|
||||
callgrind/callgrindstackbrowser.h callgrind/callgrindstackbrowser.cpp
|
||||
valgrindrunner.h valgrindrunner.cpp
|
||||
xmlprotocol/announcethread.h xmlprotocol/announcethread.cpp
|
||||
xmlprotocol/error.h xmlprotocol/error.cpp
|
||||
xmlprotocol/errorlistmodel.h xmlprotocol/errorlistmodel.cpp
|
||||
xmlprotocol/frame.h xmlprotocol/frame.cpp
|
||||
xmlprotocol/modelhelpers.h xmlprotocol/modelhelpers.cpp
|
||||
xmlprotocol/parser.h xmlprotocol/parser.cpp
|
||||
xmlprotocol/stack.h xmlprotocol/stack.cpp
|
||||
xmlprotocol/stackmodel.h xmlprotocol/stackmodel.cpp
|
||||
xmlprotocol/status.h xmlprotocol/status.cpp
|
||||
xmlprotocol/suppression.h xmlprotocol/suppression.cpp
|
||||
xmlprotocol/threadedparser.h xmlprotocol/threadedparser.cpp
|
||||
)
|
||||
extend_valgrind_test(tst_callgrindparsertests)
|
||||
|
||||
# skipping modeltest (does not compile due to missing widget handler)
|
||||
|
@@ -1 +1,27 @@
|
||||
add_subdirectory(testapps)
|
||||
|
||||
include(../valgrind.cmake)
|
||||
|
||||
file(RELATIVE_PATH RELATIVE_TEST_PATH "${PROJECT_BINARY_DIR}" "${CMAKE_CURRENT_BINARY_DIR}")
|
||||
file(RELATIVE_PATH TEST_RELATIVE_LIBEXEC_PATH "/${RELATIVE_TEST_PATH}" "/${IDE_LIBEXEC_PATH}")
|
||||
|
||||
add_qtc_test(modeldemo
|
||||
MANUALTEST
|
||||
DEPENDS
|
||||
Utils
|
||||
Core
|
||||
Debugger
|
||||
ProjectExplorer
|
||||
TextEditor
|
||||
|
||||
SOURCES
|
||||
modeldemo.cpp
|
||||
modeldemo.h
|
||||
|
||||
DEFINES
|
||||
PARSERTESTS_DATA_DIR="${CMAKE_CURRENT_SOURCE_DIR}/data"
|
||||
VALGRIND_FAKE_PATH="${PROJECT_BINARY_DIR}/src/tools/valgrindfake/valgrind-fake"
|
||||
TEST_RELATIVE_LIBEXEC_PATH="${TEST_RELATIVE_LIBEXEC_PATH}"
|
||||
)
|
||||
|
||||
extend_valgrind_test(modeldemo)
|
||||
|
@@ -24,6 +24,9 @@
|
||||
**
|
||||
****************************************************************************/
|
||||
|
||||
#include <utils/launcherinterface.h>
|
||||
#include <utils/temporarydirectory.h>
|
||||
|
||||
#include <valgrind/xmlprotocol/frame.h>
|
||||
#include <valgrind/xmlprotocol/parser.h>
|
||||
#include <valgrind/xmlprotocol/stack.h>
|
||||
@@ -41,12 +44,17 @@ using namespace Valgrind::XmlProtocol;
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
QApplication app(argc, argv);
|
||||
|
||||
Utils::TemporaryDirectory::setMasterTemporaryDirectory(QDir::tempPath() + "/QtCreator-XXXXXX");
|
||||
const QString libExecPath(qApp->applicationDirPath() + '/'
|
||||
+ QLatin1String(TEST_RELATIVE_LIBEXEC_PATH));
|
||||
Utils::LauncherInterface::setPathToLauncher(libExecPath);
|
||||
|
||||
qRegisterMetaType<Error>();
|
||||
|
||||
ValgrindRunner runner;
|
||||
runner.setValgrindCommand({VALGRIND_FAKE_PATH,
|
||||
{"-i", PARSERTESTS_DATA_DIR "/memcheck-output-sample1.xml"}});
|
||||
|
||||
ModelDemo demo(&runner);
|
||||
QObject::connect(&runner, &ValgrindRunner::finished,
|
||||
&demo, &ModelDemo::finished);
|
||||
|
@@ -1,4 +1,5 @@
|
||||
import qbs
|
||||
import qbs.FileInfo
|
||||
import "../valgrindautotest.qbs" as ValgrindAutotest
|
||||
|
||||
ValgrindAutotest {
|
||||
@@ -6,8 +7,14 @@ ValgrindAutotest {
|
||||
Depends { name: "valgrind-fake" }
|
||||
Depends { name: "Qt.network" }
|
||||
files: ["modeldemo.h", "modeldemo.cpp"]
|
||||
cpp.defines: base.concat([
|
||||
'PARSERTESTS_DATA_DIR="' + path + '/data"',
|
||||
'VALGRIND_FAKE_PATH="' + project.buildDirectory + '/' + qtc.ide_bin_path + '/valgrind-fake"'
|
||||
])
|
||||
cpp.defines: {
|
||||
var defines = base;
|
||||
var absLibExecPath = FileInfo.joinPaths(qbs.installRoot, qbs.installPrefix,
|
||||
qtc.ide_libexec_path);
|
||||
var relLibExecPath = FileInfo.relativePath(destinationDirectory, absLibExecPath);
|
||||
defines.push('TEST_RELATIVE_LIBEXEC_PATH="' + relLibExecPath + '"');
|
||||
defines.push('PARSERTESTS_DATA_DIR="' + path + '/data"');
|
||||
defines.push('VALGRIND_FAKE_PATH="' + project.buildDirectory + '/' + qtc.ide_bin_path + '/valgrind-fake"');
|
||||
return defines;
|
||||
}
|
||||
}
|
||||
|
30
tests/auto/valgrind/valgrind.cmake
Normal file
30
tests/auto/valgrind/valgrind.cmake
Normal file
@@ -0,0 +1,30 @@
|
||||
|
||||
function(extend_valgrind_test targetName)
|
||||
extend_qtc_test(${targetName}
|
||||
SOURCES_PREFIX "${PROJECT_SOURCE_DIR}/src/plugins/valgrind/"
|
||||
SOURCES
|
||||
callgrind/callgrindcallmodel.h callgrind/callgrindcallmodel.cpp
|
||||
callgrind/callgrindcostitem.h callgrind/callgrindcostitem.cpp
|
||||
callgrind/callgrindcycledetection.h callgrind/callgrindcycledetection.cpp
|
||||
callgrind/callgrinddatamodel.h callgrind/callgrinddatamodel.cpp
|
||||
callgrind/callgrindfunction.h callgrind/callgrindfunction_p.h callgrind/callgrindfunction.cpp
|
||||
callgrind/callgrindfunctioncall.h callgrind/callgrindfunctioncall.cpp
|
||||
callgrind/callgrindfunctioncycle.h callgrind/callgrindfunctioncycle.cpp
|
||||
callgrind/callgrindparsedata.h callgrind/callgrindparsedata.cpp
|
||||
callgrind/callgrindparser.h callgrind/callgrindparser.cpp
|
||||
callgrind/callgrindproxymodel.h callgrind/callgrindproxymodel.cpp
|
||||
callgrind/callgrindstackbrowser.h callgrind/callgrindstackbrowser.cpp
|
||||
valgrindrunner.h valgrindrunner.cpp
|
||||
xmlprotocol/announcethread.h xmlprotocol/announcethread.cpp
|
||||
xmlprotocol/error.h xmlprotocol/error.cpp
|
||||
xmlprotocol/errorlistmodel.h xmlprotocol/errorlistmodel.cpp
|
||||
xmlprotocol/frame.h xmlprotocol/frame.cpp
|
||||
xmlprotocol/modelhelpers.h xmlprotocol/modelhelpers.cpp
|
||||
xmlprotocol/parser.h xmlprotocol/parser.cpp
|
||||
xmlprotocol/stack.h xmlprotocol/stack.cpp
|
||||
xmlprotocol/stackmodel.h xmlprotocol/stackmodel.cpp
|
||||
xmlprotocol/status.h xmlprotocol/status.cpp
|
||||
xmlprotocol/suppression.h xmlprotocol/suppression.cpp
|
||||
xmlprotocol/threadedparser.h xmlprotocol/threadedparser.cpp
|
||||
)
|
||||
endfunction()
|
Reference in New Issue
Block a user