diff --git a/appveyor.yml b/appveyor.yml index e4ec908f2..39a5ea20c 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -18,9 +18,6 @@ image: Visual Studio 2015 environment: matrix: - - TOOLSET: msvc-12.0 - VARIANT: release - - TOOLSET: msvc-14.0 ADDRMD: 32 VARIANT: debug @@ -45,9 +42,10 @@ environment: TOOLSET: gcc VARIANT: release - - ADDPATH: C:\mingw\bin; - TOOLSET: gcc - VARIANT: debug +# FIXME: +# - ADDPATH: C:\mingw\bin; +# TOOLSET: gcc +# VARIANT: debug # The following configurations fail with # ./boost/thread/detail/invoke.hpp:101:43: internal compiler error: in gimplify_expr, at gimplify.c:12039 @@ -86,4 +84,4 @@ test_script: - if not "%CXXSTD%" == "" set CXXSTD=cxxstd=%CXXSTD% - if not "%ADDRMD%" == "" set ADDRMD=address-model=%ADDRMD% - if not "%VARIANT%" == "" set VARIANT=variant=%VARIANT% - - b2 -j2 --abbreviate-paths libs/thread/test toolset=%TOOLSET% %CXXSTD% %ADDRMD% %VARIANT% + - b2 --abbreviate-paths libs/thread/test toolset=%TOOLSET% %CXXSTD% %ADDRMD% %VARIANT% diff --git a/test/sync/conditions/condition_variable_any/lost_notif_pass.cpp b/test/sync/conditions/condition_variable_any/lost_notif_pass.cpp index c696da3c2..32e443fa9 100644 --- a/test/sync/conditions/condition_variable_any/lost_notif_pass.cpp +++ b/test/sync/conditions/condition_variable_any/lost_notif_pass.cpp @@ -23,6 +23,7 @@ #include #include #include +#include "../../../timming.hpp" // Summary of each test: // 1. Start the test thread and wait for it to start up. @@ -82,7 +83,7 @@ void test_posix_wait_function(F f) t.join(); boost::posix_time::ptime t1 = boost::posix_time::microsec_clock::universal_time(); - BOOST_TEST(t1 - t0 < boost::posix_time::milliseconds(250)); + BOOST_TEST(t1 - t0 < boost::posix_time::milliseconds(BOOST_THREAD_TEST_TIME_MS)); } //------------------------------------------------------------------------------ @@ -153,7 +154,7 @@ void test_chrono_wait_function(F f) t.join(); boost::chrono::steady_clock::time_point t1 = boost::chrono::steady_clock::now(); - BOOST_TEST(t1 - t0 < boost::chrono::milliseconds(250)); + BOOST_TEST(t1 - t0 < boost::chrono::milliseconds(BOOST_THREAD_TEST_TIME_MS)); } //------------------------------------------------------------------------------ diff --git a/test/sync/futures/async/async_executor_pass.cpp b/test/sync/futures/async/async_executor_pass.cpp index d5a0f4423..d12de2d7c 100644 --- a/test/sync/futures/async/async_executor_pass.cpp +++ b/test/sync/futures/async/async_executor_pass.cpp @@ -32,6 +32,7 @@ #include #include #include +#include "../../../timming.hpp" typedef boost::chrono::high_resolution_clock Clock; typedef boost::chrono::milliseconds ms; @@ -156,7 +157,7 @@ struct check_timer { } ~check_timer() { Clock::time_point now = Clock::now(); - BOOST_TEST(now - start < delay); + BOOST_THREAD_TEST_IT(now - start, delay); std::cout << __FILE__ << "[" << __LINE__ << "] " << (now - start).count() << std::endl; } @@ -174,7 +175,7 @@ int main() boost::this_thread::sleep_for(ms(300)); int res; { - check_timer timer(ms(500)); + check_timer timer(ms(2 * BOOST_THREAD_TEST_TIME_MS)); res = f.get(); } BOOST_TEST(res == 3); @@ -200,7 +201,7 @@ int main() boost::this_thread::sleep_for(ms(300)); int res; { - check_timer timer(ms(500)); + check_timer timer(ms(2 * BOOST_THREAD_TEST_TIME_MS)); res = f.get(); } BOOST_TEST(res == 3); @@ -229,7 +230,7 @@ int main() boost::this_thread::sleep_for(ms(300)); int res; { - check_timer timer(ms(500)); + check_timer timer(ms(2 * BOOST_THREAD_TEST_TIME_MS)); res = f.get(); } BOOST_TEST(res == 3); diff --git a/test/sync/futures/async/async_pass.cpp b/test/sync/futures/async/async_pass.cpp index 86fdfdbec..0ed32c39b 100644 --- a/test/sync/futures/async/async_pass.cpp +++ b/test/sync/futures/async/async_pass.cpp @@ -35,6 +35,7 @@ #include #include #include +#include "../../../timming.hpp" typedef boost::chrono::high_resolution_clock Clock; typedef boost::chrono::milliseconds ms; @@ -159,7 +160,7 @@ struct check_timer { } ~check_timer() { Clock::time_point now = Clock::now(); - BOOST_TEST(now - start < delay); + BOOST_THREAD_TEST_IT(now - start, delay); std::cout << __FILE__ << "[" << __LINE__ << "] " << (now - start).count() << std::endl; } @@ -217,7 +218,7 @@ int main() boost::this_thread::sleep_for(ms(300)); int res; { - check_timer timer(ms(500)); + check_timer timer(ms(200 + BOOST_THREAD_TEST_TIME_MS)); res = f.get(); } BOOST_TEST(res == 3); @@ -241,7 +242,7 @@ int main() boost::this_thread::sleep_for(ms(300)); int res; { - check_timer timer(ms(500)); + check_timer timer(ms(200 + BOOST_THREAD_TEST_TIME_MS)); res = f.get(); } BOOST_TEST(res == 3); @@ -265,7 +266,7 @@ int main() boost::this_thread::sleep_for(ms(300)); int res; { - check_timer timer(ms(500)); + check_timer timer(ms(200 + BOOST_THREAD_TEST_TIME_MS)); res = f.get(); } BOOST_TEST(res == 3); @@ -289,7 +290,7 @@ int main() boost::this_thread::sleep_for(ms(300)); int res; { - check_timer timer(ms(500)); + check_timer timer(ms(200 + BOOST_THREAD_TEST_TIME_MS)); res = f.get(); } BOOST_TEST(res == 3); @@ -314,7 +315,7 @@ int main() //boost::this_thread::sleep_for(ms(300)); int res; { - check_timer timer(ms(500)); + check_timer timer(ms(200 + BOOST_THREAD_TEST_TIME_MS)); res = f.get(); } BOOST_TEST(res == 3); @@ -341,7 +342,7 @@ int main() boost::this_thread::sleep_for(ms(300)); int res; { - check_timer timer(ms(500)); + check_timer timer(ms(200 + BOOST_THREAD_TEST_TIME_MS)); res = f.get(); } BOOST_TEST(res == 3); @@ -366,7 +367,7 @@ int main() boost::this_thread::sleep_for(ms(300)); int res; { - check_timer timer(ms(500)); + check_timer timer(ms(200 + BOOST_THREAD_TEST_TIME_MS)); res = f.get(); } BOOST_TEST(res == 3); @@ -391,7 +392,7 @@ int main() boost::this_thread::sleep_for(ms(300)); int res; { - check_timer timer(ms(500)); + check_timer timer(ms(200 + BOOST_THREAD_TEST_TIME_MS)); res = f.get(); } BOOST_TEST(res == 3); @@ -415,7 +416,7 @@ int main() boost::this_thread::sleep_for(ms(300)); int res; { - check_timer timer(ms(500)); + check_timer timer(ms(200 + BOOST_THREAD_TEST_TIME_MS)); res = f.get(); } BOOST_TEST(res == 3); @@ -439,7 +440,7 @@ int main() boost::this_thread::sleep_for(ms(300)); int res; { - check_timer timer(ms(500)); + check_timer timer(ms(200 + BOOST_THREAD_TEST_TIME_MS)); res = f.get(); } BOOST_TEST(res == 3); @@ -463,7 +464,7 @@ int main() //boost::this_thread::sleep_for(ms(300)); int res; { - check_timer timer(ms(500)); + check_timer timer(ms(200 + BOOST_THREAD_TEST_TIME_MS)); res = f.get(); } BOOST_TEST(res == 3); @@ -487,7 +488,7 @@ int main() boost::this_thread::sleep_for(ms(300)); int* res; { - check_timer timer(ms(500)); + check_timer timer(ms(200 + BOOST_THREAD_TEST_TIME_MS)); res = &f.get(); } BOOST_TEST(res == &i); @@ -510,7 +511,7 @@ int main() boost::this_thread::sleep_for(ms(300)); int* res; { - check_timer timer(ms(500)); + check_timer timer(ms(200 + BOOST_THREAD_TEST_TIME_MS)); res = &f.get(); } BOOST_TEST(res == &i); @@ -533,7 +534,7 @@ int main() boost::this_thread::sleep_for(ms(300)); int* res; { - check_timer timer(ms(500)); + check_timer timer(ms(200 + BOOST_THREAD_TEST_TIME_MS)); res = &f.get(); } BOOST_TEST(res == &i); @@ -557,7 +558,7 @@ int main() //boost::this_thread::sleep_for(ms(300)); int* res; { - check_timer timer(ms(500)); + check_timer timer(ms(200 + BOOST_THREAD_TEST_TIME_MS)); res = &f.get(); } BOOST_TEST(res == &i); @@ -580,7 +581,7 @@ int main() boost::future f = boost::async(f2); boost::this_thread::sleep_for(ms(300)); { - check_timer timer(ms(500)); + check_timer timer(ms(200 + BOOST_THREAD_TEST_TIME_MS)); f.get(); } } @@ -601,7 +602,7 @@ int main() boost::future f = boost::async(boost::launch::async, f2); boost::this_thread::sleep_for(ms(300)); { - check_timer timer(ms(500)); + check_timer timer(ms(200 + BOOST_THREAD_TEST_TIME_MS)); f.get(); } } @@ -622,7 +623,7 @@ int main() boost::future f = boost::async(boost::launch::any, f2); boost::this_thread::sleep_for(ms(300)); { - check_timer timer(ms(500)); + check_timer timer(ms(200 + BOOST_THREAD_TEST_TIME_MS)); f.get(); } } @@ -644,7 +645,7 @@ int main() boost::future f = boost::async(boost::launch::deferred, f2); //boost::this_thread::sleep_for(ms(300)); { - check_timer timer(ms(500)); + check_timer timer(ms(200 + BOOST_THREAD_TEST_TIME_MS)); f.get(); } } @@ -668,7 +669,7 @@ int main() boost::this_thread::sleep_for(ms(300)); MoveOnly res; { - check_timer timer(ms(500)); + check_timer timer(ms(200 + BOOST_THREAD_TEST_TIME_MS)); res = f.get(); } BOOST_TEST_EQ(res.value, 2); @@ -692,7 +693,7 @@ int main() //boost::this_thread::sleep_for(ms(300)); MoveOnly res; { - check_timer timer(ms(500)); + check_timer timer(ms(200 + BOOST_THREAD_TEST_TIME_MS)); res = f.get(); } BOOST_TEST_EQ(res.value, 2); @@ -717,7 +718,7 @@ int main() boost::this_thread::sleep_for(ms(300)); MoveOnly res; { - check_timer timer(ms(500)); + check_timer timer(ms(200 + BOOST_THREAD_TEST_TIME_MS)); res = f.get(); } BOOST_TEST(res.value == 2); @@ -740,7 +741,7 @@ int main() boost::this_thread::sleep_for(ms(300)); boost::csbl::unique_ptr res; { - check_timer timer(ms(500)); + check_timer timer(ms(200 + BOOST_THREAD_TEST_TIME_MS)); res = f.get(); } BOOST_TEST(*res == 3); @@ -765,7 +766,7 @@ int main() boost::this_thread::sleep_for(ms(300)); boost::csbl::unique_ptr res; { - check_timer timer(ms(500)); + check_timer timer(ms(200 + BOOST_THREAD_TEST_TIME_MS)); res = f.get(); } BOOST_TEST(*res == 3); @@ -788,7 +789,7 @@ int main() //boost::this_thread::sleep_for(ms(300)); boost::csbl::unique_ptr res; { - check_timer timer(ms(500)); + check_timer timer(ms(200 + BOOST_THREAD_TEST_TIME_MS)); res = f.get(); } BOOST_TEST(*res == 3); @@ -811,7 +812,7 @@ int main() boost::this_thread::sleep_for(ms(300)); boost::csbl::unique_ptr res; { - check_timer timer(ms(500)); + check_timer timer(ms(200 + BOOST_THREAD_TEST_TIME_MS)); res = f.get(); } BOOST_TEST(*res == 3); @@ -837,7 +838,7 @@ int main() boost::this_thread::sleep_for(ms(300)); boost::csbl::unique_ptr res; { - check_timer timer(ms(500)); + check_timer timer(ms(200 + BOOST_THREAD_TEST_TIME_MS)); res = f.get(); } BOOST_TEST(*res == 3); @@ -860,7 +861,7 @@ int main() //boost::this_thread::sleep_for(ms(300)); boost::csbl::unique_ptr res; { - check_timer timer(ms(500)); + check_timer timer(ms(200 + BOOST_THREAD_TEST_TIME_MS)); res = f.get(); } BOOST_TEST(*res == 3); @@ -883,7 +884,7 @@ int main() boost::this_thread::sleep_for(ms(300)); boost::csbl::unique_ptr res; { - check_timer timer(ms(500)); + check_timer timer(ms(200 + BOOST_THREAD_TEST_TIME_MS)); res = f.get(); } BOOST_TEST(*res == 3); diff --git a/test/sync/mutual_exclusion/locks/unique_lock/cons/time_point_pass.cpp b/test/sync/mutual_exclusion/locks/unique_lock/cons/time_point_pass.cpp index 53358de6e..fc38e26e3 100644 --- a/test/sync/mutual_exclusion/locks/unique_lock/cons/time_point_pass.cpp +++ b/test/sync/mutual_exclusion/locks/unique_lock/cons/time_point_pass.cpp @@ -55,8 +55,8 @@ void f2() boost::unique_lock lk(m, Clock::now() + ms(250)); BOOST_TEST(lk.owns_lock() == false); t1 = Clock::now(); - ns d = t1 - t0 - ms(250); - BOOST_TEST(d < max_diff); + ms d = boost::chrono::duration_cast(t1 - t0) - ms(250); + BOOST_THREAD_TEST_IT(d, ns(max_diff)); } int main() diff --git a/test/sync/mutual_exclusion/sync_bounded_queue/multi_thread_pass.cpp b/test/sync/mutual_exclusion/sync_bounded_queue/multi_thread_pass.cpp index 9975a995a..f45ceff29 100644 --- a/test/sync/mutual_exclusion/sync_bounded_queue/multi_thread_pass.cpp +++ b/test/sync/mutual_exclusion/sync_bounded_queue/multi_thread_pass.cpp @@ -7,7 +7,7 @@ // class sync_queue -// push || pull; +// push_back || pull_front; #include #if ! defined BOOST_NO_CXX11_DECLTYPE @@ -35,7 +35,7 @@ struct call_push void operator()() { go_.count_down_and_wait(); - q_.push(42); + q_.push_back(42); } }; @@ -54,7 +54,7 @@ struct call_push_2 void operator()() { go_.count_down_and_wait(); - q_.push(42); + q_.push_back(42); end_.count_down_and_wait(); } @@ -73,7 +73,7 @@ struct call_pull int operator()() { go_.count_down_and_wait(); - return q_.pull(); + return q_.pull_front(); } }; @@ -93,7 +93,7 @@ void test_concurrent_push_and_pull_on_empty_queue() [&q,&go]() { go.wait(); - q.push(42); + q.push_back(42); } #else call_push(q,go) @@ -104,7 +104,7 @@ void test_concurrent_push_and_pull_on_empty_queue() [&q,&go]() -> int { go.wait(); - return q.pull(); + return q.pull_front(); } #else call_pull(q,go) @@ -136,7 +136,7 @@ void test_concurrent_push_on_empty_queue() [&q,&go]() { go.wait(); - q.push(42); + q.push_back(42); } #else call_push(q,go) @@ -148,7 +148,7 @@ void test_concurrent_push_on_empty_queue() BOOST_TEST(!q.empty()); for (unsigned int i =0; i< n; ++i) - BOOST_TEST_EQ(q.pull(), 42); + BOOST_TEST_EQ(q.pull_front(), 42); BOOST_TEST(q.empty()); } @@ -175,7 +175,7 @@ void test_concurrent_push_on_full_queue() [&q,&go,&end]() { go.wait(); - q.push(42); + q.push_back(42); end.wait(); } #else @@ -187,7 +187,7 @@ void test_concurrent_push_on_full_queue() BOOST_TEST(!q.empty()); BOOST_TEST(q.full()); for (unsigned int i =0; i< size; ++i) - BOOST_TEST_EQ(q.pull(), 42); + BOOST_TEST_EQ(q.pull_front(), 42); end.wait(); for (unsigned int i = 0; i < n; ++i) @@ -195,7 +195,7 @@ void test_concurrent_push_on_full_queue() BOOST_TEST(!q.empty()); for (unsigned int i =0; i< size; ++i) - BOOST_TEST_EQ(q.pull(), 42); + BOOST_TEST_EQ(q.pull_front(), 42); BOOST_TEST(q.empty()); } @@ -215,7 +215,7 @@ void test_concurrent_pull_on_queue() try { for (unsigned int i =0; i< n; ++i) - q.push(42); + q.push_back(42); for (unsigned int i =0; i< n; ++i) pull_done[i]=boost::async(boost::launch::async, @@ -223,7 +223,7 @@ void test_concurrent_pull_on_queue() [&q,&go]() -> int { go.wait(); - return q.pull(); + return q.pull_front(); } #else call_pull(q,go) diff --git a/test/test_condition_notify_all.cpp b/test/test_condition_notify_all.cpp index 17c84d5d5..eb3b51c88 100644 --- a/test/test_condition_notify_all.cpp +++ b/test/test_condition_notify_all.cpp @@ -5,11 +5,13 @@ #define BOOST_THREAD_VERSION 2 #define BOOST_TEST_MODULE Boost.Threads: condition_variable notify_all test suite +#include "timming.hpp" +#undef BOOST_TEST +#undef BOOST_ERROR #include - #include - #include +#include #include "./util.inl" #include "./condition_test_common.hpp" @@ -190,11 +192,11 @@ void do_test_notify_all_following_notify_one_wakes_all_threads() boost::this_thread::sleep(boost::posix_time::milliseconds(200)); multiple_wake_cond.notify_one(); multiple_wake_cond.notify_all(); - boost::this_thread::sleep(boost::posix_time::milliseconds(200)); + boost::this_thread::sleep(boost::posix_time::milliseconds(BOOST_THREAD_TEST_TIME_MS)); { boost::unique_lock lk(multiple_wake_mutex); - BOOST_CHECK(multiple_wake_count==3); + BOOST_CHECK_EQUAL(multiple_wake_count, (unsigned)3); } thread1.join(); diff --git a/test/test_condition_notify_one.cpp b/test/test_condition_notify_one.cpp index 00aff6268..781d735ab 100644 --- a/test/test_condition_notify_one.cpp +++ b/test/test_condition_notify_one.cpp @@ -7,6 +7,9 @@ #define BOOST_TEST_MODULE Boost.Threads: condition_variable notify_one test suite +#include "timming.hpp" +#undef BOOST_TEST +#undef BOOST_ERROR #include #include @@ -125,11 +128,11 @@ void do_test_multiple_notify_one_calls_wakes_multiple_threads() boost::this_thread::sleep(boost::posix_time::milliseconds(200)); multiple_wake_cond.notify_one(); multiple_wake_cond.notify_one(); - boost::this_thread::sleep(boost::posix_time::milliseconds(200)); + boost::this_thread::sleep(boost::posix_time::milliseconds(BOOST_THREAD_TEST_TIME_MS)); { boost::unique_lock lk(multiple_wake_mutex); - BOOST_CHECK(multiple_wake_count==3); + BOOST_CHECK_EQUAL(multiple_wake_count, 3); } thread1.join(); diff --git a/test/timming.hpp b/test/timming.hpp index 6ae320e8d..e1dbafa9a 100644 --- a/test/timming.hpp +++ b/test/timming.hpp @@ -14,7 +14,7 @@ #define BOOST_THREAD_TEST_TIME_MS 75 #else // Windows, Cygwin, macOS all need this -#define BOOST_THREAD_TEST_TIME_MS 250 +#define BOOST_THREAD_TEST_TIME_MS 500 #endif #endif