aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/lib/tools/hostosinfo.h8
-rw-r--r--tests/auto/blackbox/tst_blackbox.cpp21
-rw-r--r--tests/auto/blackbox/tst_blackbox.h5
-rw-r--r--tests/auto/tools/tst_tools.cpp6
4 files changed, 19 insertions, 21 deletions
diff --git a/src/lib/tools/hostosinfo.h b/src/lib/tools/hostosinfo.h
index 61fa57b6d..ba377e99a 100644
--- a/src/lib/tools/hostosinfo.h
+++ b/src/lib/tools/hostosinfo.h
@@ -37,14 +37,17 @@
#define QTC_HOST_EXE_SUFFIX ".exe"
#define QTC_HOST_DYNAMICLIB_PREFIX ""
#define QTC_HOST_DYNAMICLIB_SUFFIX ".dll"
+#define QTC_HOST_OBJECT_SUFFIX ".obj"
#elif defined(Q_OS_MAC)
#define QTC_HOST_EXE_SUFFIX ""
#define QTC_HOST_DYNAMICLIB_PREFIX ""
#define QTC_HOST_DYNAMICLIB_SUFFIX ".dylib"
+#define QTC_HOST_OBJECT_SUFFIX ".o"
#else
#define QTC_HOST_EXE_SUFFIX ""
#define QTC_HOST_DYNAMICLIB_PREFIX "lib"
#define QTC_HOST_DYNAMICLIB_SUFFIX ".so"
+#define QTC_HOST_OBJECT_SUFFIX ".o"
#endif // Q_OS_WIN
namespace qbs {
@@ -76,6 +79,11 @@ public:
+ QLatin1String(QTC_HOST_DYNAMICLIB_SUFFIX);
}
+ static QString objectName(const QString &baseName)
+ {
+ return baseName + QLatin1String(QTC_HOST_OBJECT_SUFFIX);
+ }
+
static Qt::CaseSensitivity fileNameCaseSensitivity()
{
return isWindowsHost() ? Qt::CaseInsensitive: Qt::CaseSensitive;
diff --git a/tests/auto/blackbox/tst_blackbox.cpp b/tests/auto/blackbox/tst_blackbox.cpp
index df22ae20d..96981481a 100644
--- a/tests/auto/blackbox/tst_blackbox.cpp
+++ b/tests/auto/blackbox/tst_blackbox.cpp
@@ -45,12 +45,7 @@ TestBlackbox::TestBlackbox()
testSourceDir(QDir::cleanPath(SRCDIR "/testdata")),
qbsExecutableFilePath(initQbsExecutableFilePath()),
buildProfile(QLatin1String("qbs_autotests")),
- buildDir(buildProfile + QLatin1String("-debug")),
-#ifdef Q_OS_WIN
- objectSuffix(QLatin1String(".obj"))
-#else
- objectSuffix(QLatin1String(".o"))
-#endif
+ buildDir(buildProfile + QLatin1String("-debug"))
{
}
@@ -226,7 +221,7 @@ void TestBlackbox::track_qobject_change()
QCOMPARE(runQbs(), 0);
const QString productFilePath = HostOsInfo::appendExecutableSuffix(buildDir + "/i");
QVERIFY2(QFile(productFilePath).exists(), qPrintable(productFilePath));
- QString moc_bla_objectFileName = buildDir + "/.obj/i/GeneratedFiles/i/moc_bla" + objectSuffix;
+ QString moc_bla_objectFileName = buildDir + "/.obj/i/GeneratedFiles/i/moc_bla" QTC_HOST_OBJECT_SUFFIX;
QVERIFY(QFile(moc_bla_objectFileName).exists());
QTest::qSleep(1000);
@@ -257,7 +252,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" + objectSuffix;
+ QString unchangedObjectFile = buildDir + "/someapp/narf" QTC_HOST_OBJECT_SUFFIX;
QDateTime unchangedObjectFileTime1 = QFileInfo(unchangedObjectFile).lastModified();
QTest::qWait(1000); // for file systems with low resolution timestamps
@@ -301,7 +296,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" + objectSuffix;
+ QString unchangedObjectFile = buildDir + "/someapp/narf" QTC_HOST_OBJECT_SUFFIX;
QDateTime unchangedObjectFileTime1 = QFileInfo(unchangedObjectFile).lastModified();
QTest::qWait(1000); // for file systems with low resolution timestamps
@@ -330,7 +325,7 @@ void TestBlackbox::trackRemoveFile()
QCOMPARE(unchangedObjectFileTime1, unchangedObjectFileTime2);
// the object file for the removed cpp file should have vanished too
- QCOMPARE(QFile::exists(buildDir + "/someapp/zort" + objectSuffix), false);
+ QCOMPARE(QFile::exists(buildDir + "/someapp/zort" QTC_HOST_OBJECT_SUFFIX), false);
}
void TestBlackbox::trackAddFileTag()
@@ -379,8 +374,8 @@ void TestBlackbox::trackRemoveFileTag()
QCOMPARE(runQbs(), 0);
// check if the artifacts are here that will become stale in the 2nd step
- QVERIFY2(QFile::exists(buildDir + "/.obj/someapp/main_foo" + objectSuffix),
- qPrintable(buildDir + "/.obj/someapp/main_foo" + objectSuffix));
+ QVERIFY2(QFile::exists(buildDir + "/.obj/someapp/main_foo" QTC_HOST_OBJECT_SUFFIX),
+ qPrintable(buildDir + "/.obj/someapp/main_foo" QTC_HOST_OBJECT_SUFFIX));
QVERIFY2(QFile::exists(buildDir + "/main_foo.cpp"), qPrintable(buildDir + "/main_foo.cpp"));
QVERIFY2(QFile::exists(buildDir + "/main.foo"), qPrintable(buildDir + "/main.foo"));
@@ -405,7 +400,7 @@ void TestBlackbox::trackRemoveFileTag()
QCOMPARE(output.takeFirst().trimmed().constData(), "there's no foo here");
// check if stale artifacts have been removed
- QCOMPARE(QFile::exists(buildDir + "/someapp/main_foo" + objectSuffix), false);
+ QCOMPARE(QFile::exists(buildDir + "/someapp/main_foo" QTC_HOST_OBJECT_SUFFIX), false);
QCOMPARE(QFile::exists(buildDir + "/someapp/main_foo.cpp"), false);
QCOMPARE(QFile::exists(buildDir + "/someapp/main.foo"), false);
}
diff --git a/tests/auto/blackbox/tst_blackbox.h b/tests/auto/blackbox/tst_blackbox.h
index 2b133a5bc..a2450caf3 100644
--- a/tests/auto/blackbox/tst_blackbox.h
+++ b/tests/auto/blackbox/tst_blackbox.h
@@ -36,10 +36,6 @@
#include <QProcess>
#include <QtTest>
-#ifdef Q_OS_LINUX
-#include <unistd.h>
-#endif
-
class TestBlackbox : public QObject
{
Q_OBJECT
@@ -48,7 +44,6 @@ class TestBlackbox : public QObject
const QString qbsExecutableFilePath;
const QString buildProfile;
const QString buildDir;
- const QString objectSuffix;
public:
TestBlackbox();
diff --git a/tests/auto/tools/tst_tools.cpp b/tests/auto/tools/tst_tools.cpp
index 956d24a04..476a74d78 100644
--- a/tests/auto/tools/tst_tools.cpp
+++ b/tests/auto/tools/tst_tools.cpp
@@ -30,6 +30,7 @@
#include <app/shared/commandlineparser.h>
#include <logging/logger.h>
#include <tools/fileinfo.h>
+#include <tools/hostosinfo.h>
#include <QDir>
#include <QtTest>
@@ -86,9 +87,8 @@ private slots:
QCOMPARE(FileInfo::path("/abc/lol"), QString("/abc"));
QVERIFY(!FileInfo::isAbsolute("bla/lol"));
QVERIFY(FileInfo::isAbsolute("/bla/lol"));
-#ifdef Q_OS_WIN
- QVERIFY(FileInfo::isAbsolute("C:\\bla\\lol"));
-#endif
+ if (HostOsInfo::isWindowsHost())
+ QVERIFY(FileInfo::isAbsolute("C:\\bla\\lol"));
QCOMPARE(FileInfo::resolvePath("/abc/lol", "waffl"), QString("/abc/lol/waffl"));
QCOMPARE(FileInfo::resolvePath("/abc/def/ghi/jkl/", "../foo/bar"), QString("/abc/def/ghi/foo/bar"));
QCOMPARE(FileInfo::resolvePath("/abc/def/ghi/jkl/", "../../foo/bar"), QString("/abc/def/foo/bar"));