ACC SHELL
Ñò
q&ÄMc @ sò d Z d d k Z d d k Z d d k l Z l Z l Z l Z l Z l Z e oX d d k
l Z d d k Z e i
d d j o d d k
l Z q« d d k
l Z n d e i f d
„ ƒ YZ d „ Z e d j o e i d
d ƒ n d S( s/
TestCases for testing the locking sub-system.
iÿÿÿÿN( t dbt test_supportt verboset have_threadst get_new_environment_patht get_new_database_path( t Threadi i ( t
currentThread( t current_threadt LockingTestCasec B sn e Z d d k Z e i d d
j o d d „ Z n d „ Z d „ Z d „ Z d
„ Z d „ Z
d „ Z RS( iÿÿÿÿNi i i i c C s | i | d | ƒd S( Nt msg( t
failUnless( t selft exprR
( ( s* /usr/lib/python2.6/bsddb/test/test_lock.pyt
assertTrue s c C sM t ƒ | _ t i ƒ | _ | i i | i t i t i Bt i Bt i Bƒ d S( N(
R t homeDirR t DBEnvt envt opent DB_THREADt
DB_INIT_MPOOLt DB_INIT_LOCKt DB_CREATE( R ( ( s* /usr/lib/python2.6/bsddb/test/test_lock.pyt setUp s c C s! | i i ƒ t i | i ƒ d S( N( R t closeR t rmtreeR ( R ( ( s* /usr/lib/python2.6/bsddb/test/test_lock.pyt tearDown# s
c C s± t o d Gd d GHd | i i GHn | i i ƒ } t o
d | GHn | i i | d t i ƒ } t o
d | GHn | i i | ƒ t o
d | GHn | i i | ƒ d S( Ns
s -=i s Running %s.test01_simple...s
locker ID: %ss some locked things Aquired lock: %ss Released lock: %s(
R t __class__t __name__R t lock_idt lock_getR t
DB_LOCK_WRITEt lock_putt lock_id_free( R t anIDt lock( ( s* /usr/lib/python2.6/bsddb/test/test_lock.pyt
test01_simple( s
c C sî t o d Gd d GHd | i i GHn g } | i t d | i d t i f ƒ ƒ | i t d | i d t i f ƒ ƒ | i t d | i d t i f ƒ ƒ | i t d | i d t i f ƒ ƒ | i t d | i d t i f ƒ ƒ | i t d | i d t i f ƒ ƒ | i t d | i d t i f ƒ ƒ | i t d | i d t i f ƒ ƒ | i t d | i d t i f ƒ ƒ xR | D]J } d d k } | i
d d j o | i t ƒ n
t | _
| i ƒ qWx | D] } | i ƒ qÖWd S(
Ns
s -=i s Running %s.test02_threaded...t targett argsiÿÿÿÿi i ( R R R t appendR t theThreadR R t DB_LOCK_READt syst version_infot setDaemont Truet daemont startt join( R t threadst tR* ( ( s* /usr/lib/python2.6/bsddb/test/test_lock.pyt test02_threaded9 s@
c sö ˆ i i d t i ƒ ˆ i i d t i ƒ ˆ i i d t i ƒ ˆ i i d t i ƒ ‡ ‡ f d † ‰ t ˆ _ d ˆ _ t d ˆ ƒ } d d k } | i
d d j o | i t ƒ n
t | _
| i ƒ ˆ i i d t i ƒ ˆ i i ƒ } ˆ i i ƒ } ˆ i | | ƒ ˆ i i | d t i ƒ } t i ƒ } ˆ i t i ˆ i i | d t i ƒ t i ƒ } t ˆ _ ˆ i | | d
j ƒ ˆ i i | ƒ | i ƒ ˆ i i | ƒ ˆ i i | ƒ t i ƒ d
j o ˆ i ˆ i d j ƒ n d S( Ni i@â iËdx c s\ xU ˆ i pJ ˆ i i t i ƒ ˆ _ ˆ i o x ˆ i p q2 WPn t i d ƒ q Wd S( Ng{®Gáz„?( t endR t lock_detectR t DB_LOCK_EXPIREt countt timet sleep( ( R t deadlock_detection( s* /usr/lib/python2.6/bsddb/test/test_lock.pyR: b s
R% iÿÿÿÿi i † s shared lockg‰ÒÞà“¹?i i ( i i ( R t set_timeoutR t DB_SET_LOCK_TIMEOUTt DB_SET_TXN_TIMEOUTt FalseR4 R7 R R* R+ R, R- R. R/ R t assertNotEqualR R R8 t assertRaisest DBLockNotGrantedErrorR) R R R0 R! t version( R R2 R* R"