aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristian Kandeler <christian.kandeler@digia.com>2014-07-30 15:59:53 +0200
committerChristian Kandeler <christian.kandeler@digia.com>2014-07-30 16:20:59 +0200
commit1bd32fa94ca6a5de1adea87b0dce2a3ed6cfff15 (patch)
tree9f6432baa744234d19ad2675d465556098532529
parentfd49db9b33c0f54255d92c0d882a4f18c20a5ef3 (diff)
Tests: Move waitForNewTimestamp() function to shared file.
We want to use it in the API tests too. Change-Id: I8fad090ea98f67e50b7b2a8e3854c5b618172364 Reviewed-by: Joerg Bornemann <joerg.bornemann@digia.com>
-rw-r--r--tests/auto/blackbox/blackbox.qbs2
-rw-r--r--tests/auto/blackbox/tst_blackbox.cpp11
-rw-r--r--tests/auto/blackbox/tst_blackbox.h1
-rw-r--r--tests/auto/shared.h (renamed from tests/auto/skip.h)17
4 files changed, 17 insertions, 14 deletions
diff --git a/tests/auto/blackbox/blackbox.qbs b/tests/auto/blackbox/blackbox.qbs
index eb227df4b..7b7a31635 100644
--- a/tests/auto/blackbox/blackbox.qbs
+++ b/tests/auto/blackbox/blackbox.qbs
@@ -2,6 +2,6 @@ import "../autotest.qbs" as AutoTest
AutoTest {
testName: "blackbox"
- files: ["../skip.h", "tst_blackbox.h", "tst_blackbox.cpp", ]
+ files: ["../shared.h", "tst_blackbox.h", "tst_blackbox.cpp", ]
cpp.defines: base.concat(['SRCDIR="' + path + '"'])
}
diff --git a/tests/auto/blackbox/tst_blackbox.cpp b/tests/auto/blackbox/tst_blackbox.cpp
index 43ecb4a43..4dd049c8e 100644
--- a/tests/auto/blackbox/tst_blackbox.cpp
+++ b/tests/auto/blackbox/tst_blackbox.cpp
@@ -29,7 +29,7 @@
#include "tst_blackbox.h"
-#include "../skip.h"
+#include "../shared.h"
#include <tools/fileinfo.h>
#include <tools/hostosinfo.h>
@@ -161,15 +161,6 @@ void TestBlackbox::touch(const QString &fn)
f.resize(s);
}
-// Waits for the time that corresponds to the host file system's time stamp granularity.
-void TestBlackbox::waitForNewTimestamp()
-{
- if (qbs::Internal::HostOsInfo::isWindowsHost())
- QTest::qWait(1); // NTFS has 100 ns precision. Let's ignore exFAT.
- else
- QTest::qWait(1000);
-}
-
QByteArray TestBlackbox::unifiedLineEndings(const QByteArray &ba)
{
if (HostOsInfo::isWindowsHost()) {
diff --git a/tests/auto/blackbox/tst_blackbox.h b/tests/auto/blackbox/tst_blackbox.h
index 6573ad267..5e265027c 100644
--- a/tests/auto/blackbox/tst_blackbox.h
+++ b/tests/auto/blackbox/tst_blackbox.h
@@ -89,7 +89,6 @@ protected:
int runQbs(const QbsRunParameters &params = QbsRunParameters());
void rmDirR(const QString &dir);
void touch(const QString &fn);
- static void waitForNewTimestamp();
static QByteArray unifiedLineEndings(const QByteArray &ba);
static void sanitizeOutput(QByteArray *ba);
diff --git a/tests/auto/skip.h b/tests/auto/shared.h
index 7da4e6110..2b9974110 100644
--- a/tests/auto/skip.h
+++ b/tests/auto/shared.h
@@ -26,8 +26,12 @@
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
****************************************************************************/
-#ifndef QBS_TEST_SKIP_H
-#define QBS_TEST_SKIP_H
+#ifndef QBS_TEST_SHARED_H
+#define QBS_TEST_SHARED_H
+
+#include <tools/hostosinfo.h>
+
+#include <QtTest>
#if QT_VERSION >= 0x050000
#define SKIP_TEST(message) QSKIP(message)
@@ -35,4 +39,13 @@
#define SKIP_TEST(message) QSKIP(message, SkipAll)
#endif
+inline void waitForNewTimestamp()
+{
+ // Waits for the time that corresponds to the host file system's time stamp granularity.
+ if (qbs::Internal::HostOsInfo::isWindowsHost())
+ QTest::qWait(1); // NTFS has 100 ns precision. Let's ignore exFAT.
+ else
+ QTest::qWait(1000);
+}
+
#endif // Include guard.