Thread: [complement-svn] SF.net SVN: complement: [1463] trunk/complement/explore/test/mt/mt_test.cc
Status: Pre-Alpha
Brought to you by:
complement
From: <com...@us...> - 2006-12-26 16:32:33
|
Revision: 1463 http://svn.sourceforge.net/complement/?rev=1463&view=rev Author: complement Date: 2006-12-26 08:32:32 -0800 (Tue, 26 Dec 2006) Log Message: ----------- check more deallocation sequences Modified Paths: -------------- trunk/complement/explore/test/mt/mt_test.cc Modified: trunk/complement/explore/test/mt/mt_test.cc =================================================================== --- trunk/complement/explore/test/mt/mt_test.cc 2006-12-26 16:13:00 UTC (rev 1462) +++ trunk/complement/explore/test/mt/mt_test.cc 2006-12-26 16:32:32 UTC (rev 1463) @@ -226,34 +226,59 @@ { xmt::allocator_shm<char,0> shmall; size_t sz = shmall.max_size(); + // two blocks char *ch1 = shmall.allocate( 3500 ); BOOST_CHECK( ch1 != 0 ); char *ch2 = shmall.allocate( 3500 ); BOOST_CHECK( ch2 != 0 ); try { + // try to allocate third block, not enough room char *ch3 = shmall.allocate( 8 * 1024 - 7000 ); BOOST_CHECK( false ); } catch ( xmt::shm_bad_alloc& err ) { BOOST_CHECK( true ); } + // free first blocks shmall.deallocate( ch1, 3500 ); ch1 = shmall.allocate( 3500 ); + // allocate [first] block again BOOST_CHECK( ch1 != 0 ); + // free second block shmall.deallocate( ch2, 3500 ); + // allocate [second] block again ch2 = shmall.allocate( 3500 ); BOOST_CHECK( ch2 != 0 ); + // free both blocks shmall.deallocate( ch1, 3500 ); shmall.deallocate( ch2, 3500 ); + // allocate big block, enough for initial memory chunk ch1 = shmall.allocate( 7000 ); BOOST_CHECK( ch1 != 0 ); + // free it shmall.deallocate( ch1, 7000 ); + // allocate block of maximum size ch1 = shmall.allocate( sz ); BOOST_CHECK( ch1 != 0 ); + // free it shmall.deallocate( ch1, sz ); + // allocate block, enough for initial memory chunk ch1 = shmall.allocate( 7000 ); BOOST_CHECK( ch1 != 0 ); + // free it shmall.deallocate( ch1, 7000 ); + ch1 = shmall.allocate( 3000 ); + BOOST_CHECK( ch1 != 0 ); + ch2 = shmall.allocate( 400 ); + BOOST_CHECK( ch2 != 0 ); + char *ch3 = shmall.allocate( 3500 ); + BOOST_CHECK( ch3 != 0 ); + shmall.deallocate( ch1, 3000 ); + shmall.deallocate( ch2, 400 ); + shmall.deallocate( ch3, 3500 ); + ch1 = shmall.allocate( sz ); + BOOST_CHECK( ch1 != 0 ); + shmall.deallocate( ch1, sz ); } seg.deallocate(); fs::remove( fname ); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <com...@us...> - 2007-02-06 10:47:45
|
Revision: 1511 http://svn.sourceforge.net/complement/?rev=1511&view=rev Author: complement Date: 2007-02-06 02:47:44 -0800 (Tue, 06 Feb 2007) Log Message: ----------- one yield may be not enough on hi-end SMP Modified Paths: -------------- trunk/complement/explore/test/mt/mt_test.cc Modified: trunk/complement/explore/test/mt/mt_test.cc =================================================================== --- trunk/complement/explore/test/mt/mt_test.cc 2007-02-06 10:13:58 UTC (rev 1510) +++ trunk/complement/explore/test/mt/mt_test.cc 2007-02-06 10:47:44 UTC (rev 1511) @@ -158,7 +158,9 @@ { xmt::Barrier& b = *reinterpret_cast<xmt::Barrier *>(p); b.wait(); - xmt::Thread::yield(); + for ( int i = 0; i < 128; ++i ) { + xmt::Thread::yield(); + } m1.lock(); BOOST_CHECK( x == 1 ); @@ -223,7 +225,9 @@ { xmt::Barrier& b = *reinterpret_cast<xmt::Barrier *>(p); b.wait(); - xmt::Thread::yield(); + for ( int i = 0; i < 128; ++i ) { + xmt::Thread::yield(); + } sl1.lock(); BOOST_CHECK( x == 1 ); @@ -325,7 +329,9 @@ xmt::Barrier& b = *reinterpret_cast<xmt::Barrier *>(p); b.wait(); - xmt::Thread::yield(); + for ( int i = 0; i < 128; ++i ) { + xmt::Thread::yield(); + } m2.lock(); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <com...@us...> - 2007-03-12 18:26:13
|
Revision: 1554 http://svn.sourceforge.net/complement/?rev=1554&view=rev Author: complement Date: 2007-03-12 11:26:06 -0700 (Mon, 12 Mar 2007) Log Message: ----------- catch error (exception) here Modified Paths: -------------- trunk/complement/explore/test/mt/mt_test.cc Modified: trunk/complement/explore/test/mt/mt_test.cc =================================================================== --- trunk/complement/explore/test/mt/mt_test.cc 2007-03-12 18:25:09 UTC (rev 1553) +++ trunk/complement/explore/test/mt/mt_test.cc 2007-03-12 18:26:06 UTC (rev 1554) @@ -1,4 +1,4 @@ -// -*- C++ -*- Time-stamp: <07/02/19 14:36:01 ptr> +// -*- C++ -*- Time-stamp: <07/03/12 20:39:47 ptr> /* * Copyright (c) 2006, 2007 @@ -803,12 +803,16 @@ try { xmt::fork(); - xmt::shm_name_mgr<1>& nm_ch = seg1.name_mgr(); - xmt::allocator_shm<xmt::__Condition<true>,1> shm_ch; - xmt::__Condition<true>& fcnd_ch = nm_ch.named<xmt::__Condition<true> >( ObjName ); - fcnd_ch.set( true ); - nm_ch.release<xmt::__Condition<true> >( ObjName ); - + try { + xmt::shm_name_mgr<1>& nm_ch = seg1.name_mgr(); + xmt::allocator_shm<xmt::__Condition<true>,1> shm_ch; + xmt::__Condition<true>& fcnd_ch = nm_ch.named<xmt::__Condition<true> >( ObjName ); + fcnd_ch.set( true ); + nm_ch.release<xmt::__Condition<true> >( ObjName ); + } + catch ( const std::invalid_argument& err ) { + BOOST_CHECK_MESSAGE( false, "error report: " << err.what() ); + } exit( 0 ); } catch ( xmt::fork_in_parent& child ) { @@ -825,12 +829,17 @@ try { xmt::fork(); - xmt::shm_name_mgr<1>& nm_ch = seg1.name_mgr(); - xmt::allocator_shm<xmt::__Condition<true>,1> shm_ch; - xmt::__Condition<true>& fcnd_ch = nm_ch.named<xmt::__Condition<true> >( ObjName ); - fcnd_ch.set( true ); - nm_ch.release<xmt::__Condition<true> >( ObjName ); - + try { + xmt::shm_name_mgr<1>& nm_ch = seg1.name_mgr(); + xmt::allocator_shm<xmt::__Condition<true>,1> shm_ch; + xmt::__Condition<true>& fcnd_ch = nm_ch.named<xmt::__Condition<true> >( ObjName ); + fcnd_ch.set( true ); + nm_ch.release<xmt::__Condition<true> >( ObjName ); + } + catch ( const std::invalid_argument& err ) { + BOOST_CHECK_MESSAGE( false, "error report: " << err.what() ); + } + exit( 0 ); } catch ( xmt::fork_in_parent& child ) { @@ -848,11 +857,16 @@ try { xmt::fork(); - xmt::shm_name_mgr<1>& nm_ch = seg1.name_mgr(); - xmt::allocator_shm<xmt::__Barrier<true>,1> shm_ch; - xmt::__Barrier<true>& b_ch = nm_ch.named<xmt::__Barrier<true> >( ObjName ); - b_ch.wait(); - nm_ch.release<xmt::__Barrier<true> >( ObjName ); + try { + xmt::shm_name_mgr<1>& nm_ch = seg1.name_mgr(); + xmt::allocator_shm<xmt::__Barrier<true>,1> shm_ch; + xmt::__Barrier<true>& b_ch = nm_ch.named<xmt::__Barrier<true> >( ObjName ); + b_ch.wait(); + nm_ch.release<xmt::__Barrier<true> >( ObjName ); + } + catch ( const std::invalid_argument& err ) { + BOOST_CHECK_MESSAGE( false, "error report: " << err.what() ); + } exit( 0 ); } @@ -866,6 +880,9 @@ catch ( xmt::shm_bad_alloc& err ) { BOOST_CHECK_MESSAGE( false, "error report: " << err.what() ); } + catch ( const std::invalid_argument& err ) { + BOOST_CHECK_MESSAGE( false, "error report: " << err.what() ); + } } /* ****************************************************** This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <com...@us...> - 2007-07-23 12:17:24
|
Revision: 1637 http://svn.sourceforge.net/complement/?rev=1637&view=rev Author: complement Date: 2007-07-23 05:17:18 -0700 (Mon, 23 Jul 2007) Log Message: ----------- fix test, due to check fail on STLP_DEBUG on Athlon64x2 Modified Paths: -------------- trunk/complement/explore/test/mt/mt_test.cc Modified: trunk/complement/explore/test/mt/mt_test.cc =================================================================== --- trunk/complement/explore/test/mt/mt_test.cc 2007-07-23 11:55:46 UTC (rev 1636) +++ trunk/complement/explore/test/mt/mt_test.cc 2007-07-23 12:17:18 UTC (rev 1637) @@ -89,7 +89,8 @@ xmt::Thread t1( thread2_entry_call, &b ); xmt::Thread t2( thread2_entry_call, &b ); - EXAM_CHECK( (t2.join().iword + t1.join().iword) == 2 ); + EXAM_CHECK( t2.join().iword == 1 ); + EXAM_CHECK( t1.join().iword == 1 ); return EXAM_RESULT; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |