aboutsummaryrefslogtreecommitdiffstats
path: root/tests/auto/shared.h
diff options
context:
space:
mode:
authorChristian Kandeler <christian.kandeler@digia.com>2014-08-11 15:59:09 +0200
committerChristian Kandeler <christian.kandeler@digia.com>2014-08-14 11:16:34 +0200
commit09d9ce2c265450d786052100bedb059870dddc23 (patch)
tree3e811fa1a328a8d19ddbffec5a94d2c61add84fc /tests/auto/shared.h
parent4e7f1023b0fc1349047357cf8926fa68761cc546 (diff)
Turn some blackbox tests into API tests.
Different test executables can run in parallel, whereas the functions within one test executable cannot. This means that tst_blackbox is currently a bottleneck, as it takes an order of magnitude longer than all other tests combined. We therefore turn a number of blackbox tests into API tests (most tests work equally well in either). The run-time of these two test executables is now about the same, and as a result, the time it takes to run "make check" has almost halved. Change-Id: I55ef43a60588f86a8438bdecb7795aca0880efd0 Reviewed-by: Joerg Bornemann <joerg.bornemann@digia.com>
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.