[complement-svn] SF.net SVN: complement: [1758] trunk/complement/explore
Status: Pre-Alpha
Brought to you by:
complement
From: <com...@us...> - 2007-10-05 17:28:46
|
Revision: 1758 http://complement.svn.sourceforge.net/complement/?rev=1758&view=rev Author: complement Date: 2007-10-05 10:28:42 -0700 (Fri, 05 Oct 2007) Log Message: ----------- test may throw skip_exception to signal that it skipped Modified Paths: -------------- trunk/complement/explore/include/exam/suite.h trunk/complement/explore/lib/exam/ChangeLog trunk/complement/explore/lib/exam/Makefile.inc trunk/complement/explore/lib/exam/suite.cc trunk/complement/explore/lib/janus/ut/vt_operations.cc trunk/complement/explore/lib/janus/ut/vt_operations.h trunk/complement/explore/lib/janus/ut/vt_remote.cc Modified: trunk/complement/explore/include/exam/suite.h =================================================================== --- trunk/complement/explore/include/exam/suite.h 2007-10-05 10:01:09 UTC (rev 1757) +++ trunk/complement/explore/include/exam/suite.h 2007-10-05 17:28:42 UTC (rev 1758) @@ -159,6 +159,11 @@ { }; +class skip_exception : + public std::exception +{ +}; + class test_suite { private: Modified: trunk/complement/explore/lib/exam/ChangeLog =================================================================== --- trunk/complement/explore/lib/exam/ChangeLog 2007-10-05 10:01:09 UTC (rev 1757) +++ trunk/complement/explore/lib/exam/ChangeLog 2007-10-05 17:28:42 UTC (rev 1758) @@ -1,3 +1,10 @@ +2007-10-05 Petr Ovtchenkov <pt...@is...> + + * suite.h, suite.cc: test may throw skip_exception to signal + that it skipped. + + * libexam: version 0.4.0. + 2007-09-07 Petr Ovtchenkov <pt...@is...> * suite.h: added macro EXAM_CHECK_ASYNC_F, EXAM_ERROR_ASYNC_F Modified: trunk/complement/explore/lib/exam/Makefile.inc =================================================================== --- trunk/complement/explore/lib/exam/Makefile.inc 2007-10-05 10:01:09 UTC (rev 1757) +++ trunk/complement/explore/lib/exam/Makefile.inc 2007-10-05 17:28:42 UTC (rev 1758) @@ -2,6 +2,6 @@ LIBNAME = exam MAJOR = 0 -MINOR = 3 +MINOR = 4 PATCH = 0 SRC_CC = logger.cc suite.cc Modified: trunk/complement/explore/lib/exam/suite.cc =================================================================== --- trunk/complement/explore/lib/exam/suite.cc 2007-10-05 10:01:09 UTC (rev 1757) +++ trunk/complement/explore/lib/exam/suite.cc 2007-10-05 17:28:42 UTC (rev 1758) @@ -245,6 +245,14 @@ local_logger->tc( base_logger::skip, _test[v].name ); } } + catch ( skip_exception& ) { + _lock_ll.lock(); + local_logger->tc_break(); + _lock_ll.unlock(); + ++_stat.skipped; + scoped_lock lk( _lock_ll ); + local_logger->tc( base_logger::skip, _test[v].name ); + } catch ( init_exception& ) { _lock_ll.lock(); local_logger->tc_break(); Modified: trunk/complement/explore/lib/janus/ut/vt_operations.cc =================================================================== --- trunk/complement/explore/lib/janus/ut/vt_operations.cc 2007-10-05 10:01:09 UTC (rev 1757) +++ trunk/complement/explore/lib/janus/ut/vt_operations.cc 2007-10-05 17:28:42 UTC (rev 1758) @@ -9,6 +9,29 @@ using namespace std; +vtime_operations::vtime_operations() : + fname( "/tmp/yanus_test.shm" ) +{ + try { + seg.allocate( fname, 4*4096, xmt::shm_base::create | xmt::shm_base::exclusive, 0600 ); + b2 = new ( shm_b.allocate( 1 ) ) xmt::__barrier<true>(); + } + catch ( const xmt::shm_bad_alloc& err ) { + b2 = 0; + // err.what(); + } +} + +vtime_operations::~vtime_operations() +{ + if ( b2 ) { + b2->~__barrier<true>(); + shm_b.deallocate( b2, 1 ); + } + seg.deallocate(); + unlink( fname ); +} + int EXAM_IMPL(vtime_operations::vt_compare) { const oid_type t0(0); Modified: trunk/complement/explore/lib/janus/ut/vt_operations.h =================================================================== --- trunk/complement/explore/lib/janus/ut/vt_operations.h 2007-10-05 10:01:09 UTC (rev 1757) +++ trunk/complement/explore/lib/janus/ut/vt_operations.h 2007-10-05 17:28:42 UTC (rev 1758) @@ -4,36 +4,49 @@ #define __vt_operations_h #include <exam/suite.h> +#include <mt/xmt.h> +#include <mt/shm.h> namespace janus { -struct vtime_operations +class vtime_operations { - int EXAM_DECL(vt_compare); - int EXAM_DECL(vt_add); - int EXAM_DECL(vt_diff); - int EXAM_DECL(vt_max); + public: + vtime_operations(); + ~vtime_operations(); - int EXAM_DECL(gvt_add); + int EXAM_DECL(vt_compare); + int EXAM_DECL(vt_add); + int EXAM_DECL(vt_diff); + int EXAM_DECL(vt_max); - int EXAM_DECL(VTMess_core); + int EXAM_DECL(gvt_add); - int EXAM_DECL(vt_object); + int EXAM_DECL(VTMess_core); - int EXAM_DECL(VTDispatch1); - int EXAM_DECL(VTDispatch2); + int EXAM_DECL(vt_object); - int EXAM_DECL(VTHandler1); - int EXAM_DECL(VTHandler2); + int EXAM_DECL(VTDispatch1); + int EXAM_DECL(VTDispatch2); - int EXAM_DECL(VTSubscription); - int EXAM_DECL(VTEntryIntoGroup); - int EXAM_DECL(VTEntryIntoGroup2); - int EXAM_DECL(VTEntryIntoGroup3); + int EXAM_DECL(VTHandler1); + int EXAM_DECL(VTHandler2); - int EXAM_DECL(remote); - int EXAM_DECL(mgroups); - int EXAM_DECL(wellknownhost); + int EXAM_DECL(VTSubscription); + int EXAM_DECL(VTEntryIntoGroup); + int EXAM_DECL(VTEntryIntoGroup2); + int EXAM_DECL(VTEntryIntoGroup3); + + int EXAM_DECL(remote); + int EXAM_DECL(mgroups); + int EXAM_DECL(wellknownhost); + + private: + const char *fname; + xmt::shm_alloc<0> seg; + xmt::allocator_shm<xmt::__condition<true>,0> shm_cnd; + xmt::allocator_shm<xmt::__barrier<true>,0> shm_b; + xmt::__barrier<true> *b2; }; } // namespace janus Modified: trunk/complement/explore/lib/janus/ut/vt_remote.cc =================================================================== --- trunk/complement/explore/lib/janus/ut/vt_remote.cc 2007-10-05 10:01:09 UTC (rev 1757) +++ trunk/complement/explore/lib/janus/ut/vt_remote.cc 2007-10-05 17:28:42 UTC (rev 1758) @@ -179,21 +179,24 @@ int EXAM_IMPL(vtime_operations::remote) { - const char fname[] = "/tmp/yanus_test.shm"; - xmt::shm_alloc<0> seg; - xmt::allocator_shm<xmt::__condition<true>,0> shm_cnd; - xmt::allocator_shm<xmt::__barrier<true>,0> shm_b; + if ( b2 == 0 ) { + throw exam::skip_exception(); + } + // const char fname[] = "/tmp/yanus_test.shm"; + // xmt::shm_alloc<0> seg; + // xmt::allocator_shm<xmt::__condition<true>,0> shm_cnd; + // xmt::allocator_shm<xmt::__barrier<true>,0> shm_b; try { - seg.allocate( fname, 4*4096, xmt::shm_base::create | xmt::shm_base::exclusive, 0600 ); - xmt::__barrier<true>& b = *new ( shm_b.allocate( 1 ) ) xmt::__barrier<true>(); + // seg.allocate( fname, 4*4096, xmt::shm_base::create | xmt::shm_base::exclusive, 0600 ); + // xmt::__barrier<true>& b = *new ( shm_b.allocate( 1 ) ) xmt::__barrier<true>(); try { xmt::fork(); long res_flag = 0; - b.wait(); + b2->wait(); { VTHandler obj0; // this need to keep VSHostMgr after YaRemote exit @@ -264,7 +267,7 @@ obj1.JoinGroup( janus::vs_base::first_user_group ); - b.wait(); + b2->wait(); // while ( obj1.vtdispatcher()->vs_known_processes() < 2 ) { // xmt::delay( xmt::timespec( 0, 1000000 ) ); @@ -299,36 +302,39 @@ EXAM_CHECK( obj1.ocount == 1 ); } - (&b)->~__barrier<true>(); - shm_b.deallocate( &b, 1 ); + // (&b)->~__barrier<true>(); + // shm_b.deallocate( &b, 1 ); } catch ( const xmt::shm_bad_alloc& err ) { EXAM_ERROR( err.what() ); } - seg.deallocate(); - unlink( fname ); + // seg.deallocate(); + // unlink( fname ); return EXAM_RESULT; } int EXAM_IMPL(vtime_operations::mgroups) { - const char fname[] = "/tmp/yanus_test.shm"; - xmt::shm_alloc<0> seg; - xmt::allocator_shm<xmt::__condition<true>,0> shm_cnd; - xmt::allocator_shm<xmt::__barrier<true>,0> shm_b; + if ( b2 == 0 ) { + throw exam::skip_exception(); + } + // const char fname[] = "/tmp/yanus_test.shm"; + // xmt::shm_alloc<0> seg; + // xmt::allocator_shm<xmt::__condition<true>,0> shm_cnd; + // xmt::allocator_shm<xmt::__barrier<true>,0> shm_b; try { - seg.allocate( fname, 4*4096, xmt::shm_base::create | xmt::shm_base::exclusive, 0600 ); - xmt::__barrier<true>& b = *new ( shm_b.allocate( 1 ) ) xmt::__barrier<true>(); + // seg.allocate( fname, 4*4096, xmt::shm_base::create | xmt::shm_base::exclusive, 0600 ); + // xmt::__barrier<true>& b = *new ( shm_b.allocate( 1 ) ) xmt::__barrier<true>(); try { xmt::fork(); long res_flag = 0; - b.wait(); + b2->wait(); { VTHandler obj0; // this need to keep VSHostMgr after YaRemote exit @@ -379,7 +385,7 @@ obj1.JoinGroup( janus::vs_base::first_user_group ); obj1.JoinGroup( janus::vs_base::first_user_group + 1); - b.wait(); + b2->wait(); obj1.wait_greeting(); obj1.wait_greeting2(); @@ -414,29 +420,33 @@ cerr << obj1.ocount << endl; } - (&b)->~__barrier<true>(); - shm_b.deallocate( &b, 1 ); + // (&b)->~__barrier<true>(); + // shm_b.deallocate( &b, 1 ); } catch ( const xmt::shm_bad_alloc& err ) { EXAM_ERROR( err.what() ); } - seg.deallocate(); - unlink( fname ); + // seg.deallocate(); + // unlink( fname ); return EXAM_RESULT; } int EXAM_IMPL(vtime_operations::wellknownhost) { - const char fname[] = "/tmp/yanus_test.shm"; - xmt::shm_alloc<0> seg; - xmt::allocator_shm<xmt::__condition<true>,0> shm_cnd; - xmt::allocator_shm<xmt::__barrier<true>,0> shm_b; + if ( b2 == 0 ) { + throw exam::skip_exception(); + } + // const char fname[] = "/tmp/yanus_test.shm"; + // xmt::shm_alloc<0> seg; + // xmt::allocator_shm<xmt::__condition<true>,0> shm_cnd; + // xmt::allocator_shm<xmt::__barrier<true>,0> shm_b; + try { - seg.allocate( fname, 4*4096, xmt::shm_base::create | xmt::shm_base::exclusive, 0600 ); - xmt::__barrier<true>& b = *new ( shm_b.allocate( 1 ) ) xmt::__barrier<true>(); + // seg.allocate( fname, 4*4096, xmt::shm_base::create | xmt::shm_base::exclusive, 0600 ); + // xmt::__barrier<true>& b = *new ( shm_b.allocate( 1 ) ) xmt::__barrier<true>(); VSHostMgr::add_wellknown( "localhost:6980" ); VSHostMgr::add_srvport( 6980 ); @@ -446,7 +456,7 @@ long res_flag = 0; - b.wait(); + b2->wait(); { YaRemote obj1( "obj client" ); @@ -468,7 +478,7 @@ obj1.JoinGroup( janus::vs_base::first_user_group ); - b.wait(); + b2->wait(); // while ( obj1.vtdispatcher()->vs_known_processes() < 2 ) { // xmt::delay( xmt::timespec( 0, 1000000 ) ); @@ -502,15 +512,15 @@ // cerr << obj1.vtdispatcher()->vs_known_processes() << endl; } - (&b)->~__barrier<true>(); - shm_b.deallocate( &b, 1 ); + // (&b)->~__barrier<true>(); + // shm_b.deallocate( &b, 1 ); } catch ( const xmt::shm_bad_alloc& err ) { EXAM_ERROR( err.what() ); } - seg.deallocate(); - unlink( fname ); + // seg.deallocate(); + // unlink( fname ); return EXAM_RESULT; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |