Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r85792 - trunk/libs/sync/test
From: andrey.semashev_at_[hidden]
Date: 2013-09-19 15:27:41


Author: andysem
Date: 2013-09-19 15:27:41 EDT (Thu, 19 Sep 2013)
New Revision: 85792
URL: http://svn.boost.org/trac/boost/changeset/85792

Log:
Removed use of the deprecated test_exec_monitor.

Text files modified:
   trunk/libs/sync/test/Jamfile.v2 | 16 ++++++++------
   trunk/libs/sync/test/event_test.cpp | 43 ++++++++++++---------------------------
   trunk/libs/sync/test/semaphore_test.cpp | 35 +++++++++-----------------------
   3 files changed, 32 insertions(+), 62 deletions(-)

Modified: trunk/libs/sync/test/Jamfile.v2
==============================================================================
--- trunk/libs/sync/test/Jamfile.v2 Thu Sep 19 13:58:24 2013 (r85791)
+++ trunk/libs/sync/test/Jamfile.v2 2013-09-19 15:27:41 EDT (Thu, 19 Sep 2013) (r85792)
@@ -3,16 +3,17 @@
 # (See accompanying file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
 
 import testing ;
-
-lib boost_unit_test_framework ;
-lib boost_thread ;
-lib boost_system ;
+import path ;
+import regex ;
 
 project
     : source-location .
     : requirements
+ <threading>multi
         <hardcode-dll-paths>true
- <library>../../test/build//boost_test_exec_monitor
+ <library>/boost/system//boost_system
+ <library>/boost/thread//boost_thread
+ <library>/boost/test//boost_unit_test_framework
     ;
 
 
@@ -22,12 +23,13 @@
 
    for local fileb in [ glob *.cpp ]
    {
+ local test_id = [ MATCH "(.+)\.cpp" : [ path.basename $(fileb) ] ] ;
+
       all_rules += [ run $(fileb)
       : # additional args
       : # test-files
       : # requirements
- <library>../../thread/build//boost_thread/
- <threading>multi
+ <define>BOOST_TEST_MODULE=$(test_id)
       ] ;
    }
 

Modified: trunk/libs/sync/test/event_test.cpp
==============================================================================
--- trunk/libs/sync/test/event_test.cpp Thu Sep 19 13:58:24 2013 (r85791)
+++ trunk/libs/sync/test/event_test.cpp 2013-09-19 15:27:41 EDT (Thu, 19 Sep 2013) (r85792)
@@ -10,7 +10,7 @@
 
 #include <boost/typeof/typeof.hpp>
 
-static void test_event_post_wait()
+BOOST_AUTO_TEST_CASE(test_event_post_wait)
 {
     boost::sync::event ev;
 
@@ -25,7 +25,7 @@
 }
 
 
-static void test_event_post_try_wait()
+BOOST_AUTO_TEST_CASE(test_event_post_try_wait)
 {
     boost::sync::event ev;
 
@@ -36,7 +36,7 @@
     BOOST_REQUIRE( ev.try_wait() == true );
 }
 
-static void test_event_post_wait_autoreset()
+BOOST_AUTO_TEST_CASE(test_event_post_wait_autoreset)
 {
     boost::sync::event ev(true);
 
@@ -46,7 +46,7 @@
 }
 
 
-static void test_event_reset()
+BOOST_AUTO_TEST_CASE(test_event_reset)
 {
     boost::sync::event ev(false);
 
@@ -71,17 +71,18 @@
         ev_.post();
     }
 
- static void run_test()
- {
- event_wait_and_post_test test;
- test.run();
- }
-
     boost::sync::event ev_;
     boost::thread thread_;
 };
 
-static void test_event_wait_for()
+BOOST_AUTO_TEST_CASE(event_wait_and_post)
+{
+ event_wait_and_post_test test;
+ test.run();
+}
+
+
+BOOST_AUTO_TEST_CASE(test_event_wait_for)
 {
     using namespace boost;
 
@@ -108,7 +109,7 @@
     BOOST_REQUIRE(ev.try_wait_for(chrono::milliseconds(500)));
 }
 
-static void test_event_wait_until()
+BOOST_AUTO_TEST_CASE(test_event_wait_until)
 {
     using namespace boost;
 
@@ -141,21 +142,3 @@
         BOOST_REQUIRE( (end - start) < chrono::milliseconds(100) );
     }
 }
-
-boost::unit_test::test_suite* init_unit_test_suite(int, char*[])
-{
- boost::unit_test::test_suite* test = BOOST_TEST_SUITE("boost::sync::event test suite");
-
- test->add(BOOST_TEST_CASE(test_event_post_wait));
- test->add(BOOST_TEST_CASE(test_event_post_wait_autoreset));
- test->add(BOOST_TEST_CASE(test_event_post_try_wait));
- test->add(BOOST_TEST_CASE(test_event_reset));
-
- test->add(BOOST_TEST_CASE(event_wait_and_post_test::run_test));
-
- test->add(BOOST_TEST_CASE(test_event_wait_for));
- test->add(BOOST_TEST_CASE(test_event_wait_until));
-
- return test;
-}
-

Modified: trunk/libs/sync/test/semaphore_test.cpp
==============================================================================
--- trunk/libs/sync/test/semaphore_test.cpp Thu Sep 19 13:58:24 2013 (r85791)
+++ trunk/libs/sync/test/semaphore_test.cpp 2013-09-19 15:27:41 EDT (Thu, 19 Sep 2013) (r85792)
@@ -10,7 +10,7 @@
 
 #include <boost/typeof/typeof.hpp>
 
-static void test_semaphore_post_wait()
+BOOST_AUTO_TEST_CASE(test_semaphore_post_wait)
 {
     boost::sync::semaphore sem(0);
 
@@ -19,7 +19,7 @@
 }
 
 
-static void test_semaphore_try_wait()
+BOOST_AUTO_TEST_CASE(test_semaphore_try_wait)
 {
     boost::sync::semaphore sem(0);
 
@@ -43,19 +43,19 @@
         sem_.post();
     }
 
- static void run_test()
- {
- semaphore_wait_and_post_test test;
- test.run();
- }
-
     boost::sync::semaphore sem_;
     boost::thread thread_;
 };
 
+BOOST_AUTO_TEST_CASE(semaphore_wait_and_post)
+{
+ semaphore_wait_and_post_test test;
+ test.run();
+}
+
 #ifdef BOOST_SYNC_USES_CHRONO
 
-static void test_semaphore_wait_for()
+BOOST_AUTO_TEST_CASE(test_semaphore_wait_for)
 {
     using namespace boost;
 
@@ -77,7 +77,7 @@
     BOOST_REQUIRE(sem.try_wait_for(chrono::milliseconds(500)));
 }
 
-static void test_semaphore_wait_until()
+BOOST_AUTO_TEST_CASE(test_semaphore_wait_until)
 {
     using namespace boost;
 
@@ -111,18 +111,3 @@
     }
 }
 #endif
-
-boost::unit_test::test_suite* init_unit_test_suite(int, char*[])
-{
- boost::unit_test::test_suite* test = BOOST_TEST_SUITE("Boost.Threads: semaphore test suite");
-
- test->add(BOOST_TEST_CASE(test_semaphore_post_wait));
- test->add(BOOST_TEST_CASE(test_semaphore_try_wait));
- test->add(BOOST_TEST_CASE(semaphore_wait_and_post_test::run_test));
-
-#ifdef BOOST_SYNC_USES_CHRONO
- test->add(BOOST_TEST_CASE(test_semaphore_wait_for));
- test->add(BOOST_TEST_CASE(test_semaphore_wait_until));
-#endif
- return test;
-}


Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk