Make sure that tests run with just compiled versions of tools
authorSandro Knauß <bugs@sandroknauss.de>
Fri, 1 Jul 2022 20:08:41 +0000 (21:08 +0100)
committerDmitry Shachnev <mitya57@debian.org>
Fri, 1 Jul 2022 20:08:41 +0000 (21:08 +0100)
Origin: Debian
Last-Update: 2020-09-08

Last-Update: 2020-09-08
Gbp-Pq: Name fix_test_remove_qlibraryinfo.patch

19 files changed:
.qmake.conf
tests/auto/qml/debugger/qdebugmessageservice/tst_qdebugmessageservice.cpp
tests/auto/qml/debugger/qqmldebuggingenabler/qqmldebuggingenabler/tst_qqmldebuggingenabler.cpp
tests/auto/qml/debugger/qqmldebugjs/tst_qqmldebugjs.cpp
tests/auto/qml/debugger/qqmldebugservice/tst_qqmldebugservice.cpp
tests/auto/qml/debugger/qqmldebugtranslationservice/tst_qqmldebugtranslationservice.cpp
tests/auto/qml/debugger/qqmlenginecontrol/tst_qqmlenginecontrol.cpp
tests/auto/qml/debugger/qqmlenginedebuginspectorintegrationtest/tst_qqmlenginedebuginspectorintegration.cpp
tests/auto/qml/debugger/qqmlinspector/tst_qqmlinspector.cpp
tests/auto/qml/debugger/qqmlpreview/tst_qqmlpreview.cpp
tests/auto/qml/debugger/qqmlprofilerservice/tst_qqmlprofilerservice.cpp
tests/auto/qml/qmlcachegen/tst_qmlcachegen.cpp
tests/auto/qml/qmlformat/tst_qmlformat.cpp
tests/auto/qml/qmllint/tst_qmllint.cpp
tests/auto/qml/qmlmin/tst_qmlmin.cpp
tests/auto/qml/qmlplugindump/tst_qmlplugindump.cpp
tests/auto/qml/qqmlecmascript/tst_qqmlecmascript.cpp
tests/auto/qml/qv4assembler/tst_qv4assembler.cpp
tests/auto/quick/examples/tst_examples.cpp

index b09daef9c6ec7794a499d68822ef41207b53c64d..c308e2911f98b28890d2471ef4587821b54e831e 100644 (file)
@@ -1,6 +1,9 @@
 load(qt_build_config)
 CONFIG += warning_clean
 
+QMAKE_CXXFLAGS += -DTESTBINDIR=\\\"$$PWD/bin\\\"
+QMAKE_CXXFLAGS += -DTESTEXAMPLEDIR=\\\"$$PWD/examples\\\"
+
 DEFINES += QT_NO_LINKED_LIST
 DEFINES += QT_NO_JAVA_STYLE_ITERATORS
 
index ec7ee15d3499372f8c84d6b49488ea0e148f432a..73fec02b92cb0dead292ed590db444a20b4ab7cd 100644 (file)
@@ -135,7 +135,7 @@ QList<QQmlDebugClient *> tst_QDebugMessageService::createClients()
 
 void tst_QDebugMessageService::retrieveDebugOutput()
 {
-    QCOMPARE(QQmlDebugTest::connectTo(QLibraryInfo::location(QLibraryInfo::BinariesPath) + "/qml",
+    QCOMPARE(QQmlDebugTest::connectTo(TESTBINDIR "/qml",
                                     QString(), testFile(QMLFILE), true), ConnectSuccess);
 
     QTRY_VERIFY(m_client->logBuffer.size() >= 2);
index 37118f4bd094d267e9d662b1511b3f29d96e9450..866cb9a3f9fcb91bd2ff29cf286489ea45b30365 100644 (file)
@@ -102,8 +102,7 @@ void tst_QQmlDebuggingEnabler::qmlscene()
     QFETCH(bool, blockMode);
     QFETCH(QStringList, services);
 
-    m_process = new QQmlDebugProcess(
-                QLibraryInfo::location(QLibraryInfo::BinariesPath) + "/qmlscene", this);
+    m_process = new QQmlDebugProcess(TESTBINDIR "/qmlscene", this);
     m_process->setMaximumBindErrors(1);
     m_process->start(QStringList()
                      << QString::fromLatin1("-qmljsdebugger=connector:%1%2%3%4")
index 91470e06510797133c3d40c7779915a46017f926..a6070acf5be7fdd5a06fa02dccb1f45190b24df6 100644 (file)
@@ -178,7 +178,7 @@ QQmlDebugTest::ConnectResult tst_QQmlDebugJS::init(bool qmlscene, const QString
                                                    bool blockMode, bool restrictServices)
 {
     const QString executable = qmlscene
-            ? QLibraryInfo::location(QLibraryInfo::BinariesPath) + "/qmlscene"
+            ? TESTBINDIR "/qmlscene"
             : debugJsServerPath("qqmldebugjs");
     return QQmlDebugTest::connectTo(
                 executable, restrictServices ? QStringLiteral("V8Debugger") : QString(),
@@ -471,7 +471,7 @@ void tst_QQmlDebugJS::setBreakpointInJavaScript()
 
     if (seedCache) { // Make sure there is a qmlc file that the engine should _not_ laod.
         QProcess process;
-        process.start(QLibraryInfo::location(QLibraryInfo::BinariesPath) + "/qmlscene",
+        process.start(QStringLiteral(TESTBINDIR "/qmlscene"),
                       { testFile(QUITINJS_QMLFILE) });
         QTRY_COMPARE(process.state(), QProcess::NotRunning);
     }
@@ -853,8 +853,7 @@ void tst_QQmlDebugJS::evaluateInLocalScope()
 void tst_QQmlDebugJS::evaluateInContext()
 {
     m_connection = new QQmlDebugConnection();
-    m_process = new QQmlDebugProcess(
-                QLibraryInfo::location(QLibraryInfo::BinariesPath) + "/qmlscene", this);
+    m_process = new QQmlDebugProcess(TESTBINDIR "/qmlscene", this);
     m_client = new QV4DebugClient(m_connection);
     QScopedPointer<QQmlEngineDebugClient> engineClient(new QQmlEngineDebugClient(m_connection));
     m_process->start(QStringList() << QLatin1String(BLOCKMODE) << testFile(ONCOMPLETED_QMLFILE));
index 35579403865b60305291179ca3ae434e69e37b63..66e70275acc9a3383622f23e9b223508d12d3f82 100644 (file)
@@ -106,8 +106,7 @@ void tst_QQmlDebugService::checkPortRange()
 {
     QScopedPointer<QQmlDebugConnection> connection1(new QQmlDebugConnection());
     QScopedPointer<QQmlDebugProcess> process1(
-                new QQmlDebugProcess(QLibraryInfo::location(QLibraryInfo::BinariesPath)
-                                     + "/qmlscene", this));
+                new QQmlDebugProcess(TESTBINDIR "/qmlscene", this));
 
     process1->start(QStringList() << QLatin1String("-qmljsdebugger=port:3782,3792")
                                   << testFile("test.qml"));
@@ -123,8 +122,7 @@ void tst_QQmlDebugService::checkPortRange()
     // Second instance
     QScopedPointer<QQmlDebugConnection> connection2(new QQmlDebugConnection());
     QScopedPointer<QQmlDebugProcess> process2(
-                new QQmlDebugProcess(QLibraryInfo::location(QLibraryInfo::BinariesPath)
-                                     + "/qmlscene", this));
+                new QQmlDebugProcess(TESTBINDIR "/qmlscene", this));
 
     process2->start(QStringList() << QLatin1String("-qmljsdebugger=port:3782,3792")
                                   << testFile("test.qml"));
index 01ee805deea4d068ee9532b6de79f50138452a04..7bb422ce362077f7fb532d2bc7ef5c5db408487d 100644 (file)
@@ -66,7 +66,7 @@ QList<QQmlDebugClient *> tst_QQmlDebugTranslationService::createClients()
 
 void tst_QQmlDebugTranslationService::pluginConnection()
 {
-    auto executable = QLibraryInfo::location(QLibraryInfo::BinariesPath) + "/qml";
+    auto executable = QStringLiteral(TESTBINDIR "/qml");
     auto services = "DebugTranslation";
     auto extraArgs = testFile(QMLFILE);
     auto block = true;
index c8915fb84096e10c652f6cfb325274a335dcc59a..9b574bcf40d9953ff4f3aaa8af546af92ff0ff6f 100644 (file)
@@ -82,7 +82,7 @@ private slots:
 QQmlDebugTest::ConnectResult tst_QQmlEngineControl::connectTo(const QString &file,
                                                             bool restrictServices)
 {
-    return QQmlDebugTest::connectTo(QLibraryInfo::location(QLibraryInfo::BinariesPath) + "/qmlscene",
+    return QQmlDebugTest::connectTo(TESTBINDIR "/qmlscene",
                                   restrictServices ? QStringLiteral("EngineControl") : QString(),
                                   testFile(file), true);
 }
index 9830f1a9bdafee8293f24a655d70bd344975343e..eedf90472606d315f4263d4514515df6ad61e7a3 100644 (file)
@@ -88,7 +88,7 @@ QQmlEngineDebugObjectReference tst_QQmlEngineDebugInspectorIntegration::findRoot
 QQmlDebugTest::ConnectResult tst_QQmlEngineDebugInspectorIntegration::init(bool restrictServices)
 {
     return QQmlDebugTest::connectTo(
-                QLibraryInfo::location(QLibraryInfo::BinariesPath) + "/qml",
+                TESTBINDIR "/qml",
                 restrictServices ? QStringLiteral("QmlDebugger,QmlInspector") : QString(),
                 testFile("qtquick2.qml"), true);
 }
index b5f45f1eebf6f1cdce63492917aef7b29be3428b..f03fd82f681f39068130f9b96031dc88e1a30a26 100644 (file)
@@ -64,7 +64,7 @@ private slots:
 QQmlDebugTest::ConnectResult tst_QQmlInspector::startQmlProcess(const QString &qmlFile,
                                                                 bool restrictServices)
 {
-    return QQmlDebugTest::connectTo(QLibraryInfo::location(QLibraryInfo::BinariesPath) + "/qml",
+    return QQmlDebugTest::connectTo(TESTBINDIR "/qml",
                                   restrictServices ? QStringLiteral("QmlInspector") : QString(),
                                   testFile(qmlFile), true);
 }
index 2de525db542469f0b78d013f44eee7a841c63fe8..dd7bb51df8bc1782abfbd33a47383aecf780a49b 100644 (file)
@@ -74,7 +74,7 @@ private slots:
 
 QQmlDebugTest::ConnectResult tst_QQmlPreview::startQmlProcess(const QString &qmlFile)
 {
-    return QQmlDebugTest::connectTo(QLibraryInfo::location(QLibraryInfo::BinariesPath) + "/qml",
+    return QQmlDebugTest::connectTo(QStringLiteral(TESTBINDIR "/qml"),
                                   QStringLiteral("QmlPreview"), testFile(qmlFile), true);
 }
 
index c2a774b42db0528d7593f969728af29650b4d2fd..c8a7d77b85e66172d7a08eaa620fb58231f34a74 100644 (file)
@@ -203,8 +203,7 @@ private:
 
     ConnectResult connectTo(bool block, const QString &file, bool recordFromStart = true,
                           uint flushInterval = 0, bool restrictServices = true,
-                          const QString &executable
-            = QLibraryInfo::location(QLibraryInfo::BinariesPath) + "/qmlscene");
+                          const QString &executable = QStringLiteral(TESTBINDIR "/qmlscene"));
     void checkProcessTerminated();
     void checkTraceReceived();
     void checkJsHeap();
index 3810f505b3025b2a8f137c7fdfbea74242501096..3b686df7007025462a5faefe0d04a2d94c37b53f 100644 (file)
@@ -107,7 +107,7 @@ static bool generateCache(const QString &qmlFileName, QByteArray *capturedStderr
     QProcess proc;
     if (capturedStderr == nullptr)
         proc.setProcessChannelMode(QProcess::ForwardedChannels);
-    proc.setProgram(QLibraryInfo::location(QLibraryInfo::BinariesPath) + QDir::separator() + QLatin1String("qmlcachegen"));
+    proc.setProgram(TESTBINDIR "/qmlcachegen");
     proc.setArguments(QStringList() << qmlFileName);
     proc.start();
     if (!proc.waitForFinished())
index 413dc5f8a511e7e7b6c1d39c57dbad203133f3b6..6f4ac1ff47d1f3d4c296db8b13da1e5f1aee0197 100644 (file)
@@ -84,7 +84,7 @@ private:
 void TestQmlformat::initTestCase()
 {
     QQmlDataTest::initTestCase();
-    m_qmlformatPath = QLibraryInfo::location(QLibraryInfo::BinariesPath) + QLatin1String("/qmlformat");
+    m_qmlformatPath = QStringLiteral(TESTBINDIR "/qmlformat");
 #ifdef Q_OS_WIN
     m_qmlformatPath += QLatin1String(".exe");
 #endif
index 8697495a6f0ce9fd637fd4293d66e2e2e89465cf..a538d79dc9a1394770e58cb345038cce6a354a5f 100644 (file)
@@ -59,7 +59,7 @@ private:
 void TestQmllint::initTestCase()
 {
     QQmlDataTest::initTestCase();
-    m_qmllintPath = QLibraryInfo::location(QLibraryInfo::BinariesPath) + QLatin1String("/qmllint");
+    m_qmllintPath = QLatin1String(TESTBINDIR "/qmllint");
 #ifdef Q_OS_WIN
     m_qmllintPath += QLatin1String(".exe");
 #endif
@@ -214,7 +214,7 @@ void TestQmllint::cleanQmlCode()
 
 QString TestQmllint::runQmllint(const QString &fileToLint, bool shouldSucceed)
 {
-    auto qmlImportDir = QLibraryInfo::location(QLibraryInfo::Qml2ImportsPath);
+    auto qmlImportDir = QString::fromUtf8(qgetenv("QML2_IMPORT_PATH"));
     QStringList args;
     args << QStringLiteral("-U") << testFile(fileToLint)
          << QStringLiteral("-I") << qmlImportDir
index cc028d979f5888b4ce7b6bd345a0798f7ac7e6ba..7c7fd95262b97732112e81d3b60b9084648e2355 100644 (file)
@@ -68,7 +68,7 @@ tst_qmlmin::tst_qmlmin()
 void tst_qmlmin::initTestCase()
 {
 #if QT_CONFIG(process) && !defined(QTEST_CROSS_COMPILED) // sources not available when cross compiled
-    qmlminPath = QLibraryInfo::location(QLibraryInfo::BinariesPath) + QLatin1String("/qmlmin");
+    qmlminPath = QStringLiteral(TESTBINDIR "/qmlmin");
 #ifdef Q_OS_WIN
     qmlminPath += QLatin1String(".exe");
 #endif
index 72356a4d84b2dc1b3fd7b0042e0920f6c369d06a..7e6f089597e28cbcde6585d71de9b1bad4aaade8 100644 (file)
@@ -62,7 +62,7 @@ tst_qmlplugindump::tst_qmlplugindump()
 void tst_qmlplugindump::initTestCase()
 {
     QQmlDataTest::initTestCase();
-    qmlplugindumpPath = QLibraryInfo::location(QLibraryInfo::BinariesPath);
+    qmlplugindumpPath = QLatin1String(TESTBINDIR);
 
 #if defined(Q_OS_WIN)
     qmlplugindumpPath += QLatin1String("/qmlplugindump.exe");
index 3c3a2a7a99067e33dbb6b46742f93902e87a4c17..859349ffa8f67ef9361c40388eda5c563525bd4e 100644 (file)
@@ -9265,7 +9265,7 @@ void tst_qqmlecmascript::hugeStack()
 
 void tst_qqmlecmascript::gcCrashRegressionTest()
 {
-    const QString qmljs = QLibraryInfo::location(QLibraryInfo::BinariesPath) + "/qmljs";
+    const QString qmljs = QStringLiteral(TESTBINDIR "/qmljs");
     if (!QFile::exists(qmljs)) {
         QSKIP("Tets requires qmljs");
     }
index 5dd8e9dcc0a861fa347257594e9ae7c4ecdf4f6b..c84ace29445d94375def0c6095077265b117f2f0 100644 (file)
@@ -62,7 +62,7 @@ void tst_QV4Assembler::perfMapFile()
 #if !defined(Q_OS_LINUX) || defined(Q_OS_ANDROID)
     QSKIP("perf map files are only generated on linux");
 #else
-    const QString qmljs = QLibraryInfo::location(QLibraryInfo::BinariesPath) + "/qmljs";
+    const QString qmljs = QStringLiteral(TESTBINDIR "/qmljs");
     QProcess process;
 
     QTemporaryFile infile;
index fdefa855e4011ee40b9dba140bab482ccbeffd26..cd77427be76a415b28d56013ae3429db6070b210 100644 (file)
@@ -167,8 +167,8 @@ void tst_examples::namingConvention(const QDir &d)
 void tst_examples::namingConvention()
 {
     QStringList examplesLocations;
-    examplesLocations << QLibraryInfo::location(QLibraryInfo::ExamplesPath) + QLatin1String("/qml");
-    examplesLocations << QLibraryInfo::location(QLibraryInfo::ExamplesPath) + QLatin1String("/quick");
+    examplesLocations << QLatin1String(TESTEXAMPLEDIR "/qml");
+    examplesLocations << QLatin1String(TESTEXAMPLEDIR "/quick");
 
     foreach(const QString &examples, examplesLocations) {
         QDir d(examples);