summaryrefslogtreecommitdiff
path: root/tests/auto/shared.h
diff options
context:
space:
mode:
Diffstat (limited to 'tests/auto/shared.h')
-rw-r--r--tests/auto/shared.h30
1 files changed, 30 insertions, 0 deletions
diff --git a/tests/auto/shared.h b/tests/auto/shared.h
index 66fc1b80c..7ec6ed5ea 100644
--- a/tests/auto/shared.h
+++ b/tests/auto/shared.h
@@ -32,6 +32,7 @@
#include <tools/hostosinfo.h>
#include <QFile>
+#include <QFileInfo>
#include <QtTest>
#include <ctime>
@@ -42,6 +43,35 @@
#define SKIP_TEST(message) QSKIP(message, SkipAll)
#endif
+inline QString profileName() { return QLatin1String("qbs_autotests"); }
+inline QString relativeBuildDir() { return profileName() + QLatin1String("-debug"); }
+
+inline QString relativeBuildGraphFilePath() {
+ return relativeBuildDir() + QLatin1Char('/') + relativeBuildDir() + QLatin1String(".bg");
+}
+
+inline bool regularFileExists(const QString &filePath)
+{
+ const QFileInfo fi(filePath);
+ return fi.exists() && fi.isFile();
+}
+
+inline QString uniqueProductName(const QString &productName)
+{
+ return productName + '.' + profileName();
+}
+
+inline QString relativeProductBuildDir(const QString &productName)
+{
+ return relativeBuildDir() + '/' + uniqueProductName(productName);
+}
+
+inline QString relativeExecutableFilePath(const QString &productName)
+{
+ return relativeProductBuildDir(productName) + '/'
+ + qbs::Internal::HostOsInfo::appendExecutableSuffix(productName);
+}
+
inline void waitForNewTimestamp()
{
// Waits for the time that corresponds to the host file system's time stamp granularity.