Plan 9 from Bell Labs’s /usr/web/sources/contrib/jas/root/sys/lib/python2.7/bsddb/test/test_dbenv.pyo

Copyright © 2021 Plan 9 Foundation.
Distributed under the MIT License.
Download the Plan 9 distribution.


��Qc@s�ddlZddlZddlZddlmZmZmZmZdejfd��YZ	de	fd��YZ
de	fd��YZd	e	fd
��YZde	fd��YZ
d
e	fd��YZd�Zedkr�jdd�ndS(i�N(tdbttest_supporttget_new_environment_pathtget_new_database_pathtDBEnvcBseZd�Zd�ZRS(cCst�|_tj�|_dS(N(RthomeDirRRtenv(tself((s+/sys/lib/python2.7/bsddb/test/test_dbenv.pytsetUp
scCs'|jj�|`tj|j�dS(N(RtcloseRtrmtreeR(R((s+/sys/lib/python2.7/bsddb/test/test_dbenv.pyttearDowns
(t__name__t
__module__RR(((s+/sys/lib/python2.7/bsddb/test/test_dbenv.pyR	s	t
DBEnv_generalcBs�eZd�Zd�Zej�dkr?d�Zd�Znej�dkrfd�Zd�Z	nej�dkr�d	�Z
d
�Znd�Zd�Z
ej�dkr�d
�Zd�Zd�Zd�ZnRS(cCsCtjtjB}|jj|j|�|j||jj��dS(N(Rt	DB_CREATEt
DB_INIT_MPOOLRtopenRtassertEqualtget_open_flags(Rtflags((s+/sys/lib/python2.7/bsddb/test/test_dbenv.pyttest_get_open_flagsscCsQtjtjBtjBtjB}|jj|j|�|j||jj	��dS(N(
RRRtDB_INIT_LOCKt	DB_THREADRRRRR(RR((s+/sys/lib/python2.7/bsddb/test/test_dbenv.pyttest_get_open_flags2siicCsGx@dddgD]/}|jj|�|j||jj��qWdS(Ni
ii((Rtset_lk_partitionsRtget_lk_partitions(Rti((s+/sys/lib/python2.7/bsddb/test/test_dbenv.pyttest_lk_partitions scCs||jd|jj��x@dddgD]/}|jj|�|j||jj��q)W|jtj|jjd�dS(Ns	rwx------s	rw-rw-rw-s	rw-r--r--tabcde(RtNoneRtget_intermediate_dir_modetset_intermediate_dir_modetassertRaisesRtDBInvalidArgError(Rtmode((s+/sys/lib/python2.7/bsddb/test/test_dbenv.pyt!test_getset_intermediate_dir_mode%sicCsGx@dddgD]/}|jj|�|j||jj��qWdS(Niidi�(Rtset_thread_countRtget_thread_count(RR((s+/sys/lib/python2.7/bsddb/test/test_dbenv.pyttest_thread.scCs�x�ddgD]|}|dd}|jjd|�|jj�}|jd|d�|j||dk�|jd||dk�q
WdS(Ni@i�iiii(Rt
set_cache_maxt
get_cache_maxRt
assertTrue(Rtsizetsize2((s+/sys/lib/python2.7/bsddb/test/test_dbenv.pyttest_cache_max3scCsM|jj|jtjtjBtjB�|jj�}|jd|k�dS(Ntmutex_inuse_max(	RRRRRRRt
mutex_statR*(Rtstat((s+/sys/lib/python2.7/bsddb/test/test_dbenv.pyttest_mutex_stat=scCsGx@dddgD]/}|jj|�|j||jj��qWdS(Ni�i�i�(Rtset_lg_filemodeRtget_lg_filemode(RR((s+/sys/lib/python2.7/bsddb/test/test_dbenv.pyttest_lg_filemodeCscCsGx@dddgD]/}|jj|�|j||jj��qWdS(Niii*(Rtset_mp_max_openfdRtget_mp_max_openfd(RR((s+/sys/lib/python2.7/bsddb/test/test_dbenv.pyttest_mp_max_openfdHscCsxsdddgD]b}xYdddgD]H}|d9}|jj||�|jj�}|j||f|�q&WqWd�}d	�}d
�}d�}d�}d
�}	d�}
d�}d�}d�}
d�}d�}d�}d�}d�}dS(Nidi�i,iiii@BcSs|jtj|jj�dS(N(R!RR"Rt	txn_begin(R((s+/sys/lib/python2.7/bsddb/test/test_dbenv.pyttest_invalid_txnUscSsQxJdddgD]9}|d9}|jj|�|j||jj��qWdS(Nii i@ii(Rtset_mp_mmapsizeRtget_mp_mmapsize(RR((s+/sys/lib/python2.7/bsddb/test/test_dbenv.pyttest_mp_mmapsizeYs
cSsGx@dddgD]/}|jj|�|j||jj��qWdS(Ntatbbtccc(Rtset_tmp_dirRtget_tmp_dir(RR((s+/sys/lib/python2.7/bsddb/test/test_dbenv.pyttest_tmp_dir_scSs�|jjtjd�|jtj|jj��|jjtjd�|jtjtjB|jj��|jjtjd�|jtj|jj��|jjtjd�|jd|jj��dS(Nii(Rt	set_flagsRtDB_AUTO_COMMITRt	get_flagst
DB_TXN_NOSYNC(R((s+/sys/lib/python2.7/bsddb/test/test_dbenv.pyt
test_flagsdscSsGx@dddgD]/}|jj|�|j||jj��qWdS(Ni�i�i�(Rtset_lk_max_objectsRtget_lk_max_objects(RR((s+/sys/lib/python2.7/bsddb/test/test_dbenv.pyttest_lk_max_objectsoscSsGx@dddgD]/}|jj|�|j||jj��qWdS(Ni�i�i�(Rtset_lk_max_locksRtget_lk_max_locks(RR((s+/sys/lib/python2.7/bsddb/test/test_dbenv.pyttest_lk_max_lockstscSsGx@dddgD]/}|jj|�|j||jj��qWdS(Ni�i�i�(Rtset_lk_max_lockersRtget_lk_max_lockers(RR((s+/sys/lib/python2.7/bsddb/test/test_dbenv.pyttest_lk_max_lockersyscSsuxndddgD]]}|dd}|jj|�|jj�}|j||k�|jd||k�qWdS(Ni�ii�ii(Rtset_lg_regionmaxtget_lg_regionmaxR*(RRtj((s+/sys/lib/python2.7/bsddb/test/test_dbenv.pyttest_lg_regionmax~scSs�tjtjtjtjtjtjtjtjg}|j	tj
�x7|D]/}|jj|�|j
||jj��qMWdS(N(RtDB_LOCK_DEFAULTtDB_LOCK_EXPIREtDB_LOCK_MAXLOCKStDB_LOCK_MINLOCKStDB_LOCK_MINWRITEtDB_LOCK_OLDESTtDB_LOCK_RANDOMtDB_LOCK_YOUNGESTtappendtDB_LOCK_MAXWRITERt
set_lk_detectRt
get_lk_detect(RRR((s+/sys/lib/python2.7/bsddb/test/test_dbenv.pyttest_lk_detect�s
cSsJxCddddgD]/}|jj|�|j||jj��qWdS(NR=R>R?tdddd(Rt
set_lg_dirRt
get_lg_dir(RR((s+/sys/lib/python2.7/bsddb/test/test_dbenv.pyttest_lg_dir�scSs�d}|jj|�|j|jj�|k�|j|jj�d|k�|jjd|�|j|jj�d|k�dS(NiFiii(Rtset_lg_bsizeR*tget_lg_bsize(Rtlog_size((s+/sys/lib/python2.7/bsddb/test/test_dbenv.pyt
test_lg_bsize�s cSsDd}x|D]}|jj|�q
W|j||jj��dS(NR=tbtctd(R=RjRkRl(Rtset_data_dirRt
get_data_dirs(RtdirsR((s+/sys/lib/python2.7/bsddb/test/test_dbenv.pyttest_setget_data_dirs�s
cSsedddf}|jj|�|j||jj��dd
df}|jj|�|jj�}|j|d|d�|j|d|d�|jdtd	|d|d��|jj|jtjtj	B�dddf}|j
tj|jj|�|jj�}|j|d|d�|j|d|d�|j|d|dk�dS(Niiiiiiii}gY@ii iiii (
Rt
set_cachesizeRt
get_cachesizetintRRRRRR!R"R*(Rt	cachesizet
cachesize2t
cachesize3((s+/sys/lib/python2.7/bsddb/test/test_dbenv.pyttest_setget_cachesize�s"& cSs5tj|j�}|jtj|jddd�dS(Niiii(RtDBRR!R"Rq(RRl((s+/sys/lib/python2.7/bsddb/test/test_dbenv.pyttest_set_cachesize_dbenv_db�scSs�d}|jj|�|j||jj��|jj|d�|j|d|jj��|jj|jtjtjB�|j	tj
|jj|�|j|d|jj��dS(Ni�i(Rtset_shm_keyRtget_shm_keyRRRRRR!R"(Rtshm_key((s+/sys/lib/python2.7/bsddb/test/test_dbenv.pyttest_setget_shm_key�s (Rtset_mp_max_writetget_mp_max_writeR(RRRStvR9R<RBRGRJRMRPRTRaReRiRpRwRyR}((s+/sys/lib/python2.7/bsddb/test/test_dbenv.pyttest_mp_max_writeMs*
														cCs�|jj�}|dd}|jj|�|j||jj��|jj|�|j||jj��|jj|jtj�|jtj	|jj|�dS(Nii(
Rt
mutex_get_maxt
mutex_set_maxRRRRRR!R"(RR�tv2((s+/sys/lib/python2.7/bsddb/test/test_dbenv.pyttest_mutex_setget_max�scCs�|jj�}d}|jj|�|j||jj��|jj|�|j||jj��|jj|jtj�|jtj	|jj|�dS(Ni(
Rtmutex_get_incrementtmutex_set_incrementRRRRRR!R"(RR�R�((s+/sys/lib/python2.7/bsddb/test/test_dbenv.pyttest_mutex_setget_increment�scCs�|jjd�|jj�}|dd}|jj|�|j||jj��|jj|�|j||jj��|jj|jtj�|jj|�dS(Niii(Rtmutex_set_tas_spinstmutex_get_tas_spinsRRRRR(RR�R�((s+/sys/lib/python2.7/bsddb/test/test_dbenv.pyttest_mutex_setget_tas_spins�scCs�|jj�}d}|dkr*d}n|jj|�|j||jj��|jtj|jjd�|jtj|jjd�|jjd|�|jd||jj��|jj|jtj	�|jtj|jj|�dS(Ni@i�iii(
Rtmutex_get_aligntmutex_set_alignRR!RR"RRR(RR�R�((s+/sys/lib/python2.7/bsddb/test/test_dbenv.pyttest_mutex_setget_aligns	(ii(ii(ii(ii(RR
RRRtversionRR$R'R-R1R4R7R�R�R�R�R�(((s+/sys/lib/python2.7/bsddb/test/test_dbenv.pyRs$								�			t	DBEnv_logcBsVeZd�Zd�Zej�dkr6d�Znej�dkrTd�ZnRS(cCs8tj|�|jj|jtjtjBtjB�dS(N(	RRRRRRRRtDB_INIT_LOG(R((s+/sys/lib/python2.7/bsddb/test/test_dbenv.pyR s
cCs*|jjd�}|jd|d�dS(Nislog.0000000001i�(ii(Rtlog_fileR(RR�((s+/sys/lib/python2.7/bsddb/test/test_dbenv.pyt
test_log_file$sicCsFd}|jj|�|jj�}|j||j�dk�dS(NsThis is a test...i(Rt
log_printft
log_cursorR*tlast(Rtmsgtlogc((s+/sys/lib/python2.7/bsddb/test/test_dbenv.pyttest_log_printf*sicCs�|jjtjtjBd�|j|jjtj��|j|jjtj��|jjtjd�|j|jjtj��|j|jjtj��dS(Nii(Rtlog_set_configRtDB_LOG_DSYNCtDB_LOG_ZEROR*tlog_get_configtassertFalse(R((s+/sys/lib/python2.7/bsddb/test/test_dbenv.pyttest_log_config1s(ii(ii(RR
RR�RR�R�R�(((s+/sys/lib/python2.7/bsddb/test/test_dbenv.pyR�s		t
DBEnv_log_txncBs_eZd�Zej�dkr?ej�dkr?d�Znej�dkr]d�ZnRS(	cCs?tj|�|jj|jtjtjBtjBtj	B�dS(N(
RRRRRRRRR�tDB_INIT_TXN(R((s+/sys/lib/python2.7/bsddb/test/test_dbenv.pyR;s
iiicsNg���fd�}|��jt|�x�D]}|j�q6WdS(Ncs:x3t�jj��D]}�j�jj��qWdS(N(txrangeRt
get_tx_maxR]R8(R(Rttxns(s+/sys/lib/python2.7/bsddb/test/test_dbenv.pyttxCs(R!tMemoryErrortabort(RR�R((RR�s+/sys/lib/python2.7/bsddb/test/test_dbenv.pyttest_tx_maxAs
cCs'd}|jj�}|jj|d|�|j�|jj�}|j�|j||j�dk�d}|jj�}|jj|d|�|j�|j�|j||j�dk�d}|jj�}|jj|d|�|j�|j�|j||j�dk�dS(NsThis is a test...ttxnisThis is another test...sThis is a third test...(	RR8R�tcommitR�R�R*tprevR�(RR�R�R�((s+/sys/lib/python2.7/bsddb/test/test_dbenv.pyR�Qs&





(ii(ii(ii(RR
RRR�R�R�(((s+/sys/lib/python2.7/bsddb/test/test_dbenv.pyR�:s
	$t
DBEnv_mempcBs>eZd�Zd�Zd�Zd�Zd�Zd�ZRS(cCsltj|�|jj|jtjtjBtjB�tj	|j�|_|jjdtj
tjd�dS(Nttesti�(RRRRRRRRR�RxtDB_HASH(R((s+/sys/lib/python2.7/bsddb/test/test_dbenv.pyRjs
'cCs$|jj�|`tj|�dS(N(RR	RR(R((s+/sys/lib/python2.7/bsddb/test/test_dbenv.pyRps
cCs6|jjdd�|j|jjd�dk�dS(Nthitbyeidi(RtputR*Rtmemp_trickle(R((s+/sys/lib/python2.7/bsddb/test/test_dbenv.pyttest_memp_1_trickleuscCs�|jjdd�|jj�|j|jjd�dk�|jjdd�|jjd
�|j|jjd�dk�|jjdd�|jjd�|j|jjd�dk�dS(NR�R�iditbye2itbye3i{ic(ii(i{ic(RR�Rt	memp_syncR*R�(R((s+/sys/lib/python2.7/bsddb/test/test_dbenv.pyttest_memp_2_synczs
cCs�|jj�}|jt|�dk�|jd|dk�|jjtj�}|jd|dk�|jjdd�}|jd|dk�dS(Nit
cache_missiR(Rt	memp_statR*tlenRt
DB_STAT_CLEAR(Rtstats((s+/sys/lib/python2.7/bsddb/test/test_dbenv.pyttest_memp_stat_1�scCsZ|jj�d}|jt|��dk|jd|k�|jd|dk�dS(NiR�tpage_in(RR�R*R�(RR�((s+/sys/lib/python2.7/bsddb/test/test_dbenv.pyttest_memp_stat_2�s(RR
RRR�R�R�R�(((s+/sys/lib/python2.7/bsddb/test/test_dbenv.pyR�is						tDBEnv_logcursorcBskeZd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Z	d�Z
d	�Zd
�ZRS(cCs�tj|�|jj|jtjtjBtjBtj	B�|jj
�}tj|j�|_|jjdtjtjdd|�|j
�xYdddgD]H}|jj
�}|jjd|d|t|�d|�|j
�q�WdS(	NR�i�R�t2t8t20tkeytdata(RRRRRRRRR�R�R8RxR�R�R�Rs(RR�R((s+/sys/lib/python2.7/bsddb/test/test_dbenv.pyR�s
%
)cCs$|jj�|`tj|�dS(N(RR	RR(R((s+/sys/lib/python2.7/bsddb/test/test_dbenv.pyR�s
cCs�|jt|t��|jt|�d�|jt|dt��|jt|d�d�|jt|ddt��|jt|ddt��|jt|dt��dS(Niii(R*t
isinstancettupleRR�Rststr(Rtvalue((s+/sys/lib/python2.7/bsddb/test/test_dbenv.pyt
_check_return�scCs`|jj�}|j�}|j|�|jd|dk�|jt|d�dk�dS(Nii(ii(RR�tfirstR�R*R�(RR�R�((s+/sys/lib/python2.7/bsddb/test/test_dbenv.pyttest_1_first�s

cCsS|jj�}|j�d}|j�}|j|�|j||dk�dS(Ni(RR�R�R�R�R*(RR�t	lsn_firstR�((s+/sys/lib/python2.7/bsddb/test/test_dbenv.pyttest_2_last�s

cCs|jj�}|j�d}|j|j�d�|j�d}|j�}|j|�|j||dk�|j||dk�|j�}|j|d|dk�|j||dk�|j�}|j|d|dk�|j||dk�dS(Ni(	RR�R�RtnextRR�R�R*(RR�tlsn_lastR�R�R�tv3((s+/sys/lib/python2.7/bsddb/test/test_dbenv.pyttest_3_next�s
cCs|jj�}|j�d}|j|j�d�|j�d}|j�}|j|�|j||dk�|j||dk�|j�}|j|d|dk�|j||dk�|j�}|j|d|dk�|j||dk�dS(Ni(	RR�R�RR�RR�R�R*(RR�R�R�R�R�R�((s+/sys/lib/python2.7/bsddb/test/test_dbenv.pyttest_4_prev�s
cCs?|jj�}|j�|j�}|j||j��dS(N(RR�R�R�Rtcurrent(RR�R�((s+/sys/lib/python2.7/bsddb/test/test_dbenv.pyttest_5_current�s
cCsr|jj�}|j�|j�}|j||j��|j||j��|j||j|d��dS(Ni(RR�R�R�tassertNotEqualRtset(RR�R�((s+/sys/lib/python2.7/bsddb/test/test_dbenv.pyt
test_6_set�s
cCs3|jj�}|j�|jtj|j�dS(N(RR�R	R!RtDBCursorClosedErrorR�(RR�((s+/sys/lib/python2.7/bsddb/test/test_dbenv.pyttest_explicit_close�s
cCs`gtd�D]}|jj�^q
}|jj�x$|D]}|jtj|j�q<WdS(Ni
(R�RR�R	R!RR�R�(RRR�((s+/sys/lib/python2.7/bsddb/test/test_dbenv.pyttest_implicit_close�s(

(
RR
RRR�R�R�R�R�R�R�R�R�(((s+/sys/lib/python2.7/bsddb/test/test_dbenv.pyR��s	
		
							cCs~tj�}|jtjt��|jtjt��|jtjt��|jtjt��|jtjt��|S(N(	tunittestt	TestSuitetaddTestt	makeSuiteRR�R�R�R�(tsuite((s+/sys/lib/python2.7/bsddb/test/test_dbenv.pyt
test_suitest__main__tdefaultTestR�(R�tostglobttest_allRRRRtTestCaseRRR�R�R�R�R�Rtmain(((s+/sys/lib/python2.7/bsddb/test/test_dbenv.pyt<module>s"
�/0h	

Bell Labs OSI certified Powered by Plan 9

(Return to Plan 9 Home Page)

Copyright © 2021 Plan 9 Foundation. All Rights Reserved.
Comments to [email protected].