summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKonstantin Ritt <ritt.ks@gmail.com>2010-11-08 04:25:27 +0300
committerYoann Lopes <yoann.lopes@nokia.com>2010-11-22 22:31:04 +0100
commit6070f9ff27c6eaf485032a84512fa97da973ce78 (patch)
tree852c77699c62b9172d885b3d546c429bec8fc7b6
parentfa54bbdb3b4f7248c4b0152a1b5461c8b2c9d32b (diff)
Fix the test execution in release variant on windows.
Previously, the hardcoded "debug" variant was used for execution tests on windows; from now we calculate the path just before the execution. This also drops some dead code. Merge-request: 1 Reviewed-by: yoann
-rw-r--r--src/test.cpp64
-rw-r--r--src/test.h4
2 files changed, 29 insertions, 39 deletions
diff --git a/src/test.cpp b/src/test.cpp
index 5574d71..6f84372 100644
--- a/src/test.cpp
+++ b/src/test.cpp
@@ -60,15 +60,6 @@ Test::Test(const QString &name, const QString &path, const QString &pro)
testPro(pro),
testIsAvailable(true)
{
- testExecutable = path
-#ifdef Q_WS_WIN
- + QString("/debug")
-#endif
- + QString("/tst_") + name
-#ifdef Q_WS_WIN
- + QString(".exe")
-#endif
- ;
}
/**************************************************************************************************
@@ -81,6 +72,31 @@ Test::~Test()
/**************************************************************************************************
**************************************************************************************************/
+QString Test::executable() const
+{
+ QString exe = testPath;
+#ifdef Q_WS_WIN
+ //prepend debug or release if needed
+ if (!MainWindow::getCurrentProfile()->variant().isEmpty())
+ exe += QLatin1Char('/') + MainWindow::getCurrentProfile()->variant();
+#endif
+ exe += QLatin1String("/tst_") + testName;
+
+ //append OS specific suffix
+#ifdef Q_WS_MAC
+ QFileInfo f(MainWindow::getCurrentQtVersion()->testBuildDir() + exe);
+ if (!f.exists())
+ exe += QLatin1String(".app");
+#endif
+#ifdef Q_WS_WIN
+ exe += QLatin1String(".exe");
+#endif
+
+ return exe;
+}
+
+/**************************************************************************************************
+ **************************************************************************************************/
void Test::run()
{
Logger::getIt()->log(QString("<b>Running auto-test %1</b>").arg(testName));
@@ -144,12 +160,6 @@ int Test::buildTest()
setStatus(BuildError);
}
-#ifdef Q_WS_MAC
- QFileInfo f(MainWindow::getCurrentQtVersion()->testBuildDir() + testExecutable);
- if (!f.exists())
- testExecutable += QString(".app");
-#endif
-
return ret;
}
@@ -162,26 +172,8 @@ int Test::runTest()
int code = 0;
if (!MainWindow::getCurrentQtVersion()->isCrossCompiled()) {
//A desktop platform, run the test directly and capture it's stdout
- QString exe;
-#ifdef Q_WS_WIN
- //prepend debug or release if needed
- if (!MainWindow::getCurrentProfile()->variant().isEmpty())
- exe = MainWindow::getCurrentProfile()->variant() + QLatin1Char('/') + testExecutable;
- else
-#endif
- exe = testExecutable;
- //append OS specific suffix
-#ifdef Q_WS_MAC
- QFileInfo f(testExecutable);
- if (!f.exists())
- exe += QString(".app");
-#endif
-#ifdef Q_WS_WIN
- exe += QLatin1String(".exe");
-#endif
-
code = runExecutable(MainWindow::getCurrentQtVersion()->testBuildDir() + testPath,
- MainWindow::getCurrentQtVersion()->testBuildDir() + testExecutable,
+ MainWindow::getCurrentQtVersion()->testBuildDir() + executable(),
MainWindow::getCurrentQtVersion()->libDir(),
QStringList() << "-xml" << "-flush" << m_globalArguments.split(" ", QString::SkipEmptyParts), true);
}
@@ -290,10 +282,10 @@ int Test::runExecutable(const QString &workdir, const QString &executable, const
proEnv.insert("QTDIR", MainWindow::getCurrentQtVersion()->buildDir());
p->setProcessEnvironment(proEnv);
- if (workdir != QString())
+ if (!workdir.isEmpty())
p->setWorkingDirectory(workdir);
- if (arguments == QStringList())
+ if (arguments.isEmpty())
p->start(executable);
else
p->start(executable, arguments);
diff --git a/src/test.h b/src/test.h
index ffcc170..2bd1ed9 100644
--- a/src/test.h
+++ b/src/test.h
@@ -91,8 +91,7 @@ public:
{ return testName; }
inline QString path() const
{ return testPath; }
- inline QString executable() const
- { return testExecutable; }
+ QString executable() const;
inline Test::TestStatus status() const
{ return teststatus; }
inline void reset()
@@ -139,7 +138,6 @@ protected Q_SLOTS:
private:
QString testName;
QString testPath;
- QString testExecutable;
TestStatus teststatus;
TestResult r;
QProcess *p;