%PDF- %PDF-
Mini Shell

Mini Shell

Direktori : /proc/self/root/opt/plesk/python/2.7/lib64/python2.7/bsddb/test/
Upload File :
Create Path :
Current File : //proc/self/root/opt/plesk/python/2.7/lib64/python2.7/bsddb/test/test_thread.pyc

�
5}�ac@sDdZddlZddlZddlZddlZddlmZdZyeWn'ek
r}de	fd��YZnXddl
Z
ddlmZm
Z
mZmZmZmZmZer
ddlmZejd	d
kr�ddlmZq
ddlmZnd
e
jfd��YZdefd��YZdefd��YZdefd��YZdefd��YZdefd��YZdefd��YZdefd��YZ de fd��YZ!de fd ��YZ"d!e fd"��YZ#d#e fd$��YZ$d%�Z%e&d&kr@e
j'd'd(�ndS()s-TestCases for multi-threaded access to a DB.
i����N(trandomt-tWindowsErrorcBseZRS((t__name__t
__module__(((s?/opt/plesk/python/2.7/lib64/python2.7/bsddb/test/test_thread.pyRs(tdbtdbutilsttest_supporttverbosethave_threadstget_new_environment_pathtget_new_database_path(tThreadii(t
currentThread(tcurrent_threadtBaseThreadedTestCasecBsGeZejZdZdZdZd�Zd�Z	d�Z
d�ZRS(icCs�trtjt_nt�|_tj�|_	|j
�|j	j|j|jtj
B�|jjd|_tj|j	�|_|jr�|jj|j�n|jj|j|j|jtj
B�dS(Ns.db(RtsyststdoutRt_deadlock_VerboseFileR
thomeDirRtDBEnvtenvt
setEnvOptstopentenvflagst	DB_CREATEt	__class__RtfilenametDBtdt
dbsetflagst	set_flagstdbtypetdbopenflags(tself((s?/opt/plesk/python/2.7/lib64/python2.7/bsddb/test/test_thread.pytsetUp&s
 	cCs.|jj�|jj�tj|j�dS(N(RtcloseRRtrmtreeR(R"((s?/opt/plesk/python/2.7/lib64/python2.7/bsddb/test/test_thread.pyttearDown5s

cCsdS(N((R"((s?/opt/plesk/python/2.7/lib64/python2.7/bsddb/test/test_thread.pyR:scCstj|gd�S(Ni(tDASHtjoin(R"tkey((s?/opt/plesk/python/2.7/lib64/python2.7/bsddb/test/test_thread.pytmakeData=s(RRRt
DB_UNKNOWNR R!RRR#R&RR*(((s?/opt/plesk/python/2.7/lib64/python2.7/bsddb/test/test_thread.pyR s				tConcurrentDataStoreBasecBsUeZejZejejBejBZdZdZ	dZ
d�Zd�Zd�Z
RS(ii�c
	CsQtr%dGddGHd|jjGHnt|j�}ddl}|j|�|j|j}|j|j}|j	|j|j|�|j	|j|j|�|j	||d�g}x{t
|j�D]j}td|jd|j
|fd	d
|�}tjddkr|jt�n	t|_|j|�q�Wg}x�t
|j�D]}}|||||d!}	|	j�|||||d!}
td|jd|j
|	|
fd	d
|�}|j|�qOWxD|D]<}tjddkr|jt�n	t|_|j�q�Wx|D]}|j�qWx|D]}|j�q9WdS(Ns
s-=is(Running %s.test01_1WriterMultiReaders...i����ittargettargstnames	reader %diis	writer %d(RRRtrangetrecordsRtshuffletwriterstreaderstassertEqualtxrangeRtreaderThreadRRtversion_infot	setDaemontTruetdaemontappendtsorttwriterThreadtstartR((
R"tkeysRtrecords_per_writertreaders_per_writerR4txtrtR3tatbtwttt((s?/opt/plesk/python/2.7/lib64/python2.7/bsddb/test/test_thread.pyttest01_1WriterMultiReadersKsN


	


	

c	Cs$tjddkr%t�j�}nt�j}trLd|ttfGHnt|�t|�}|}x�|D]�}d|}t	j
|j||j|�dd�tr�|ddkr�d|t|fGHn|d	8}|so|j
�j�|}qoqoWtrd
|GHntr d|GHndS(Niis%s: creating records %d - %ds%04dtmax_retriesiids%s: records %d - %d finishedis%s: finished creating recordss%s: thread finished(RR8R
tgetNameR/RR?tstoptlenRtDeadlockWraptputR*tpop(	R"RR@R4R/tcounttcount2RCR)((s?/opt/plesk/python/2.7/lib64/python2.7/bsddb/test/test_thread.pyR>}s*



c
Cs�tjddkr%t�j�}nt�j}x�td�D]�}|j�}d}|j�}xE|r�|d7}|\}}	|j|j	|�|	�|j
�}qeWtr�d||fGHn|j�q>Wtr�d|GHndS(Niiiis%s: found %d recordss%s: thread finished(
RR8R
RKR/R6tcursortfirstR5R*tnextRR$(
R"Rt	readerNumR/titcRQtrecR)tdata((s?/opt/plesk/python/2.7/lib64/python2.7/bsddb/test/test_thread.pyR7�s"	
(RRRt	DB_THREADR!tDB_INIT_CDBt
DB_INIT_MPOOLRR4R3R1RIR>R7(((s?/opt/plesk/python/2.7/lib64/python2.7/bsddb/test/test_thread.pyR,Ds		2	tBTreeConcurrentDataStorecBs#eZejZdZdZdZRS(ii
i�(RRRtDB_BTREER R3R4R1(((s?/opt/plesk/python/2.7/lib64/python2.7/bsddb/test/test_thread.pyR^�s	tHashConcurrentDataStorecBs#eZejZdZdZdZRS(ii
i�(RRRtDB_HASHR R3R4R1(((s?/opt/plesk/python/2.7/lib64/python2.7/bsddb/test/test_thread.pyR`�s	tSimpleThreadedBasecBs^eZejZejejBejBZdZdZ	dZ
d�Zd�Zd�Z
d�ZRS(i
ii�cCs|jjtj�dS(N(Rt
set_lk_detectRtDB_LOCK_DEFAULT(R"((s?/opt/plesk/python/2.7/lib64/python2.7/bsddb/test/test_thread.pyR�sc
	CsQtr%dGddGHd|jjGHnt|j�}ddl}|j|�|j|j}|j|j}|j	|j|j|�|j	|j|j|�|j	||d�g}x{t
|j�D]j}td|jd|j
|fd	d
|�}tjddkr|jt�n	t|_|j|�q�Wg}x�t
|j�D]}}|||||d!}	|	j�|||||d!}
td|jd|j
|	|
fd	d
|�}|j|�qOWxD|D]<}tjddkr|jt�n	t|_|j�q�Wx|D]}|j�qWx|D]}|j�q9WdS(Ns
s-=is Running %s.test02_SimpleLocks...i����iR-R.R/s	reader %diis	writer %d(RRRR0R1RR2R3R4R5R6RR7RRR8R9R:R;R<R=R>R?R((
R"R@RRARBR4RCRDR3RERFRGRH((s?/opt/plesk/python/2.7/lib64/python2.7/bsddb/test/test_thread.pyttest02_SimpleLocks�sL


	


	

c	Cstjddkr%t�j�}nt�j}trLd|ttfGHnt|�t|�}|}x�|D]�}d|}t	j
|j||j|�dd�tr�|ddkr�d|t|fGHn|d	8}|so|j
�j�|}qoqoWtrd
|GHndS(Niis%s: creating records %d - %ds%04dRJiids%s: records %d - %d finishedis%s: thread finished(RR8R
RKR/RR?RLRMRRNROR*RP(	R"RR@R4R/RQRRRCR)((s?/opt/plesk/python/2.7/lib64/python2.7/bsddb/test/test_thread.pyR>�s&



c	Cs�tjddkr%t�j�}nt�j}|j�}d}tj|jdd�}xQ|r�|d7}|\}}|j	|j
|�|�tj|jdd�}q^Wtr�d||fGHn|j
�tr�d|GHndS(NiiRJi
is%s: found %d recordss%s: thread finished(RR8R
RKR/RSRRNRTR5R*RURR$(	R"RRVR/RXRQRYR)RZ((s?/opt/plesk/python/2.7/lib64/python2.7/bsddb/test/test_thread.pyR7s 	

(RRRR[R!R]tDB_INIT_LOCKRR4R3R1RReR>R7(((s?/opt/plesk/python/2.7/lib64/python2.7/bsddb/test/test_thread.pyRb�s			2	tBTreeSimpleThreadedcBseZejZRS((RRRR_R (((s?/opt/plesk/python/2.7/lib64/python2.7/bsddb/test/test_thread.pyRg-stHashSimpleThreadedcBseZejZRS((RRRRaR (((s?/opt/plesk/python/2.7/lib64/python2.7/bsddb/test/test_thread.pyRh1stThreadedTransactionsBasecBs�eZejejBZejejBejBejBej	BZ
dZdZdZ
dZd�Zd�Zd�Zd�Zd�ZRS(ii�cCsdS(N((R"((s?/opt/plesk/python/2.7/lib64/python2.7/bsddb/test/test_thread.pyREsc	Cs�tr%dGddGHd|jjGHnt|j�}ddl}|j|�|j|j}|j|j}|j	|j|j|�|j	|j|j|�|j	||d�g}x{t
|j�D]j}td|jd|j
|fd	d
|�}tjddkr|jt�n	t|_|j|�q�Wg}x�t
|j�D]s}|||||d!}	|||||d!}
td|jd|j
|	|
fd	d
|�}|j|�qOWtd|j�}tjddkr�|jt�n	t|_|j�xD|D]<}
tjddkr>|
jt�n	t|
_|
j�qWx|D]}
|
j�q\Wx|D]}
|
j�qwWt|_|j�dS(Ns
s-=is)Running %s.test03_ThreadedTransactions...i����iR-R.R/s	reader %diis	writer %d(RRRR0R1RR2R3R4R5R6RR7RRR8R9R:R;R<R>tdeadlockThreadR?R(tFalsetdoLockDetect(R"R@RRARBR4RCRDR3RERFRGtdtRH((s?/opt/plesk/python/2.7/lib64/python2.7/bsddb/test/test_thread.pyttest03_ThreadedTransactionsIsZ


	
	

	

	cCs�tjddkr%t�j�}nt�j}t|�t|�}x,t|�ruy�|jjd|j	�}|| }x_|D]W}d|}	|j
|	|j|	�|�tr�|ddkr�d|t
|fGHq�q�W|j�||}|j�j
�WqJtjtjfk
rq}
trdtjdkrKd||
d	fGHqdd||
jd	fGHn|j�qJXqJWtr�d
|GHndS(Niis%04dids%s: records %d - %d finishediis%s: Aborting transaction (%s)is%s: thread finished(ii(RR8R
RKR/RMRt	txn_begintNonettxnFlagROR*RR?tcommitRPRtDBLockDeadlockErrortDBLockNotGrantedErrorR.tabort(R"RR@R4R/RQttxntkeys2RCR)tval((s?/opt/plesk/python/2.7/lib64/python2.7/bsddb/test/test_thread.pyR>�s2




cCs�tjddkr%t�j�}nt�j}t}x;|sty�|jjd|j	�}|j
|�}d}|j�}xE|r�|d7}|\}	}
|j|j
|	�|
�|j�}qWtr�d||fGHn|j�|j�t}Wq:tjtjfk
rp}trYtjd	kr@d||dfGHqYd||jdfGHn|j�|j�q:Xq:Wtr�d|GHndS(
Niiis%s: found %d recordsiis%s: Aborting transaction (%s)s%s: thread finished(ii(RR8R
RKR/RkRRoRpRqRSRTR5R*RURR$RrR:RRsRtR.Ru(R"RRVR/tfinishedRvRXRQRYR)RZRx((s?/opt/plesk/python/2.7/lib64/python2.7/bsddb/test/test_thread.pyR7�s<		




cCsxt|_xh|jrstjd�y7|jjtjtj�}t	rX|rXd|GHnWqtj
k
roqXqWdS(Ng�������?s.deadlock: Aborted %d deadlocked transaction(s)(R:RlttimetsleepRtlock_detectRtDB_LOCK_RANDOMtDB_LOCK_CONFLICTRtDBError(R"taborted((s?/opt/plesk/python/2.7/lib64/python2.7/bsddb/test/test_thread.pyRj�s	
	
(RRRR[tDB_AUTO_COMMITR!R]RftDB_INIT_LOGtDB_INIT_TXNRR4R3R1RqRRnR>R7Rj(((s?/opt/plesk/python/2.7/lib64/python2.7/bsddb/test/test_thread.pyRi8s
		;		#tBTreeThreadedTransactionscBs#eZejZdZdZdZRS(ii
i�(RRRR_R R3R4R1(((s?/opt/plesk/python/2.7/lib64/python2.7/bsddb/test/test_thread.pyR��s	tHashThreadedTransactionscBs#eZejZdZdZdZRS(ii
i�(RRRRaR R3R4R1(((s?/opt/plesk/python/2.7/lib64/python2.7/bsddb/test/test_thread.pyR��s	tBTreeThreadedNoWaitTransactionscBs,eZejZdZdZdZejZ	RS(ii
i�(
RRRR_R R3R4R1t
DB_TXN_NOWAITRq(((s?/opt/plesk/python/2.7/lib64/python2.7/bsddb/test/test_thread.pyR��s
	tHashThreadedNoWaitTransactionscBs,eZejZdZdZdZejZ	RS(ii
i�(
RRRRaR R3R4R1R�Rq(((s?/opt/plesk/python/2.7/lib64/python2.7/bsddb/test/test_thread.pyR��s
	cCs�tj�}tr�|jtjt��|jtjt��|jtjt��|jtjt��|jtjt	��|jtjt
��|jtjt��|jtjt��ndGH|S(Ns-Threads not available, skipping thread tests.(
tunittestt	TestSuiteR	taddTestt	makeSuiteR^R`RgRhR�R�R�R�(tsuite((s?/opt/plesk/python/2.7/lib64/python2.7/bsddb/test/test_thread.pyt
test_suite�st__main__tdefaultTestR�((t__doc__tosRRzterrnoRR'Rt	NameErrort	ExceptionR�ttest_allRRRRR	R
Rt	threadingRR8R
RtTestCaseRR,R^R`RbRgRhRiR�R�R�R�R�Rtmain(((s?/opt/plesk/python/2.7/lib64/python2.7/bsddb/test/test_thread.pyt<module>s@
4$m	l�
	

Zerion Mini Shell 1.0