summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorhjk <hjk@qt.io>2022-06-20 12:26:37 +0200
committerChristian Stenger <christian.stenger@qt.io>2022-06-21 08:16:28 +0000
commit8e22e08d21224205dbe4f34971d4a7364f69453a (patch)
tree8512405d24fc145617d47b54724cf05f00025554 /tests
parentbe5a77a76797c1dd3ae72317d795fee170c77504 (diff)
downloadqt-creator-8e22e08d21224205dbe4f34971d4a7364f69453a.tar.gz
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>
Diffstat (limited to 'tests')
-rw-r--r--tests/auto/valgrind/callgrind/CMakeLists.txt31
-rw-r--r--tests/auto/valgrind/memcheck/CMakeLists.txt26
-rw-r--r--tests/auto/valgrind/memcheck/modeldemo.cpp10
-rw-r--r--tests/auto/valgrind/memcheck/modeldemo.qbs15
-rw-r--r--tests/auto/valgrind/valgrind.cmake30
5 files changed, 80 insertions, 32 deletions
diff --git a/tests/auto/valgrind/callgrind/CMakeLists.txt b/tests/auto/valgrind/callgrind/CMakeLists.txt
index 76859938ae..74ed6ef157 100644
--- a/tests/auto/valgrind/callgrind/CMakeLists.txt
+++ b/tests/auto/valgrind/callgrind/CMakeLists.txt
@@ -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)
diff --git a/tests/auto/valgrind/memcheck/CMakeLists.txt b/tests/auto/valgrind/memcheck/CMakeLists.txt
index 8ea0f41a15..653611c4d1 100644
--- a/tests/auto/valgrind/memcheck/CMakeLists.txt
+++ b/tests/auto/valgrind/memcheck/CMakeLists.txt
@@ -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)
diff --git a/tests/auto/valgrind/memcheck/modeldemo.cpp b/tests/auto/valgrind/memcheck/modeldemo.cpp
index 9f809161da..996ddf1af0 100644
--- a/tests/auto/valgrind/memcheck/modeldemo.cpp
+++ b/tests/auto/valgrind/memcheck/modeldemo.cpp
@@ -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);
diff --git a/tests/auto/valgrind/memcheck/modeldemo.qbs b/tests/auto/valgrind/memcheck/modeldemo.qbs
index 8da8fd139e..7da91345ee 100644
--- a/tests/auto/valgrind/memcheck/modeldemo.qbs
+++ b/tests/auto/valgrind/memcheck/modeldemo.qbs
@@ -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;
+ }
}
diff --git a/tests/auto/valgrind/valgrind.cmake b/tests/auto/valgrind/valgrind.cmake
new file mode 100644
index 0000000000..fa7d8b4b60
--- /dev/null
+++ b/tests/auto/valgrind/valgrind.cmake
@@ -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()