Thread: [complement-svn] SF.net SVN: complement: [1450] trunk/complement/explore/test
Status: Pre-Alpha
Brought to you by:
complement
From: <com...@us...> - 2006-12-14 07:07:30
|
Revision: 1450 http://svn.sourceforge.net/complement/?rev=1450&view=rev Author: complement Date: 2006-12-13 23:07:29 -0800 (Wed, 13 Dec 2006) Log Message: ----------- move mt unit tests Modified Paths: -------------- trunk/complement/explore/test/mt/Makefile trunk/complement/explore/test/mt/unit_test.cc Added Paths: ----------- trunk/complement/explore/test/mt/ Removed Paths: ------------- trunk/complement/explore/test/libmt/delay/ trunk/complement/explore/test/libmt/join/ trunk/complement/explore/test/libmt/signal-1/ trunk/complement/explore/test/libmt/signal-2/ trunk/complement/explore/test/libmt/unit/ Copied: trunk/complement/explore/test/mt (from rev 1448, trunk/complement/explore/test/libmt/unit) Modified: trunk/complement/explore/test/mt/Makefile =================================================================== --- trunk/complement/explore/test/libmt/unit/Makefile 2006-12-13 18:32:33 UTC (rev 1448) +++ trunk/complement/explore/test/mt/Makefile 2006-12-14 07:07:29 UTC (rev 1450) @@ -1,6 +1,6 @@ # -*- Makefile -*- Time-stamp: <06/08/04 10:54:19 ptr> -SRCROOT := ../../.. +SRCROOT := ../.. COMPILER_NAME := gcc include Makefile.inc Modified: trunk/complement/explore/test/mt/unit_test.cc =================================================================== --- trunk/complement/explore/test/libmt/unit/unit_test.cc 2006-12-13 18:32:33 UTC (rev 1448) +++ trunk/complement/explore/test/mt/unit_test.cc 2006-12-14 07:07:29 UTC (rev 1450) @@ -1,30 +1,13 @@ -// -*- C++ -*- Time-stamp: <04/08/31 23:07:30 ptr> +// -*- C++ -*- Time-stamp: <06/12/14 10:01:14 ptr> /* - * - * Copyright (c) 2002, 2003, 2004 + * Copyright (c) 2002, 2003, 2004, 2006 * Petr Ovtchenkov * - * Licensed under the Academic Free License Version 2.0 + * Licensed under the Academic Free License Version 3.0 * - * This material is provided "as is", with absolutely no warranty expressed - * or implied. Any use is at your own risk. - * - * Permission to use, copy, modify, distribute and sell this software - * and its documentation for any purpose is hereby granted without fee, - * provided that the above copyright notice appear in all copies and - * that both that copyright notice and this permission notice appear - * in supporting documentation. */ -#ifdef __unix -# ifdef __HP_aCC -#pragma VERSIONID "@(#)$Id$" -# else -#ident "@(#)$Id$" -# endif -#endif - #include <boost/test/unit_test.hpp> #include <config/feature.h> @@ -62,8 +45,10 @@ // (stack saved/restored, that confuse stack unwind); // by this reason next test is commented: // ts->add( BOOST_TEST_CASE( &signal_2_test ) ); - ts->add( BOOST_TEST_CASE( &flock_test ) ); - ts->add( BOOST_TEST_CASE( &lfs_test ) ); + // flock requre revision, commented now. + // ts->add( BOOST_TEST_CASE( &flock_test ) ); + // ts->add( BOOST_TEST_CASE( &lfs_test ) ); + return ts; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <com...@us...> - 2006-12-14 07:18:12
|
Revision: 1451 http://svn.sourceforge.net/complement/?rev=1451&view=rev Author: complement Date: 2006-12-13 23:18:11 -0800 (Wed, 13 Dec 2006) Log Message: ----------- move sockios Modified Paths: -------------- trunk/complement/explore/test/sockios/Makefile Added Paths: ----------- trunk/complement/explore/test/sockios/ Removed Paths: ------------- trunk/complement/explore/test/libsockios/ Copied: trunk/complement/explore/test/sockios (from rev 1448, trunk/complement/explore/test/libsockios/unit) Modified: trunk/complement/explore/test/sockios/Makefile =================================================================== --- trunk/complement/explore/test/libsockios/unit/Makefile 2006-12-13 18:32:33 UTC (rev 1448) +++ trunk/complement/explore/test/sockios/Makefile 2006-12-14 07:18:11 UTC (rev 1451) @@ -1,6 +1,6 @@ # -*- Makefile -*- Time-stamp: <03/08/15 12:46:45 ptr> -SRCROOT := ../../.. +SRCROOT := ../.. COMPILER_NAME := gcc include Makefile.inc This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <com...@us...> - 2006-12-14 07:27:45
|
Revision: 1452 http://svn.sourceforge.net/complement/?rev=1452&view=rev Author: complement Date: 2006-12-13 23:27:44 -0800 (Wed, 13 Dec 2006) Log Message: ----------- move stem Modified Paths: -------------- trunk/complement/explore/test/stem/Makefile trunk/complement/explore/test/stem/dl/Makefile Added Paths: ----------- trunk/complement/explore/test/stem/ Removed Paths: ------------- trunk/complement/explore/test/libstem/ Copied: trunk/complement/explore/test/stem (from rev 1448, trunk/complement/explore/test/libstem/unit) Modified: trunk/complement/explore/test/stem/Makefile =================================================================== --- trunk/complement/explore/test/libstem/unit/Makefile 2006-12-13 18:32:33 UTC (rev 1448) +++ trunk/complement/explore/test/stem/Makefile 2006-12-14 07:27:44 UTC (rev 1452) @@ -1,6 +1,6 @@ # -*- Makefile -*- Time-stamp: <06/12/13 01:07:22 ptr> -SRCROOT := ../../.. +SRCROOT := ../.. COMPILER_NAME := gcc EXTRA_POST := dl Modified: trunk/complement/explore/test/stem/dl/Makefile =================================================================== --- trunk/complement/explore/test/libstem/unit/dl/Makefile 2006-12-13 18:32:33 UTC (rev 1448) +++ trunk/complement/explore/test/stem/dl/Makefile 2006-12-14 07:27:44 UTC (rev 1452) @@ -1,6 +1,6 @@ # -*- Makefile -*- Time-stamp: <06/08/04 12:09:33 ptr> -SRCROOT := ../../../.. +SRCROOT := ../../.. COMPILER_NAME := gcc include Makefile.inc This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <com...@us...> - 2006-12-18 13:04:04
|
Revision: 1459 http://svn.sourceforge.net/complement/?rev=1459&view=rev Author: complement Date: 2006-12-18 05:04:02 -0800 (Mon, 18 Dec 2006) Log Message: ----------- clean tests for signal catchers; add test for block/unblock signal Modified Paths: -------------- trunk/complement/explore/test/mt/Makefile.inc trunk/complement/explore/test/mt/signal-1.cc trunk/complement/explore/test/mt/unit_test.cc Added Paths: ----------- trunk/complement/explore/test/mt/signal-3.cc Removed Paths: ------------- trunk/complement/explore/test/libmt/signal-3/ trunk/complement/explore/test/libmt/signal-4/ Modified: trunk/complement/explore/test/mt/Makefile.inc =================================================================== --- trunk/complement/explore/test/mt/Makefile.inc 2006-12-15 12:26:46 UTC (rev 1458) +++ trunk/complement/explore/test/mt/Makefile.inc 2006-12-18 13:04:02 UTC (rev 1459) @@ -1,6 +1,6 @@ -# -*- makefile -*- Time-stamp: <06/12/14 11:11:10 ptr> +# -*- makefile -*- Time-stamp: <06/12/16 00:37:10 ptr> PRGNAME = mt_ut SRC_CC = unit_test.cc timespec.cc mutex_test.cc spinlock_test.cc \ - recursive_mutex.cc join.cc signal-1.cc signal-2.cc flck.cc lfs.cc \ + recursive_mutex.cc join.cc signal-1.cc signal-2.cc signal-3.cc flck.cc lfs.cc \ mt_test.cc mt_test_suite.cc Modified: trunk/complement/explore/test/mt/signal-1.cc =================================================================== --- trunk/complement/explore/test/mt/signal-1.cc 2006-12-15 12:26:46 UTC (rev 1458) +++ trunk/complement/explore/test/mt/signal-1.cc 2006-12-18 13:04:02 UTC (rev 1459) @@ -1,4 +1,4 @@ -// -*- C++ -*- Time-stamp: <06/12/15 10:40:53 ptr> +// -*- C++ -*- Time-stamp: <06/12/16 00:28:34 ptr> /* * Copyright (c) 2003, 2006 @@ -16,6 +16,15 @@ using namespace xmt; + +/* + * thread 2: v = 1; create thread 1 ----------------------------------- join; v == 4? + * \ / + * thread 1: set handler; v == 1? - kill ----------- exit + * \ + * handler (within thread 1): v == 1?; v = 4 + */ + static Thread::ret_code thread_one( void * ); static Thread::ret_code thread_two( void * ); @@ -24,6 +33,8 @@ static int v = 0; +static Condition cnd; + extern "C" { static void handler( int ); @@ -55,29 +66,10 @@ BOOST_CHECK( v == 1 ); -// pm.lock(); -// cerr << "thread_one: unblock signal SIGINT" << endl; -// cerr << "thread_one: set own handler for signal SIGINT" << endl; -// pm.unlock(); + cnd.try_wait(); - - // wait while set thread's pointer (from thread_two) - xmt::timespec t(1,0); - - while ( th_one == 0 ) { - xmt::sleep( t ); - } - -// pm.lock(); -// cerr << "thread_one: send SIGINT" << endl; -// pm.unlock(); th_one->kill( SIGINT ); // send signal SIGINT to self -// pm.lock(); -// cerr << "thread_one: after send SIGINT" << endl; -// pm.unlock(); - // v = 2; // not reached (exit before) - Thread::ret_code rt; rt.iword = 0; @@ -86,22 +78,16 @@ Thread::ret_code thread_two( void * ) { - // pm.lock(); - // cerr << "thread_two: create thread one" << endl; - // pm.unlock(); + cnd.set( false ); v = 1; Thread t( thread_one ); // start thread_one - th_one = &t; // store address to be called from thread_one + th_one = &t; // store address to be called from thread_one - // pm.lock(); - // cerr << "thread_two: wait termination of thread one" << endl; - // pm.unlock(); + cnd.set( true ); + t.join(); - // pm.lock(); - // cerr << "thread_two: EOL of thread one" << endl; - // pm.unlock(); BOOST_CHECK( v == 4 ); Added: trunk/complement/explore/test/mt/signal-3.cc =================================================================== --- trunk/complement/explore/test/mt/signal-3.cc (rev 0) +++ trunk/complement/explore/test/mt/signal-3.cc 2006-12-18 13:04:02 UTC (rev 1459) @@ -0,0 +1,114 @@ +// -*- C++ -*- Time-stamp: <06/12/16 00:35:45 ptr> + +/* + * Copyright (c) 2003, 2006 + * Petr Ovtchenkov + * + * Licensed under the Academic Free License Version 3.0 + * + */ + +#include <boost/test/unit_test.hpp> + +using namespace boost::unit_test_framework; + +#include <mt/xmt.h> + +using namespace xmt; + +/* + * This is the same as signal-1, but instead of unblock signal, I block one + * so I don't take this signal. + */ + +/* + * handler (within thread 2): v == 1?; v = 4 + * / + * thread 2: v = 1; create thread 1 ----------------------------------- join; v == 4? + * \ / / + * thread 1: set handler; v == 1? - kill ------ exit + * + */ + +static Thread::ret_code thread_one( void * ); +static Thread::ret_code thread_two( void * ); + +static Thread *th_one = 0; +static Thread *th_two = 0; + +static int v = 0; + +static Condition cnd; + +extern "C" { + static void handler( int ); + + void handler( int ) + { + BOOST_CHECK( v == 1 ); + v = 4; + /* + Note: you have very restricted list of system calls that you can use here + (in the handler of signal) safely. In particular, you can't call pthread_* + functions. Reason: async-signal-safe calls, Unix 98, POSIX 1002.1 + */ + // cerr << "thread_one: Handler" << endl; + // Thread::signal_exit( SIGTERM ); + // send signal to caller thread to exit: + // th_one->kill( SIGTERM ); + + // v = 3; // not reached + } +} + +Thread::ret_code thread_one( void * ) +{ + BOOST_CHECK( v == 1 ); + + cnd.try_wait(); + + th_two->kill( SIGINT ); // send signal SIGINT to self + + Thread::ret_code rt; + rt.iword = 0; + + return rt; +} + +Thread::ret_code thread_two( void * ) +{ + xmt::signal_handler( SIGINT, handler ); + xmt::block_signal( SIGINT ); // block signal + + v = 1; + + Thread t( thread_one ); // start thread_one + + t.join(); + + BOOST_CHECK( v == 1 ); // signal was blocked! + + xmt::unblock_signal( SIGINT ); // unblock signal + + BOOST_CHECK( v == 4 ); + + Thread::ret_code rt; + rt.iword = 0; + + return rt; +} + +void signal_3_test() +{ + cnd.set( false ); + + Thread t( thread_two ); + + th_two = &t; // store address to be called from thread_one + + cnd.set( true ); + + t.join(); + + BOOST_CHECK( v == 4 ); +} Modified: trunk/complement/explore/test/mt/unit_test.cc =================================================================== --- trunk/complement/explore/test/mt/unit_test.cc 2006-12-15 12:26:46 UTC (rev 1458) +++ trunk/complement/explore/test/mt/unit_test.cc 2006-12-18 13:04:02 UTC (rev 1459) @@ -1,4 +1,4 @@ -// -*- C++ -*- Time-stamp: <06/12/14 10:47:39 ptr> +// -*- C++ -*- Time-stamp: <06/12/16 00:36:47 ptr> /* * Copyright (c) 2002, 2003, 2004, 2006 @@ -24,6 +24,7 @@ void recursive_mutex_test(); void signal_1_test(); void signal_2_test(); +void signal_3_test(); void flock_test(); void lfs_test(); @@ -48,6 +49,7 @@ // (stack saved/restored, that confuse stack unwind); // by this reason next test is commented: // ts->add( BOOST_TEST_CASE( &signal_2_test ) ); + ts->add( BOOST_TEST_CASE( &signal_3_test ) ); // flock requre revision, commented now. // ts->add( BOOST_TEST_CASE( &flock_test ) ); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <com...@us...> - 2007-05-16 14:19:39
|
Revision: 1559 http://svn.sourceforge.net/complement/?rev=1559&view=rev Author: complement Date: 2007-05-16 07:19:38 -0700 (Wed, 16 May 2007) Log Message: ----------- start of Virtual Time (Virtual Synchrony) explore Added Paths: ----------- trunk/complement/explore/test/virtual_time/ trunk/complement/explore/test/virtual_time/Makefile trunk/complement/explore/test/virtual_time/Makefile.inc trunk/complement/explore/test/virtual_time/vtime.cc trunk/complement/explore/test/virtual_time/vtime.h trunk/complement/explore/test/virtual_time/vtime_main.cc Property changes on: trunk/complement/explore/test/virtual_time ___________________________________________________________________ Name: svn:ignore + obj Added: trunk/complement/explore/test/virtual_time/Makefile =================================================================== --- trunk/complement/explore/test/virtual_time/Makefile (rev 0) +++ trunk/complement/explore/test/virtual_time/Makefile 2007-05-16 14:19:38 UTC (rev 1559) @@ -0,0 +1,22 @@ +# -*- Makefile -*- Time-stamp: <07/02/07 12:28:46 ptr> + +SRCROOT := ../.. +COMPILER_NAME := gcc + +include Makefile.inc +include ${SRCROOT}/Makefiles/top.mak + +INCLUDES += -I$(SRCROOT)/include -I$(BOOST_INCLUDE_DIR) + +LIBMT_DIR = ${CoMT_DIR}/lib/mt +LIBSOCK_DIR = ${CoMT_DIR}/lib/sockios +LIBSTEM_DIR = ${CoMT_DIR}/lib/stem + +LDSEARCH += -L${CoMT_LIB_DIR} -Wl,--rpath=${CoMT_LIB_DIR} + +release-shared : LDLIBS = -lxmt -lsockios -lstem +stldbg-shared : LDLIBS = -lxmtstlg -lsockiosstlg -lstemstlg +dbg-shared : LDLIBS = -lxmtg -lsockiosg -lstemg + +# dbg-shared: DEFS += -DDEBUG + Added: trunk/complement/explore/test/virtual_time/Makefile.inc =================================================================== --- trunk/complement/explore/test/virtual_time/Makefile.inc (rev 0) +++ trunk/complement/explore/test/virtual_time/Makefile.inc 2007-05-16 14:19:38 UTC (rev 1559) @@ -0,0 +1,4 @@ +# -*- makefile -*- Time-stamp: <06/10/10 15:22:33 ptr> + +PRGNAME = vtime +SRC_CC = vtime_main.cc Added: trunk/complement/explore/test/virtual_time/vtime.cc =================================================================== --- trunk/complement/explore/test/virtual_time/vtime.cc (rev 0) +++ trunk/complement/explore/test/virtual_time/vtime.cc 2007-05-16 14:19:38 UTC (rev 1559) @@ -0,0 +1,16 @@ +// -*- C++ -*- Time-stamp: <07/03/07 15:53:23 ptr> + +#include "vtime.h" + +namespace vt { + +void Proc::mess( const stem::Event_base<>& ev ) +{ +} + +DEFINE_RESPONSE_TABLE( Proc ) + EV_Event_base_T_( ST_NULL, MESS, mess, intr::httprq ) +END_RESPONSE_TABLE + +} // namespace vt + Added: trunk/complement/explore/test/virtual_time/vtime.h =================================================================== --- trunk/complement/explore/test/virtual_time/vtime.h (rev 0) +++ trunk/complement/explore/test/virtual_time/vtime.h 2007-05-16 14:19:38 UTC (rev 1559) @@ -0,0 +1,31 @@ +// -*- C++ -*- Time-stamp: <07/03/06 19:23:37 ptr> + +#ifndef __vtime_h +#define __vtime_h + +#include <stem/Event.h> +#include <stem/EventHandler.h> + +namespace vt { + +class Proc + public stem::EventHandler +{ + public: + Proc() + { } + Proc( stem::addr_type id ) : + stem::EventHandler( id ) + { } + + void mess( const stem::Event_base<>& ); + + private: + DECLARE_RESPONSE_TABLE( Proc, stem::EventHandler ); +}; + +#define MESS 0x300 + +} // namespace vt + +#endif // __vtime_h Added: trunk/complement/explore/test/virtual_time/vtime_main.cc =================================================================== --- trunk/complement/explore/test/virtual_time/vtime_main.cc (rev 0) +++ trunk/complement/explore/test/virtual_time/vtime_main.cc 2007-05-16 14:19:38 UTC (rev 1559) @@ -0,0 +1,13 @@ +#include <iostream> + +#include "vtime.h" + +using namespace std; + +int main() +{ + cerr << "Hello, world!" << endl; + + return 0; +} + This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <com...@us...> - 2007-07-18 16:31:57
|
Revision: 1630 http://svn.sourceforge.net/complement/?rev=1630&view=rev Author: complement Date: 2007-07-18 09:31:53 -0700 (Wed, 18 Jul 2007) Log Message: ----------- FIT_EXAM -> __FIT_EXAM Modified Paths: -------------- trunk/complement/explore/test/mt/Makefile trunk/complement/explore/test/stem/Echo.cc trunk/complement/explore/test/stem/Makefile Modified: trunk/complement/explore/test/mt/Makefile =================================================================== --- trunk/complement/explore/test/mt/Makefile 2007-07-18 16:30:49 UTC (rev 1629) +++ trunk/complement/explore/test/mt/Makefile 2007-07-18 16:31:53 UTC (rev 1630) @@ -8,6 +8,7 @@ INCLUDES += -I$(SRCROOT)/include -I$(BOOST_INCLUDE_DIR) +DEFS += -D__FIT_EXAM # temporary, before dums fix strings: # DEFS += -D_STLP_DONT_USE_TEMPLATE_EXPRESSION Modified: trunk/complement/explore/test/stem/Echo.cc =================================================================== --- trunk/complement/explore/test/stem/Echo.cc 2007-07-18 16:30:49 UTC (rev 1629) +++ trunk/complement/explore/test/stem/Echo.cc 2007-07-18 16:31:53 UTC (rev 1630) @@ -129,7 +129,7 @@ void PeerClient::handler1( const stem::Event& ev ) { - EXAM_CHECK( ev.value() == mess ); + EXAM_CHECK_ASYNC( ev.value() == mess ); cnd.set(true); } Modified: trunk/complement/explore/test/stem/Makefile =================================================================== --- trunk/complement/explore/test/stem/Makefile 2007-07-18 16:30:49 UTC (rev 1629) +++ trunk/complement/explore/test/stem/Makefile 2007-07-18 16:31:53 UTC (rev 1630) @@ -11,6 +11,7 @@ include ${SRCROOT}/Makefiles/gmake/top.mak INCLUDES += -I$(SRCROOT)/include +DEFS += -D__FIT_EXAM LIBMT_DIR = ${CoMT_DIR}/lib/mt LIBSOCK_DIR = ${CoMT_DIR}/lib/sockios This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |