Skip to content

Commit

Permalink
tst_qthreadpool: Skip "stackSize" if unsupported
Browse files Browse the repository at this point in the history
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 <[email protected]>
  • Loading branch information
Morten242 committed Jun 27, 2018
1 parent 9fde782 commit 7995540
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions tests/auto/corelib/thread/qthreadpool/tst_qthreadpool.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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

Expand Down

0 comments on commit 7995540

Please sign in to comment.