summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorChristian Kandeler <christian.kandeler@digia.com>2014-09-22 14:19:29 +0200
committerChristian Kandeler <christian.kandeler@digia.com>2014-09-29 13:17:59 +0200
commit05cb6aff3b95d463d506e7295cb32018722038fb (patch)
tree67b38f7741c59837872b459372b2c671cf5ac1f9 /tests
parent18a263188753a13704a590c3b54dc7bc86f72360 (diff)
downloadqbs-05cb6aff3b95d463d506e7295cb32018722038fb.tar.gz
libqtprofilesetup: Fix mingw use case.
- Don't assume the mkspec has "mingw" in its name. - Relax overly pedantic tests in gcc.js: If a library name is an actual file path, then use it as one, regardless of what it looks like. - Some autotest adaptations. Task-number: QBS-688 Change-Id: I1d0d51b04ae81d4c10f8cdcc18d6447233e44863 Reviewed-by: Joerg Bornemann <joerg.bornemann@digia.com>
Diffstat (limited to 'tests')
-rw-r--r--tests/auto/blackbox/tst_blackbox.cpp19
-rw-r--r--tests/auto/shared.h11
2 files changed, 22 insertions, 8 deletions
diff --git a/tests/auto/blackbox/tst_blackbox.cpp b/tests/auto/blackbox/tst_blackbox.cpp
index faa3295d2..ac60c04b6 100644
--- a/tests/auto/blackbox/tst_blackbox.cpp
+++ b/tests/auto/blackbox/tst_blackbox.cpp
@@ -538,9 +538,11 @@ static bool symlinkExists(const QString &linkFilePath)
void TestBlackbox::clean()
{
- const QString appObjectFilePath = productBuildDir("app") + "/.obj/main.cpp" + QTC_HOST_OBJECT_SUFFIX;
+ const QString appObjectFilePath = productBuildDir("app")
+ + objectFileName("/.obj/main.cpp", buildProfileName);
const QString appExeFilePath = executableFilePath("app");
- const QString depObjectFilePath = productBuildDir("dep") + "/.obj/dep.cpp" + QTC_HOST_OBJECT_SUFFIX;
+ const QString depObjectFilePath = productBuildDir("dep")
+ + objectFileName("/.obj/dep.cpp", buildProfileName);
const QString depLibBase = productBuildDir("dep") + '/' + QTC_HOST_DYNAMICLIB_PREFIX + "dep";
QString depLibFilePath;
QStringList symlinks;
@@ -826,7 +828,7 @@ void TestBlackbox::track_qobject_change()
const QString productFilePath = executableFilePath("i");
QVERIFY2(regularFileExists(productFilePath), qPrintable(productFilePath));
QString moc_bla_objectFileName = productBuildDir("i")
- + "/.obj/GeneratedFiles/moc_bla.cpp" QTC_HOST_OBJECT_SUFFIX;
+ + objectFileName("/.obj/GeneratedFiles/moc_bla.cpp", buildProfileName);
QVERIFY2(regularFileExists(moc_bla_objectFileName), qPrintable(moc_bla_objectFileName));
QTest::qSleep(1000);
@@ -855,7 +857,7 @@ void TestBlackbox::trackAddFile()
output = process.readAllStandardOutput().split('\n');
QCOMPARE(output.takeFirst().trimmed().constData(), "Hello World!");
QCOMPARE(output.takeFirst().trimmed().constData(), "NARF!");
- QString unchangedObjectFile = buildDir + "/someapp/narf.cpp" QTC_HOST_OBJECT_SUFFIX;
+ QString unchangedObjectFile = buildDir + objectFileName("/someapp/narf.cpp", buildProfileName);
QDateTime unchangedObjectFileTime1 = QFileInfo(unchangedObjectFile).lastModified();
waitForNewTimestamp();
@@ -961,7 +963,7 @@ void TestBlackbox::trackRemoveFile()
QCOMPARE(output.takeFirst().trimmed().constData(), "Hello World!");
QCOMPARE(output.takeFirst().trimmed().constData(), "NARF!");
QCOMPARE(output.takeFirst().trimmed().constData(), "ZORT!");
- QString unchangedObjectFile = buildDir + "/someapp/narf.cpp" QTC_HOST_OBJECT_SUFFIX;
+ QString unchangedObjectFile = buildDir + objectFileName("/someapp/narf.cpp", buildProfileName);
QDateTime unchangedObjectFileTime1 = QFileInfo(unchangedObjectFile).lastModified();
waitForNewTimestamp();
@@ -990,7 +992,7 @@ void TestBlackbox::trackRemoveFile()
QCOMPARE(unchangedObjectFileTime1, unchangedObjectFileTime2);
// the object file for the removed cpp file should have vanished too
- QCOMPARE(regularFileExists(buildDir + "/someapp/zort.cpp" QTC_HOST_OBJECT_SUFFIX), false);
+ QVERIFY(!regularFileExists(buildDir + objectFileName("/someapp/zort.cpp", buildProfileName)));
}
void TestBlackbox::trackAddFileTag()
@@ -1040,7 +1042,7 @@ void TestBlackbox::trackRemoveFileTag()
// check if the artifacts are here that will become stale in the 2nd step
QVERIFY(regularFileExists(productBuildDir("someapp")
- + "/.obj/main_foo.cpp" QTC_HOST_OBJECT_SUFFIX));
+ + objectFileName("/.obj/main_foo.cpp", buildProfileName)));
QVERIFY(regularFileExists(productBuildDir("someapp") + "/main_foo.cpp"));
QVERIFY(regularFileExists(productBuildDir("someapp") + "/main.foo"));
@@ -1065,7 +1067,8 @@ void TestBlackbox::trackRemoveFileTag()
QCOMPARE(output.takeFirst().trimmed().constData(), "there's no foo here");
// check if stale artifacts have been removed
- QCOMPARE(regularFileExists(productBuildDir("someapp") + "/.obj/main_foo.cpp" QTC_HOST_OBJECT_SUFFIX), false);
+ QCOMPARE(regularFileExists(productBuildDir("someapp")
+ + objectFileName("/.obj/main_foo.cpp", buildProfileName)), false);
QCOMPARE(regularFileExists(productBuildDir("someapp") + "/main_foo.cpp"), false);
QCOMPARE(regularFileExists(productBuildDir("someapp") + "/main.foo"), false);
}
diff --git a/tests/auto/shared.h b/tests/auto/shared.h
index e0920363f..2c4476db1 100644
--- a/tests/auto/shared.h
+++ b/tests/auto/shared.h
@@ -30,6 +30,8 @@
#define QBS_TEST_SHARED_H
#include <tools/hostosinfo.h>
+#include <tools/profile.h>
+#include <tools/settings.h>
#include <QFile>
#include <QtTest>
@@ -67,4 +69,13 @@ inline void copyFileAndUpdateTimestamp(const QString &source, const QString &tar
touch(target);
}
+inline QString objectFileName(const QString &baseName, const QString &profileName)
+{
+ qbs::Settings settings((QString()));
+ qbs::Profile profile(profileName, &settings);
+ const QString suffix = profile.value("qbs.toolchain").toStringList().contains("msvc")
+ ? "obj" : "o";
+ return baseName + '.' + suffix;
+}
+
#endif // Include guard.