summaryrefslogtreecommitdiffstats
path: root/tests/auto/corelib/thread
diff options
context:
space:
mode:
authorMårten Nordheim <marten.nordheim@qt.io>2018-06-26 15:50:28 +0200
committerMårten Nordheim <marten.nordheim@qt.io>2018-06-27 17:40:28 +0000
commit79955402924ea21b564cc5eadb624eaa60bdaa27 (patch)
treea1a9c66973d1b70966d9a258a1aae7d6975ce397 /tests/auto/corelib/thread
parent9fde78269526925a764e45370ffcae509e5db8e9 (diff)
tst_qthreadpool: Skip "stackSize" if unsupported
If you're on a Unix platform which don't have the necessary defines then the thread will never be launched due to an error. Skip the test instead. Change-Id: I83159988b8f330a750c7aa328a8805e4fa478070 Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
Diffstat (limited to 'tests/auto/corelib/thread')
-rw-r--r--tests/auto/corelib/thread/qthreadpool/tst_qthreadpool.cpp8
1 files changed, 8 insertions, 0 deletions
diff --git a/tests/auto/corelib/thread/qthreadpool/tst_qthreadpool.cpp b/tests/auto/corelib/thread/qthreadpool/tst_qthreadpool.cpp
index 1092216fb7..838431cd5a 100644
--- a/tests/auto/corelib/thread/qthreadpool/tst_qthreadpool.cpp
+++ b/tests/auto/corelib/thread/qthreadpool/tst_qthreadpool.cpp
@@ -32,6 +32,10 @@
#include <qstring.h>
#include <qmutex.h>
+#ifdef Q_OS_UNIX
+#include <unistd.h>
+#endif
+
typedef void (*FunctionPointer)();
class FunctionPointerTask : public QRunnable
@@ -1145,6 +1149,10 @@ void tst_QThreadPool::destroyingWaitsForTasksToFinish()
// stack size used by the native thread.
void tst_QThreadPool::stackSize()
{
+#if defined(Q_OS_UNIX) && !(defined(_POSIX_THREAD_ATTR_STACKSIZE) && (_POSIX_THREAD_ATTR_STACKSIZE-0 > 0))
+ QSKIP("Setting stack size is unsupported on this platform.");
+#endif
+
uint targetStackSize = 512 * 1024;
uint threadStackSize = 1; // impossible value