diff options
author | Jędrzej Nowacki <jedrzej.nowacki@qt.io> | 2017-07-28 09:42:03 +0200 |
---|---|---|
committer | Simon Hausmann <simon.hausmann@qt.io> | 2017-07-29 09:35:16 +0000 |
commit | 3760120ab33ea454bed320b10e8afcb29f7869ae (patch) | |
tree | 52c13158db58a5e770679d1fd44adcba6e4fc1ea /tests/auto/concurrent | |
parent | 5881fc0d2d58ae3e46c8fd3567c98ee689f5c900 (diff) |
Remove tst_qtconcurrentiteratekernel blockSize test
The test is just wrong.
It suggests, that it tests minimal block size,
but in reality it is checking if a maximal peak of block size
is bigger then expected minimum block size.
The minimal block size is 1, not 1024 / ideal threads count and
it is defined in BlockSizeManagerV2.
The maximal block size is defined and it is fixed, but it is an
implementation detail, probably not worth testing.
The test is based on a race condition as peakBegin and
peakBlockSize are modified in parallel from multiple threads,
without any synchronization.
Change-Id: I430eedcf83b0fa3e2ce2cfd294eaee7b301e48ae
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
Diffstat (limited to 'tests/auto/concurrent')
-rw-r--r-- | tests/auto/concurrent/qtconcurrentiteratekernel/tst_qtconcurrentiteratekernel.cpp | 45 |
1 files changed, 0 insertions, 45 deletions
diff --git a/tests/auto/concurrent/qtconcurrentiteratekernel/tst_qtconcurrentiteratekernel.cpp b/tests/auto/concurrent/qtconcurrentiteratekernel/tst_qtconcurrentiteratekernel.cpp index 4bb3fa5b28..2e698e6615 100644 --- a/tests/auto/concurrent/qtconcurrentiteratekernel/tst_qtconcurrentiteratekernel.cpp +++ b/tests/auto/concurrent/qtconcurrentiteratekernel/tst_qtconcurrentiteratekernel.cpp @@ -81,7 +81,6 @@ private slots: void stresstest(); void noIterations(); void throttling(); - void blockSize(); void multipleResults(); }; @@ -240,50 +239,6 @@ void tst_QtConcurrentIterateKernel::throttling() QCOMPARE(threads.count(), 1); } -class BlockSizeRecorder : public IterateKernel<TestIterator, void> -{ -public: - BlockSizeRecorder(TestIterator begin, TestIterator end) - : IterateKernel<TestIterator, void>(begin, end) - , peakBlockSize(0) - , peakBegin(0) - {} - - inline bool runIterations(TestIterator, int begin, int end, void *) - { - const int blockSize = end - begin; - if (blockSize > peakBlockSize) { - peakBlockSize = blockSize; - peakBegin = begin; - } - return false; - } - int peakBlockSize; - int peakBegin; -}; - -static QByteArray msgBlockSize(const BlockSizeRecorder &recorder, int expectedMinimumBlockSize) -{ - return QByteArrayLiteral("peakBlockSize=") + QByteArray::number(recorder.peakBlockSize) - + QByteArrayLiteral(" is less than expectedMinimumBlockSize=") - + QByteArray::number(expectedMinimumBlockSize) - + QByteArrayLiteral(", reached at: ") + QByteArray::number(recorder.peakBegin) - + QByteArrayLiteral(" (ideal thread count: ") + QByteArray::number(QThread::idealThreadCount()) - + ')'; -} - -void tst_QtConcurrentIterateKernel::blockSize() -{ - const int expectedMinimumBlockSize = 1024 / QThread::idealThreadCount(); - BlockSizeRecorder recorder(0, 10000); - recorder.startBlocking(); -#ifdef Q_OS_WIN - if (recorder.peakBlockSize < expectedMinimumBlockSize) - QEXPECT_FAIL("", msgBlockSize(recorder, expectedMinimumBlockSize).constData(), Abort); -#endif // Q_OS_WIN - QVERIFY2(recorder.peakBlockSize >= expectedMinimumBlockSize, msgBlockSize(recorder, expectedMinimumBlockSize)); -} - class MultipleResultsFor : public IterateKernel<TestIterator, int> { public: |