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

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


��Qc@s�dZddlZddlZddlZddlmZmZmZmZm	Z	yddl
Z
Wnek
runXe
jdddde
�dejfd	��YZd
�Zedkr�ejdd
�ndS(sfTestCases for checking that it does not segfault when a DBEnv object
is closed before its DB objects.
i�N(tdbttest_supporttverbosetget_new_environment_pathtget_new_database_pathtignoretmessagesDB could not be closed intcategorytDBEnvClosedEarlyCrashcBsYeZd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Z	d�Z
RS(	cCst�|_d|_dS(Nttest(RthomeDirtfilename(tself((s1/sys/lib/python2.7/bsddb/test/test_early_close.pytsetUpscCstj|j�dS(N(RtrmtreeR
(R((s1/sys/lib/python2.7/bsddb/test/test_early_close.pyttearDownscCstj�}|j|jtjtjBtjBtjBd�tj|�}tj|�}|j|j	tj
tjtjBd�|jtj|j|j	dtj
tjd�|j
dd�|j|jd�dd�|j�|jtj|jd�dS(Ni�t2R	sthis is a testsput!=get(RtDBEnvtopenR
tDB_INIT_CDBt	DB_CREATEt	DB_THREADt
DB_INIT_MPOOLtDBRtDB_BTREEtassertRaisestDBNoSuchFileErrortputtassertEqualtgettclosetDBError(Rtdbenvtdtd2((s1/sys/lib/python2.7/bsddb/test/test_early_close.pyttest01_close_dbenv_before_db s&
cCsttj�}|j|jtjtjBtjBtjBd�tj|�}|j|j	tj
tjtjBd�|jdd�|jdd�|jdd�|j|j
d�dd�|j�}|j�|j�|j�|jtj|j�tj|�}|j|j	tj
tjtjBd�|j�}|j�|j�|j�|jtj|j�dS(	Ni�R	sthis is a testttest2sanother testttest3sanother onesput!=get(RRRR
RRRRRRRRRRtcursortfirsttnextRRR(RR R!tc((s1/sys/lib/python2.7/bsddb/test/test_early_close.pyt"test02_close_dbenv_before_dbcursor2s,&


&


cCs�ddl}|jj|j|j�}tj�}|j|tjtj	tj
Bd�|jdd�|jdd�|jdd�|j|j
d�dd	�|j�}|j�|j�|j�|jtj|j�dS(
Ni�i�R	sthis is a testR$sanother testR%sanother onesput!=get(tos.pathtpathtjoinR
RRRRRRRRRRR&R'R(RRR(RtosR,R!R)((s1/sys/lib/python2.7/bsddb/test/test_early_close.pyt+test03_close_db_before_dbcursor_without_envOs#


cCstj�}|j|jtjtjBtjBtjBd�gtd�D]}tj	|�^qG}g}x4|D],}|j|j
tjtjtjBd�qoW|djdd�|djdd�|djdd	�|j
|d
jd�dd�x:|D]2}|jgtd�D]}|j�^q�qWx%|ddd
�D]}|j�qLWx%|ddd
�D]}|j�qtW|jtj|djd�|jtj|dj�|dj�|dj�|j�|jtj|dj�dS(Ni�ii
R	sthis is a testR$sanother testR%sanother oneisput!=geti ii	ieiP(RRRR
RRRRtxrangeRRRRRRtextendR&RRRR'R((RR titdbstcursorstj((s1/sys/lib/python2.7/bsddb/test/test_early_close.pyttest04_close_massive`s0(
* 
0
cCs�tj�}|j|jtjtjBtjBtjBd�tj|�}|j|j	tj
tjtjBd�|j�~yddl}Wnt
k
r�d}nX|r�|j�ndS(Ni�i�(RRRR
RRRRRRRRtgctImportErrortNonetcollect(RR R!R7((s1/sys/lib/python2.7/bsddb/test/test_early_close.pyt$test05_close_dbenv_delete_db_success�s&


cCsotj�}|j|jtjtjBtjBtjB�tj|�}|j	�}|j|j
dtjdtjd|�|jddd|�|j
�|j	�}|j|�}|j�}|jd
|j��ddl}tjdkr|jd	�|j
�|j�n?|j�}|j�z|jd	�|j
�Wd|j�X|jtj|j�dS(NtdbtypetflagsttxntXXXtyyyi�iiR(R?R@(ii(RRRR
tDB_INIT_TXNRtDB_INIT_LOGRRt	txn_beginRtDB_HASHRtcommitR&tdupRR'twarningstsystversion_infotsimplefiltert
resetwarningstcatch_warningst	__enter__t__exit__RtDBCursorClosedError(RR R!R>tc1tc2RGtw((s1/sys/lib/python2.7/bsddb/test/test_early_close.pyt"test06_close_txn_before_dup_cursor�s2!





cCs}ddl}|jj|j|j�}tj�}|j|tjtj	tj
Bd�tj|�}|j�|j�dS(Ni�i�(
R+R,R-R
RRRRRRRt
DBSequenceR(RR.R,R!R3((s1/sys/lib/python2.7/bsddb/test/test_early_close.pyttest07_close_db_before_sequence�s#
(t__name__t
__module__R
RR#R*R/R6R;RSRU(((s1/sys/lib/python2.7/bsddb/test/test_early_close.pyRs						$		-cCs&tj�}|jtjt��|S(N(tunittestt	TestSuitetaddTestt	makeSuiteR(tsuite((s1/sys/lib/python2.7/bsddb/test/test_early_close.pyt
test_suite�st__main__tdefaultTestR](t__doc__R.RHRXttest_allRRRRRRGR8tfilterwarningstRuntimeWarningtTestCaseRR]RVtmain(((s1/sys/lib/python2.7/bsddb/test/test_early_close.pyt<module>s(
�

Bell Labs OSI certified Powered by Plan 9

(Return to Plan 9 Home Page)

Copyright © 2021 Plan 9 Foundation. All Rights Reserved.
Comments to webmaster@9p.io.