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: 18.116.163.144
User: edustar (269686) | Group: tty (888)
Safe Mode: OFF
Disable Function:
NONE

name : test_fcntl.cpython-310.pyc
o

`b��@s�dZddlZddlZddlZddlZddlZddlmZddlm	Z	m
Z
ddlmZddl
mZmZed�Zdd	�Ze�ZGd
d�d�Zdd
�Zdd�ZGdd�dej�Zedkr_e��dSdS)z%Test program for the fcntl C module.
�N)�Process)�verbose�cpython_only)�
import_module)�TESTFN�unlink�fcntlc
CsztjWntyd}Ynwd}tj�d�stjdkr@t�d�dkr*d}d}nd}d}t�|||d	d
d
d
t	j
d
�}n6tj�d�rSt�dd
d
d
t	j
d
d
�}n#tjd
vrft�dt	j
d
d
d
d
d
d
�}nt�d	|d	t	j
d
d
d
d
d
�}|r�tr�tdt
|��|S)NZllZqq)ZnetbsdZfreebsdZopenbsd�darwin�l��iZlxxxxZhhrZgnukfreebsdZqqihhi)zhp-uxBZ	unixware7Zhhllliiz
struct.pack: )�os�O_LARGEFILE�AttributeError�sys�platform�
startswith�struct�calcsize�packr�F_WRLCKr�print�repr)Z	start_lenZoff_tZpid_t�lockdata�r�8/usr/local/python-3.10/lib/python3.10/test/test_fcntl.py�get_lockdatas4
���
 rc@seZdZdd�Zdd�ZdS)�BadFilecCs
||_dS�N��fn)�selfr rrr�__init__3�
zBadFile.__init__cCs|jSrr�r!rrr�fileno5szBadFile.filenoN)�__name__�
__module__�__qualname__r"r%rrrrr2srcCsVt|d�}z zt�||�Wn	tyYnwW|��dSW|��dS|��w�N�wb+)�openr�lockf�BlockingIOError�close�Zfname�cmd�frrr�try_lockf_on_other_process_fail8s
���r2cCs0t|d�}t�||�t�|tj�|��dSr))r+rr,�LOCK_UNr.r/rrr�try_lockf_on_other_processAs
r4c@s�eZdZdd�Zdd�Zdd�Zdd�Zd	d
�Zedd��Z	e
�e�
��d
�o,e��dkd�dd��Zdd�Ze
�e��dkd�dd��Ze
�e��dkd�dd��Zedd��Ze
�ejdkd�dd��Ze
�eed �oqeed!�d"�d#d$��Zd%S)&�	TestFcntlcCs
d|_dSr)r1r$rrr�setUpIr#zTestFcntl.setUpcCs$|jr|jjs|j��tt�dSr)r1�closedr.rrr$rrr�tearDownLs
zTestFcntl.tearDowncCshttd�|_t�|j��tjtj�}trt	d|�t�|j��tj
t�}tr-t	dt|��|j�
�dS�N�wbz#Status from fcntl with O_NONBLOCK: z!String from fcntl with F_SETLKW: )r+rr1rr%�F_SETFLr
�
O_NONBLOCKrr�F_SETLKWrrr.�r!�rvrrr�test_fcntl_filenoQs
zTestFcntl.test_fcntl_filenocCs`ttd�|_t�|jtjtj�}trtd|�t�|jtj	t
�}tr)tdt|��|j��dSr9)
r+rr1rr;r
r<rrr=rrr.r>rrr�test_fcntl_file_descriptor\s
z$TestFcntl.test_fcntl_file_descriptorcCs�|�t��t�dtjtj�Wd�n1swY|�t��t�td�tjtj�Wd�n1s9wY|�t��t�dtjtj�Wd�n1sWwY|�t��t�td�tjtj�Wd�dS1sxwYdS)N����spam)�assertRaises�
ValueErrorrr;r
r<r�	TypeErrorr$rrr�test_fcntl_bad_filegs���"�zTestFcntl.test_fcntl_bad_filecCsddlm}m}|�t��t�|dtjtj�Wd�n1s#wY|�t��t�t	|d�tjtj�Wd�n1sEwY|�t��t�|dtjtj�Wd�n1sewY|�t��t�t	|d�tjtj�Wd�dS1s�wYdS)Nr)�INT_MAX�INT_MIN�)
�	_testcapirHrIrD�
OverflowErrorrr;r
r<r)r!rHrIrrr�test_fcntl_bad_file_overflowqs���"�z&TestFcntl.test_fcntl_bad_file_overflowZarmZLinuxz2ARM Linux returns EINVAL for F_NOTIFY DN_MULTISHOTc	Csxztj}tj}Wnty|�d�Ynwt�tj�tj�	t
��tj�}zt�|||�Wt�|�dSt�|�w)Nz$F_NOTIFY or DN_MULTISHOT unavailable)
r�F_NOTIFY�DN_MULTISHOTrZskipTestr
r+�path�dirname�abspathr�O_RDONLYr.)r!r0�flags�fdrrr�test_fcntl_64_bit~s
�zTestFcntl.test_fcntl_64_bitcCs�ttd�|_|j��}t�|tj�t�|tj�t�|jtjtjB�t�|jtj�t�|tj	�t�|tj�|�
ttjdtj�|�
ttjdtj�dS)Nr*rBrC)
r+rr1r%r�flock�LOCK_SHr3�LOCK_NB�LOCK_EXrDrErF)r!r%rrr�
test_flock�s
zTestFcntl.test_flockZAIXzAIX returns PermissionErrorcC�httd�|_tjtjB}t�|j|�ttt|fd�}|�	�|�
�t�|jtj�|�|j
d�dS�Nr*)�target�argsr)r+rr1rrZrYr,rr2�start�joinr3�assertEqual�exitcode�r!r0�prrr�test_lockf_exclusive��zTestFcntl.test_lockf_exclusivecCr\r])r+rr1rrXrYr,rr4r`rar3rbrcrdrrr�test_lockf_share�rgzTestFcntl.test_lockf_sharecCs&ddl}|�ttj|jdtj�dS)NrrJ)rKrDrLrrWrHrX)r!rKrrr�test_flock_overflow�s�zTestFcntl.test_flock_overflowr	z$F_GETPATH is only available on macoscCsLttd�|_tj�t��d�}t�|j��tj	t
t|���}|�||�dS)Nr:zutf-8)
r+rr1r
rPrR�encoderr%Z	F_GETPATH�bytes�lenrb)r!Zexpected�resrrr�test_fcntl_f_getpath�szTestFcntl.test_fcntl_f_getpath�F_SETPIPE_SZ�F_GETPIPE_SZzAF_SETPIPE_SZ and F_GETPIPE_SZ are not available on all platforms.c	Cs�t��\}}z4t�|tj�}|d}|dkrt�d��t�|tj|�|�t�|tj�|�Wt�|�t�|�dSt�|�t�|�w)N�iz+default pipesize too small to perform test.)	r
�piperrp�unittestZSkitTestrorbr.)r!Ztest_pipe_rZtest_pipe_wZpipesize_default�pipesizerrr�test_fcntl_f_pipesize�s ��

�zTestFcntl.test_fcntl_f_pipesizeN)r&r'r(r6r8r@rArGrrMrsZskipIfr�machiner�systemrVr[rfrhrirrnZ
skipUnless�hasattrrrurrrrr5Gs6

�






�r5�__main__)�__doc__rr
rrrs�multiprocessingrZtest.supportrrZtest.support.import_helperrZtest.support.os_helperrrrrrrr2r4ZTestCaser5r&�mainrrrr�<module>s*	�
© 2025 GrazzMean