diff options
author | ninerider <qt-info@nokia.com> | 2009-10-07 08:50:36 (GMT) |
---|---|---|
committer | ninerider <qt-info@nokia.com> | 2009-10-07 08:50:36 (GMT) |
commit | c14455b78904f25e724cd928652c49f9583c6aa0 (patch) | |
tree | 24332cb3e130d3bc3bacbe7038255b8a5f83a2c6 /tests/auto/qtconcurrentiteratekernel | |
parent | 087b624c616bc1b3dbe850a74d0737fffc08bec2 (diff) | |
download | Qt-c14455b78904f25e724cd928652c49f9583c6aa0.zip Qt-c14455b78904f25e724cd928652c49f9583c6aa0.tar.gz Qt-c14455b78904f25e724cd928652c49f9583c6aa0.tar.bz2 |
Whe STL is not enabled, most of the test threads failed to start.
A second worker function that was not defined in the descendant classes
was used in these cases. The missing worker functions have been
supplied and some tests skipped that depend on iterator ranges.
Reviewed-by: Joerg
Diffstat (limited to 'tests/auto/qtconcurrentiteratekernel')
-rw-r--r-- | tests/auto/qtconcurrentiteratekernel/tst_qtconcurrentiteratekernel.cpp | 27 |
1 files changed, 26 insertions, 1 deletions
diff --git a/tests/auto/qtconcurrentiteratekernel/tst_qtconcurrentiteratekernel.cpp b/tests/auto/qtconcurrentiteratekernel/tst_qtconcurrentiteratekernel.cpp index a5748ae..3b1e18f 100644 --- a/tests/auto/qtconcurrentiteratekernel/tst_qtconcurrentiteratekernel.cpp +++ b/tests/auto/qtconcurrentiteratekernel/tst_qtconcurrentiteratekernel.cpp @@ -66,6 +66,7 @@ struct TestIterator }; #include <qiterator.h> +#ifndef QT_NO_STL namespace std { template <> struct iterator_traits<TestIterator> @@ -79,6 +80,7 @@ int distance(TestIterator &a, TestIterator &b) } } +#endif #include <qtconcurrentiteratekernel.h> @@ -112,7 +114,7 @@ class PrintFor : public IterateKernel<TestIterator, void> { public: PrintFor(TestIterator begin, TestIterator end) : IterateKernel<TestIterator, void>(begin, end) {iterations = 0; } - inline bool runIterations(TestIterator/*beginIterator*/, int begin, int end, void *) + bool runIterations(TestIterator/*beginIterator*/, int begin, int end, void *) { iterations.fetchAndAddRelaxed(end - begin); #ifdef PRINT @@ -120,6 +122,11 @@ public: #endif return false; } + bool runIteration(TestIterator it, int index , void *result) + { + return runIterations(it, index, index + 1, result); + } + }; class SleepPrintFor : public IterateKernel<TestIterator, void> @@ -135,6 +142,10 @@ public: #endif return false; } + bool runIteration(TestIterator it, int index , void *result) + { + return runIterations(it, index, index + 1, result); + } }; @@ -165,6 +176,10 @@ public: counter.fetchAndAddRelaxed(end - begin); return false; } + bool runIteration(TestIterator it, int index , void *result) + { + return runIterations(it, index, index + 1, result); + } }; void tst_iteratekernel::stresstest() @@ -215,6 +230,10 @@ public: return false; } + bool runIteration(TestIterator it, int index , void *result) + { + return runIterations(it, index, index + 1, result); + } bool shouldThrottleThread() { @@ -254,6 +273,9 @@ public: void tst_iteratekernel::blockSize() { +#ifdef QT_NO_STL + QSKIP("Missing stl iterators prevent correct block size calculation", SkipAll); +#endif const int expectedMinimumBlockSize = 1024 / QThread::idealThreadCount(); BlockSizeRecorder(0, 10000).startBlocking(); if (peakBlockSize < expectedMinimumBlockSize) @@ -276,6 +298,9 @@ public: void tst_iteratekernel::multipleResults() { +#ifdef QT_NO_STL + QSKIP("Missing stl iterators prevent correct summation", SkipAll); +#endif QFuture<int> f = startThreadEngine(new MultipleResultsFor(0, 10)).startAsynchronously(); QCOMPARE(f.results().count() , 10); QCOMPARE(f.resultAt(0), 0); |