Uname: Linux web3.us.cloudlogin.co 5.10.226-xeon-hst #2 SMP Fri Sep 13 12:28:44 UTC 2024 x86_64
Software: Apache
PHP version: 8.1.31 [ PHP INFO ] PHP os: Linux
Server Ip: 162.210.96.117
Your Ip: 3.141.190.247
User: edustar (269686) | Group: tty (888)
Safe Mode: OFF
Disable Function:
NONE

name : test_posix.pyo
�
?��cc@s?dZddlmZejd�ZddlZddlZddlZddlZddl	Z	ddl
Z
ddlZddlZddlZddl
Z
ddlZddlZejje
j�ejd�Zejdde�dejfd	��YZd
ejfd��YZd�Zed
kr;e�ndS(sTest posix functionsi����(ttest_supporttposixNs-dummy-symlinktignores.* potential security risk .*tPosixTestercBseZd�Zd�Zd�Zejeed�d�d��Z	ejeed�d�d��Z
ejeed	�d
�d��Zejeed	�d
�d��Zejeed
�d�d��Z
ejeed
�d�d��Zejeed�d�d��Zejeed�d�d��Zejeed�d�d��Zejeed�d�d��Zejeed�d�d��Zejeed �d!�d"��Zejeed#�d$�d%��Zd&�Zejeed'�d(�d)��Zejeed'�d(�d*��Zejeed'�okejjd+�d(�d,��Zejeed-�d.�d/��Zejeed0�d1�d2��Zejeed3�d4�d5��Zejeed6�d7�d8��Z ejeed6�d7�ejeed9�d:�d;���Z!d<�Z"ejeed=�d>�d?��Z#ejeed@�dA�dB��Z$ejeedC�dD�dE��Z%ejeedF�dG�dH��Z&ejeedI�dJ�dK��Z'ejeedL�dM�dN��Z(ejeedO�dP�dQ��Z)ejeedR�dS�dT��Z*ejeedU�dV�dW��Z+ejeedX�dY�dZ��Z,ejeed[�d\�d]��Z-ejeed^�d_�d`��Z.da�Z/ejeedb�dc�dd��Z0ejeede�df�dg��Z1ejeede�df�dh��Z2ejee3di�dj�dk��Z4ejeedl�dm�dn��Z5ejee3do�dp�dq��Z6e7j8dr��Z9ds�Z:RS(tcCs/ttjd�}|j�tjg|_dS(Nsw+(topenRtTESTFNtclosetteardown_files(tselftfp((s6/usr/local/python-2.7/lib/python2.7/test/test_posix.pytsetUps
cCs%x|jD]}tj|�q
WdS(N(Rtostunlink(Rt
teardown_file((s6/usr/local/python-2.7/lib/python2.7/test/test_posix.pyttearDown#scCs�ddddddddd	d
ddd
ddg}tj��dtjddt�xI|D]A}tt|d�}|dk	rZ|�|jt|d�qZqZWWdQXdS(Ntctermidtgetcwdtgetcwdutunamettimest
getloadavgttmpnamtgetegidtgeteuidtgetgidt	getgroupstgetpidtgetpgrptgetppidtgetuidRti(	twarningstcatch_warningstfilterwarningstDeprecationWarningtgetattrRtNonetassertRaisest	TypeError(RtNO_ARG_FUNCTIONStnamet
posix_func((s6/usr/local/python-2.7/lib/python2.7/test/test_posix.pyttestNoArgFunctions's	

t	getresuidstest needs posix.getresuid()cCsGtj�}|jt|�d�x|D]}|j|d�q)WdS(Nii(RR+tassertEqualtlentassertGreaterEqual(Rtuser_idstval((s6/usr/local/python-2.7/lib/python2.7/test/test_posix.pyttest_getresuid8s
t	getresgidstest needs posix.getresgid()cCsGtj�}|jt|�d�x|D]}|j|d�q)WdS(Nii(RR2R,R-R.(Rt	group_idsR0((s6/usr/local/python-2.7/lib/python2.7/test/test_posix.pyttest_getresgid@s
t	setresuidstest needs posix.setresuid()cCsBtj�}|jtj|��|jtjddd��dS(Ni����(RR+tassertIsNoneR5(Rtcurrent_user_ids((s6/usr/local/python-2.7/lib/python2.7/test/test_posix.pyttest_setresuidHscCsLtj�}d|krH|ddddf}|jttj|�ndS(Niii����(RR+R%tOSErrorR5(RR7tnew_user_ids((s6/usr/local/python-2.7/lib/python2.7/test/test_posix.pyttest_setresuid_exceptionPst	setresgidstest needs posix.setresgid()cCsBtj�}|jtj|��|jtjddd��dS(Ni����(RR2R6R<(Rtcurrent_group_ids((s6/usr/local/python-2.7/lib/python2.7/test/test_posix.pyttest_setresgidYscCsLtj�}d|krH|ddddf}|jttj|�ndS(Niii����(RR2R%R9R<(RR=t
new_group_ids((s6/usr/local/python-2.7/lib/python2.7/test/test_posix.pyttest_setresgid_exceptionast
initgroupsstest needs os.initgroups()cCs|jttj�|jttjd�|jttjdd�|jttjddt��tj�dkrytj	tj��j
}Wn tk
r�tj
d��nXytj|d�Wn)tk
r�}|j|jtj�qX|jd�ndS(Nitfooisneed a pwd entryi
s+Expected OSError to be raised by initgroups(R%R&RRAR$tobjectRRtpwdtgetpwuidtpw_nametKeyErrortunittesttSkipTestR9R,terrnotEPERMtfail(RR(te((s6/usr/local/python-2.7/lib/python2.7/test/test_posix.pyttest_initgroupsjs
tstatvfsstest needs posix.statvfs()cCs|jtjtj��dS(N(t
assertTrueRRORtcurdir(R((s6/usr/local/python-2.7/lib/python2.7/test/test_posix.pyttest_statvfs�stfstatvfsstest needs posix.fstatvfs()cCsAttj�}z |jtj|j���Wd|j�XdS(N(RRRRPRRStfilenoR(RR	((s6/usr/local/python-2.7/lib/python2.7/test/test_posix.pyt
test_fstatvfs�s t	ftruncatestest needs posix.ftruncate()cCsUttjd�}z1|jd�|j�tj|j�d�Wd|j�XdS(Nsw+ttesti(	RRRtwritetflushRRVRTR(RR	((s6/usr/local/python-2.7/lib/python2.7/test/test_posix.pyttest_ftruncate�s

tdupstest needs posix.dup()cCsWttj�}z6tj|j��}|j|t�tj	|�Wd|j	�XdS(N(
RRRRR[RTtassertIsInstancetintRR(RR	tfd((s6/usr/local/python-2.7/lib/python2.7/test/test_posix.pyttest_dup�stconfstrstest needs posix.confstr()cCs?|jttjd�|jttjd��dkt�dS(Nt
CS_garbagetCS_PATHi(R%t
ValueErrorRR`R,R-tTrue(R((s6/usr/local/python-2.7/lib/python2.7/test/test_posix.pyttest_confstr�stdup2stest needs posix.dup2()cCsZttj�}ttj�}z tj|j�|j��Wd|j�|j�XdS(N(RRRRRfRTR(Rtfp1tfp2((s6/usr/local/python-2.7/lib/python2.7/test/test_posix.pyt	test_dup2�s 
cGs8tjtjtj�}tj||�}|j�dS(N(RRRRtO_RDONLYRtfdopenR(RtargsR^Rh((s6/usr/local/python-2.7/lib/python2.7/test/test_posix.pyt
fdopen_helper�sRkstest needs posix.fdopen()cCs+|j�|jd�|jdd�dS(Ntrid(Rm(R((s6/usr/local/python-2.7/lib/python2.7/test/test_posix.pyttest_fdopen�s

cCs�y,tjdtj�}|jtj|�Wn6tk
rd}|j|jtj�|j	d�nX|j
t��}tj|d�WdQX|j|j
jtj�dS(Nt.ssystem cannot open directoriesRn(RRRjt
addCleanupRR9R,RJtEACCEStskipTestR%tIOErrorRkt	exceptiontEISDIR(RR^RMtcm((s6/usr/local/python-2.7/lib/python2.7/test/test_posix.pyttest_fdopen_directory�stsunoscCsBtjtjtj�}|jttj|d�tj	|�dS(Ntw(
RRRRRjR%R9RRkR(RR^((s6/usr/local/python-2.7/lib/python2.7/test/test_posix.pyt#test_fdopen_keeps_fd_open_on_errors�stO_EXLOCKstest needs posix.O_EXLOCKcCs�tjtjtjtjBtjB�}|jttjtjtjtjBtj	B�tj
|�ttd�r�tjtjtjtj
BtjB�}|jttjtjtjtjBtj	B�tj
|�ndS(NtO_SHLOCK(RRRRtO_WRONLYR|tO_CREATR%R9t
O_NONBLOCKRthasattrRR}(RR^((s6/usr/local/python-2.7/lib/python2.7/test/test_posix.pyt
test_osexlock�s
R}stest needs posix.O_SHLOCKcCs�tjtjtjtjBtjB�}tjtjtjtjBtjB�}tj|�tj|�tt	d�r�tjtjtjtjBtjB�}|j
ttjtjtjtj
BtjB�tj|�ndS(NR|(RRRRR~R}RRR�RR%R9RjR|R�(Rtfd1tfd2R^((s6/usr/local/python-2.7/lib/python2.7/test/test_posix.pyt
test_osshlock�s

tfstatstest needs posix.fstat()cCsAttj�}z |jtj|j���Wd|j�XdS(N(RRRRPRR�RTR(RR	((s6/usr/local/python-2.7/lib/python2.7/test/test_posix.pyt
test_fstat�s tstatstest needs posix.stat()cCs|jtjtj��dS(N(RPRR�RR(R((s6/usr/local/python-2.7/lib/python2.7/test/test_posix.pyt	test_statstmakedevstest needs posix.makedev()cCs�tjtj�}|j}|j|ttf�|j|d�tj	|�}|j|ttf�|j|d�|j
tj	t|��|�|j
tj	t|��|�|jttj	t
|��|jttj	�|jttftj	d�tj|�}|j|ttf�|j|d�|j
tjt|��|�|j
tjt|��|�|jttjt
|��|jttj�|jttftjd�tjjd�r�|dkr�|jd�n|j
tj||�|�|j
tjt|�t|��|�|j
tjt|�t|��|�|jttjt
|�|�|jttj|t
|��|jttj|�|jttj�dS(Nii����tfreebsdIsEbpo-31044: on FreeBSD CURRENT, minor() truncates 64-bit dev to 32-bit(RR�RRtst_devR\R]tlongR.tmajorR,R%R&tfloatRct
OverflowErrortminortsystplatformt
startswithRsR�(RtsttdevR�R�((s6/usr/local/python-2.7/lib/python2.7/test/test_posix.pyttest_makedev	s:	((c	s���fd�}tj�}tj�}|�||�|||�|�d|�|||�|�|d�|||�|dkr�d
}|�||�|||�|�dd�|||�|�||�|||�n�tj�dkrtjd��n��jt|�dd�|||��jt|�dd�|||�dtj	�kr��jt|�dd�|||�nxlt
tfD]^}�jt|�||�|�|||��jt|�|||��|||�q�Wd	S(s/Common code for chown, fchown and lchown tests.csE�dk	rA���}�j|j|��j|j|�ndS(N(R$R,tst_uidtst_gid(tuidtgidR�(tfirst_paramRt	stat_func(s6/usr/local/python-2.7/lib/python2.7/test/test_posix.pyt
check_stat1si����iiisHP-UXtSunOSs1Skipping because of non-standard chown() behaviorNI�(sHP-UXR�(
RRRR�tsystemRHRIR%R9RtstrR�R&(	Rt
chown_funcR�R�R�R�R�t	big_valuett((R�RR�s6/usr/local/python-2.7/lib/python2.7/test/test_posix.pyt_test_all_chown_common/s>







tchownstest needs os.chown()cCsntjtj�|jttjtjdd�ttjd�j	�|j
tjtjttdd��dS(Ni����RzR�(
RRRRR%R9RR�RRR�R#R$(R((s6/usr/local/python-2.7/lib/python2.7/test/test_posix.pyt
test_chownjs
tfchownstest needs os.fchown()cCsftjtj�ttjd�}z2|j�}|jtj|t	tdd��Wd|j�XdS(NRzR�(RRRRRRTR�RR�R#R$R(Rt	test_fileR^((s6/usr/local/python-2.7/lib/python2.7/test/test_posix.pyttest_fchownustlchownstest needs os.lchown()cCsLtjtj�tjttj�|jtjtjt	tdd��dS(Ntlstat(RRRRtsymlinkt_DUMMY_SYMLINKR�RR�R#R$(R((s6/usr/local/python-2.7/lib/python2.7/test/test_posix.pyttest_lchown�stchdirstest needs posix.chdir()cCs-tjtj�|jttjtj�dS(N(RR�RRQR%R9RR(R((s6/usr/local/python-2.7/lib/python2.7/test/test_posix.pyt
test_chdir�stlsdirstest needs posix.lsdir()cCs#|jtjtjtj��dS(N(tassertInRRRR�RRQ(R((s6/usr/local/python-2.7/lib/python2.7/test/test_posix.pyt
test_lsdir�staccessstest needs posix.access()cCs#|jtjtjtj��dS(N(RPRR�RRRtR_OK(R((s6/usr/local/python-2.7/lib/python2.7/test/test_posix.pyttest_access�stumaskstest needs posix.umask()cCs0tjd�}|j|t�tj|�dS(Ni(RR�R\R](Rtold_mask((s6/usr/local/python-2.7/lib/python2.7/test/test_posix.pyt
test_umask�ststrerrorstest needs posix.strerror()cCs|jtjd��dS(Ni(RPRR�(R((s6/usr/local/python-2.7/lib/python2.7/test/test_posix.pyt
test_strerror�stpipestest needs posix.pipe()cCs0tj�\}}tj|�tj|�dS(N(RR�RR(Rtreadertwriter((s6/usr/local/python-2.7/lib/python2.7/test/test_posix.pyt	test_pipe�s
ttempnamstest needs posix.tempnam()cCsrtj��`tjddt�|jtj��|jtjtj��|jtjtjd��WdQXdS(NRR�tblah(	RR R!R"RPRR�RRQ(R((s6/usr/local/python-2.7/lib/python2.7/test/test_posix.pyttest_tempnam�s

ttmpfilestest needs posix.tmpfile()cCs@tj��.tjddt�tj�}|j�WdQXdS(NRR�(RR R!R"RR�R(RR	((s6/usr/local/python-2.7/lib/python2.7/test/test_posix.pyttest_tmpfile�s
tutimestest needs posix.utime()cCs�tj�}tjtjd�|jttjtjd�|jttjtj|df�|jttjtjd|f�tjtjt|�t|�f�tjtj||f�dS(N(NN(	ttimeRR�RRR$R%R&R](Rtnow((s6/usr/local/python-2.7/lib/python2.7/test/test_posix.pyt
test_utime�s""%c	Cstj|�}|jt|d��y|||jtjB�Wn>tk
r�}|jtjkrj�nd}|j	|�nXzotj|�}|j
|jtjB|j�yt|d�}Wn)tk
r�}|j
|jtj
�nXWdtj||j�XdS(Ntst_flagss2chflag UF_IMMUTABLE not supported by underlying fssw+(RR�RPR�R�tUF_IMMUTABLER9RJt
EOPNOTSUPPRsR,RRtRKRtchflags(	Rtchflags_functtarget_fileR�terrtmsgtnew_stR^RM((s6/usr/local/python-2.7/lib/python2.7/test/test_posix.pyt_test_chflags_regular_file�s"R�stest needs os.chflags()cCs|jtjtj�dS(N(R�RR�RR(R((s6/usr/local/python-2.7/lib/python2.7/test/test_posix.pyttest_chflags�stlchflagsstest needs os.lchflags()cCs|jtjtj�dS(N(R�RR�RR(R((s6/usr/local/python-2.7/lib/python2.7/test/test_posix.pyttest_lchflags_regular_file�scCs,tjtj�}|jt|d��tjtjt�|jj	t�tj
t�}ytjt|j
tjB�Wn>tk
r�}|jtjkr��nd}|j|�nXzXtjtj�}tj
t�}|j|j
|j
�|j|j
tjB|j
�Wdtjt|j
�XdS(NR�s2chflag UF_IMMUTABLE not supported by underlying fs(RR�RRRPR�R�R�RtappendR�RR�R�R�R9RJR�RsR,(Rt	testfn_sttdummy_symlink_stR�R�t
new_testfn_sttnew_dummy_symlink_st((s6/usr/local/python-2.7/lib/python2.7/test/test_posix.pyttest_lchflags_symlink�s(	tputenvsrequires os.putenv()c	Csv|jt��tjdd�WdQX|jt��tjdd�WdQX|jt��tjdd�WdQXdS(NsFRUITVEGETABLEtcabbagetFRUITsorangeVEGETABLE=cabbagesFRUIT=ORANGEtlemon(R%R&RR�Rc(R((s6/usr/local/python-2.7/lib/python2.7/test/test_posix.pyttest_putenvsRstest needs posix.getcwd()cs�d}tj�}tjjtj�d}ytj|�tj|�Wn�jd�nXz#d��fd���|�Wdtj|�t	j
|�XdS(Ns8getcwd-test-directory-0123456789abcdef-01234567890abcdefs.getcwds#cannot create directory for testingics5ytj|�Wn�jd�nXtj|�z�y8tj�|dkro�||t|�d�nWn�tk
r}tj}dt	j
kp�dt	j
kp�dt	j
k}|r�tj}ndt	j
kr��j|jtj
tjf�q�j|j|�nXWdtjd�tj|�XdS(	Ns?mkdir cannot create directory sufficiently deep for getcwd testiiRytnetbsdtopenbsdtdarwins..(RtmkdirRsR�RR-R9RJtENAMETOOLONGR�R�tERANGER�tENOENTR,trmdir(tdirnametcurrent_path_lengthRMtexpected_errnotquirky_platform(t_create_and_do_getcwdR(s6/usr/local/python-2.7/lib/python2.7/test/test_posix.pyR�s,

"	"
(RRtpathtabspathRRR�R�Rstshutiltrmtree(RR�RQt	base_path((R�Rs6/usr/local/python-2.7/lib/python2.7/test/test_posix.pyttest_getcwd_long_pathnames	s
!
Rstest needs os.getegid()cCstjd��%}|j�j�}|j�}WdQX|dksI|r[tjd��ntj	dkr�ddl
}|jd�p�d}td�|j
d�d	d
!D��dkr�tjd
��q�n|jtg|j
�D]}t|�^q��ttj�tj�g��dS(Nsid -G 2>/dev/nullsneed working 'id -G'R�i����tMACOSX_DEPLOYMENT_TARGETs10.0css|]}t|�VqdS(N(R](t.0tn((s6/usr/local/python-2.7/lib/python2.7/test/test_posix.pys	<genexpr>KsRpiii
is$getgroups(2) is broken prior to 10.6(i
i(RtpopentreadtstripRR$RHRIR�R�t	sysconfigtget_config_varttupletsplitR,tsetR]RRR(RtidgtgroupstretR�tdttx((s6/usr/local/python-2.7/lib/python2.7/test/test_posix.pyttest_getgroups>s,(cCs?tj}y|jtj�Wn$ttfk
rC|jd�nX|d}|jtj|�tj|�d}z6|j
t��!tj|tj
tjB�}WdQXWd|dk	r�tj|�nX|jtjj|��|j
ttj|�|jtjj|��t|d�j�|j
ttj|�dS(Ns"Requires unicode filenames supportutwb(RtTESTFN_UNICODEtencodetTESTFN_ENCODINGtUnicodeErrorR&RsRqRR$R%RRR~RRtassertFalseR�texistsR�R�(Rtfntfn_with_NULR^((s6/usr/local/python-2.7/lib/python2.7/test/test_posix.pyttest_path_with_null_unicodeVs&	

&cCstj}|d}|jtj|�tj|�d}z6|jt��!tj|tj	tj
B�}WdQXWd|dk	r�tj|�nX|jtj
j|��|jttj|�|jtj
j|��t|d�j�|jttj|�dS(NsR(RRRqRR$R%R&RRR~RRRR�RR�R�(RR
RR^((s6/usr/local/python-2.7/lib/python2.7/test/test_posix.pyttest_path_with_null_bytems	

&(;t__name__t
__module__R
RR*RHt
skipUnlessR�RR1R4R8R;R>R@RNRRRURZR_ReRiRmRoRxR�R�R�R{R�R�R�R�R�R�R�R�R�R�R�R�R�R�R�R�R�R�R�R�R�R�RR�R�RRtrequires_unicodeRR(((s6/usr/local/python-2.7/lib/python2.7/test/test_posix.pyRs�			

	'%	;$$
$$$$$$$
	$$$$	4$tPosixGroupsTestercBsbeZd�Zd�Zejeed�d�d��Zejeed�d�d��Z	RS(cCsytj�dkr$tjd��nttd�sEtjd��ntjdkrftjd��ntj�|_dS(Nisnot enough privilegesRsneed posix.getgroupsR�sgetgroups(2) is broken on OSX(	RRRHRIR�R�R�Rtsaved_groups(R((s6/usr/local/python-2.7/lib/python2.7/test/test_posix.pyR
�scCsgttd�r"tj|j�nAttd�rctjtj��j}tj||jd�ndS(Nt	setgroupsRAi(	R�RRRRDRERRFRA(RR(((s6/usr/local/python-2.7/lib/python2.7/test/test_posix.pyR�s
RAstest needs posix.initgroups()cCs^t|jpdg�d}tjtj��j}tj||�|j|tj	��dS(Nii(
tmaxRRDRERRRFRAR�R(RtgR(((s6/usr/local/python-2.7/lib/python2.7/test/test_posix.pyRN�sRstest needs posix.setgroups()cCsGx@dgtd�gD])}tj|�|j|tj��qWdS(Nii(trangeRRtassertListEqualR(RR((s6/usr/local/python-2.7/lib/python2.7/test/test_posix.pyttest_setgroups�s
(
RRR
RRHRR�RRNR(((s6/usr/local/python-2.7/lib/python2.7/test/test_posix.pyR�s				cCstjtt�dS(N(Rtrun_unittestRR(((s6/usr/local/python-2.7/lib/python2.7/test/test_posix.pyt	test_main�st__main__(t__doc__RWRt
import_moduleRRJR�R�RR�RDR�R�ttempfileRHRR�tjoint
gettempdirRR�R!tRuntimeWarningtTestCaseRRRR(((s6/usr/local/python-2.7/lib/python2.7/test/test_posix.pyt<module>s2��g$	
© 2025 GrazzMean