summaryrefslogtreecommitdiffstats
path: root/src/testlib/qtestcase.cpp
diff options
context:
space:
mode:
authorTor Arne Vestbø <tor.arne.vestbo@digia.com>2015-02-11 13:59:46 +0100
committerTor Arne Vestbø <tor.arne.vestbo@theqtcompany.com>2015-03-27 16:53:43 +0000
commit94ea7b71320ca409e2d8b1c701e3cc48912ebde3 (patch)
treeacfc8f3215feb7368271f17c3aa05571cddcaf17 /src/testlib/qtestcase.cpp
parent595606fb027ea6bfd8f4fa01f44419e2b5b63608 (diff)
Add XCTest logger backend to QtTestLib
Will be active when running test apps through Xcode's 'test' action, and reports QtTestLib test objects and functions to Xcode as XCTest cases. This allows running tests on both iOS Simulator and iOS devices from the command line, through xcodebuild, without relying on any 3rd party tools. It also integrates Qt test failures and passes into the Xcode IDE, which may be useful for closer investigation of test failures. The feature is limited to Xcode 6.x. Change-Id: I33d39edbabdbaebef48d2d0eb7e08a1ffb72c397 Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@theqtcompany.com>
Diffstat (limited to 'src/testlib/qtestcase.cpp')
-rw-r--r--src/testlib/qtestcase.cpp14
1 files changed, 13 insertions, 1 deletions
diff --git a/src/testlib/qtestcase.cpp b/src/testlib/qtestcase.cpp
index 222bdd3f39..e2f98c2f04 100644
--- a/src/testlib/qtestcase.cpp
+++ b/src/testlib/qtestcase.cpp
@@ -59,6 +59,9 @@
#include <QtTest/private/qbenchmark_p.h>
#include <QtTest/private/cycle_p.h>
#include <QtTest/private/qtestblacklist_p.h>
+#if defined(HAVE_XCTEST)
+#include <QtTest/private/qxctestlogger_p.h>
+#endif
#include <numeric>
#include <algorithm>
@@ -1530,6 +1533,11 @@ Q_TESTLIB_EXPORT void qtest_qParseArgs(int argc, char *argv[], bool qml)
QTestLog::LogMode logFormat = QTestLog::Plain;
const char *logFilename = 0;
+#if defined(Q_OS_MAC) && defined(HAVE_XCTEST)
+ if (QXcodeTestLogger::canLogTestProgress())
+ logFormat = QTestLog::XCTest;
+#endif
+
const char *testOptions =
" New-style logging options:\n"
" -o filename,format : Output results to file in the specified format\n"
@@ -1782,10 +1790,14 @@ Q_TESTLIB_EXPORT void qtest_qParseArgs(int argc, char *argv[], bool qml)
} else if (strcmp(argv[i], "-vb") == 0) {
QBenchmarkGlobalData::current->verboseOutput = true;
-#ifdef Q_OS_WINRT
+#if defined(Q_OS_WINRT)
} else if (strncmp(argv[i], "-ServerName:", 12) == 0 ||
strncmp(argv[i], "-qdevel", 7) == 0) {
continue;
+#elif defined(Q_OS_MAC) && defined(HAVE_XCTEST)
+ } else if (int skip = QXcodeTestLogger::parseCommandLineArgument(argv[i])) {
+ i += (skip - 1); // Eating argv[i] with a continue counts towards skips
+ continue;
#endif
} else if (argv[i][0] == '-') {
fprintf(stderr, "Unknown option: '%s'\n\n%s", argv[i], testOptions);