Server : LiteSpeed
System : Linux server51.dnsbootclub.com 4.18.0-553.62.1.lve.el8.x86_64 #1 SMP Mon Jul 21 17:50:35 UTC 2025 x86_64
User : nandedex ( 1060)
PHP Version : 8.1.33
Disable Function : NONE
Directory :  /opt/cppython/lib/python3.8/test/__pycache__/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]


Current File : //opt/cppython/lib/python3.8/test/__pycache__/test_fcntl.cpython-38.opt-1.pyc
U

>��g��@s�dZddlZddlZddlZddlZddlZddlmZddlm	Z	m
Z
mZmZm
Z
mZe
d�Zdd�Ze�ZGdd	�d	�Zd
d�Zdd
�ZGdd�dej�Zdd�Zedkr�e�dS)z%Test program for the fcntl C module.
�N)�Process)�verbose�TESTFN�unlink�run_unittest�
import_module�cpython_only�fcntlc
Csz
tjWntk
r"d}YnXd}tj�d�s>tjdkr�t�d�dkrVd}d}nd}d}t�|||d	d
d
d
t	j
d
�}nltj�d�r�t�dd
d
d
t	j
d
d
�}nFtjd
kr�t�dt	j
d
d
d
d
d
d
�}n t�d	|d	t	j
d
d
d
d
d
�}|�rt�rtdt
|��|S)NZllZqq)ZnetbsdZfreebsdZopenbsd�darwin�l��iZlxxxxZhhrZgnukfreebsdZqqihhi)zhp-uxBZ	unixware7Zhhllliiz
struct.pack: )�os�O_LARGEFILE�AttributeError�sys�platform�
startswith�struct�calcsize�packr	ZF_WRLCKr�print�repr)Z	start_lenZoff_tZpid_t�lockdata�r�./opt/cppython/lib/python3.8/test/test_fcntl.py�get_lockdatas4

��
 rc@seZdZdd�Zdd�ZdS)�BadFilecCs
||_dS�N��fn)�selfr rrr�__init__1szBadFile.__init__cCs|jSrr�r!rrr�fileno3szBadFile.filenoN)�__name__�
__module__�__qualname__r"r$rrrrr0srcCsDt|d�}z*zt�||�Wntk
r0YnXW5|��XdS�N�wb+)�open�closer	�lockf�BlockingIOError�Zfname�cmd�frrr�try_lockf_on_other_process_fail6s

r1cCs0t|d�}t�||�t�|tj�|��dSr()r*r	r,�LOCK_UNr+r.rrr�try_lockf_on_other_process?s
r3c@s�eZdZdd�Zdd�Zdd�Zdd�Zd	d
�Zedd��Z	e
�e�
��d
�oXe��dkd�dd��Zdd�Ze
�e��dkd�dd��Ze
�e��dkd�dd��Zedd��ZdS)�	TestFcntlcCs
d|_dSr)r0r#rrr�setUpGszTestFcntl.setUpcCs$|jr|jjs|j��tt�dSr)r0�closedr+rrr#rrr�tearDownJs
zTestFcntl.tearDowncCshttd�|_t�|j��tjtj�}tr2t	d|�t�|j��tj
t�}trZt	dt|��|j�
�dS�N�wbz#Status from fcntl with O_NONBLOCK: z!String from fcntl with F_SETLKW: )r*rr0r	r$�F_SETFLr�
O_NONBLOCKrr�F_SETLKWrrr+�r!�rvrrr�test_fcntl_filenoOs
zTestFcntl.test_fcntl_filenocCs`ttd�|_t�|jtjtj�}tr.td|�t�|jtj	t
�}trRtdt|��|j��dSr8)
r*rr0r	r:rr;rrr<rrr+r=rrr�test_fcntl_file_descriptorZs
z$TestFcntl.test_fcntl_file_descriptorc	Cs�|�t��t�dtjtj�W5QRX|�t��t�td�tjtj�W5QRX|�t��t�dtjtj�W5QRX|�t��t�td�tjtj�W5QRXdS)N����spam)�assertRaises�
ValueErrorr	r:rr;r�	TypeErrorr#rrr�test_fcntl_bad_filees zTestFcntl.test_fcntl_bad_filec	Cs�ddlm}m}|�t��t�|dtjtj�W5QRX|�t�� t�t	|d�tjtj�W5QRX|�t��t�|dtjtj�W5QRX|�t�� t�t	|d�tjtj�W5QRXdS)Nr)�INT_MAX�INT_MIN�)
�	_testcapirGrHrC�
OverflowErrorr	r:rr;r)r!rGrHrrr�test_fcntl_bad_file_overflowos $ z&TestFcntl.test_fcntl_bad_file_overflowZarmZLinuxz2ARM Linux returns EINVAL for F_NOTIFY DN_MULTISHOTc	Csrztj}tj}Wntk
r.|�d�YnXt�tj�tj�	t
��tj�}zt�|||�W5t�|�XdS)Nz$F_NOTIFY or DN_MULTISHOT unavailable)
r	ZF_NOTIFYZDN_MULTISHOTrZskipTestrr*�path�dirname�abspathr�O_RDONLYr+)r!r/�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)rArB)
r*rr0r$r	�flock�LOCK_SHr2�LOCK_NB�LOCK_EXrCrDrE)r!r$rrr�
test_flock�s
zTestFcntl.test_flockZAIXzAIX returns PermissionErrorcCshttd�|_tjtjB}t�|j|�ttt|fd�}|�	�|�
�t�|jtj�|�|j
d�dS�Nr))�target�argsr)r*rr0r	rWrVr,rr1�start�joinr2�assertEqual�exitcode�r!r/�prrr�test_lockf_exclusive�szTestFcntl.test_lockf_exclusivecCshttd�|_tjtjB}t�|j|�ttt|fd�}|�	�|�
�t�|jtj�|�|j
d�dSrY)r*rr0r	rUrVr,rr3r\r]r2r^r_r`rrr�test_lockf_share�szTestFcntl.test_lockf_sharecCs&ddl}|�ttj|jdtj�dS)NrrI)rJrCrKr	rTrGrU)r!rJrrr�test_flock_overflow�s�zTestFcntl.test_flock_overflowN)r%r&r'r5r7r?r@rFrrL�unittestZskipIfr�machiner�systemrSrXrbrcrdrrrrr4Es&

�




r4cCstt�dSr)rr4rrrr�	test_main�srh�__main__)�__doc__rrrrre�multiprocessingrZtest.supportrrrrrrr	rrrr1r3ZTestCaser4rhr%rrrr�<module>s" 	t

F1le Man4ger