Changed qsharedpointer unittest to use build qmake over system one.
authorKurt Korbatits <kurt.korbatits@nokia.com>
Mon, 16 Jan 2012 00:52:49 +0000 (10:52 +1000)
committerQt by Nokia <qt-info@nokia.com>
Tue, 17 Jan 2012 03:53:35 +0000 (04:53 +0100)
- If we can find the qmake belonging to the build, use that instead
  of qmake from the PATH for compiling subtests.

Change-Id: I9445754bb02dab11c3e1bbe9dc459ecc682689a4
Reviewed-by: Rohan McGovern <rohan.mcgovern@nokia.com>
Reviewed-by: Kurt Korbatits <kurt.korbatits@nokia.com>
Reviewed-by: Jason McDonald <jason.mcdonald@nokia.com>
tests/auto/corelib/tools/qsharedpointer/externaltests.cpp

index c7ffe8c..2e3dd06 100644 (file)
@@ -52,6 +52,7 @@
 #include <QtCore/QDirIterator>
 #include <QtCore/QDateTime>
 #include <QtCore/QDebug>
+#include <QtCore/QLibraryInfo>
 
 #ifndef DEFAULT_MAKESPEC
 # error DEFAULT_MAKESPEC not defined
@@ -565,7 +566,17 @@ namespace QTest {
              << makespec()
              << QLatin1String("project.pro");
         qmake.setWorkingDirectory(temporaryDirPath);
-        qmake.start(QLatin1String("qmake"), args);
+
+        QString cmd = QLibraryInfo::location(QLibraryInfo::BinariesPath) + "/qmake";
+#ifdef Q_OS_WIN
+        cmd.append(".exe");
+#endif
+        if (!QFile::exists(cmd)) {
+            cmd = "qmake";
+            qWarning("qmake from build not found, fallback to PATH's qmake");
+        }
+
+        qmake.start(cmd, args);
 
         std_out += "### --- stdout from qmake --- ###\n";
         std_err += "### --- stderr from qmake --- ###\n";