Current File : //usr/local/apps/python3/lib/python3.11/test/__pycache__/test_fcntl.cpython-311.opt-2.pyc |
�
�Ke� � � � d dl Z d dlZd dlZd dlZd dlZd dlmZ d dlmZm Z d dl
mZ d dlm
Z
mZ ed� � Zd� Z e� � Z G d� d � � Zd
� Zd� Z G d� d
ej � � Zedk r ej � � dS dS )� N)�Process)�verbose�cpython_only)�
import_module)�TESTFN�unlink�fcntlc
�� � t j d} n# t $ r d} Y nw xY wt j � d� � st j dk rNt
j d� � dk rd}d}nd}d}t
j ||z |z d z d
d
d
t j
d
� � }n�t j � d� � r%t
j dd
d
d
t j
d
d
� � }n^t j d
v r&t
j dt j
d
d
d
d
d
d
� � }n*t
j d | z d z t j
d
d
d
d
d
� � }|r$t rt dt |� � � � |S )N�qq�ll)�netbsd�freebsd�openbsd�darwin�l� �i�lxxxx�hhr �gnukfreebsd�qqihhi)zhp-uxB� unixware7�hhllliiz
struct.pack: )�os�O_LARGEFILE�AttributeError�sys�platform�
startswith�struct�calcsize�packr �F_WRLCKr �print�repr)� start_len�off_t�pid_t�lockdatas �9/usr/local/apps/python3/lib/python3.11/test/test_fcntl.py�get_lockdatar+ sy � ��
��� � � �� � � � �� � � �����
���� @�A�A� R��<�8�#�#��?�3���1�$�$��E��E�E��E��E��;�u�u�}�u�4�t�;�Q��1�$�}�a�1� 1��� �� � �� /� /� R��;�x��A�q�%�-��A�F�F��� ��0� 0� 0��;�y�%�-��A�q�!�Q��J�J����;�t�I�~�d�2�E�M�1�a��A�q�Q�Q��� 3�� 3��/�4��>�>�2�2�2��Os � � � c � � e Zd Zd� Zd� ZdS )�BadFilec � � || _ d S �N��fn)�selfr1 s r* �__init__zBadFile.__init__3 s
� ������ c � � | j S r/ r0 �r2 s r* �filenozBadFile.fileno5 s � ��w�r4 N)�__name__�
__module__�__qualname__r3 r7 � r4 r* r- r- 2 s2 � � � � � �� � �� � � � r4 r- c �� � t | d� � } t � ||� � n# t $ r Y nw xY w|� � � d S # |� � � w xY w�N�wb+)�openr �lockf�BlockingIOError�close��fname�cmd�fs r* �try_lockf_on_other_process_failrG 8 sr � ��U�E���A��
���A�s�������
�
�
���
����
��� � � � � ����� � � � ���s! �. �A �
;�A �;�A �A*c �� � t | d� � }t � ||� � t � |t j � � |� � � d S r= )r? r r@ �LOCK_UNrB rC s r* �try_lockf_on_other_processrJ A sL � ��U�E���A� �K�K��3���� �K�K��5�=�!�!�!��G�G�I�I�I�I�Ir4 c �J � e Zd Zd� Zd� Zd� Zd� Zd� Zed� � � Z e
j ej
� � � d� � o ej � � dk d � � d
� � � Zd� Z e
j ej � � dk d
� � d� � � Z e
j ej � � dk d
� � d� � � Zed� � � Z e
j ej dk d� � d� � � Z e
j eed� � o eed� � d� � d� � � ZdS )� TestFcntlc � � d | _ d S r/ )rF r6 s r* �setUpzTestFcntl.setUpI s
� �����r4 c � � | j r%| j j s| j � � � t t � � d S r/ )rF �closedrB r r r6 s r* �tearDownzTestFcntl.tearDownL s5 � ��6� �$�&�-� ��F�L�L�N�N�N��v�����r4 c �� � t t d� � | _ t � | j � � � t j t j � � }t rt d|� � t � | j � � � t j
t � � }t rt dt |� � � � | j �
� � d S �N�wbz#Status from fcntl with O_NONBLOCK: z!String from fcntl with F_SETLKW: )r? r rF r r7 �F_SETFLr �
O_NONBLOCKr r$ �F_SETLKWr) r% rB �r2 �rvs r* �test_fcntl_filenozTestFcntl.test_fcntl_filenoQ s� � ��f�d�#�#���
�[�[�������%�-���
G�
G��� =��7��<�<�<�
�[�[�������%�.�(�
C�
C��� A��5�t�B�x�x�@�@�@���������r4 c � � t t d� � | _ t � | j t j t
j � � }t rt d|� � t � | j t j t � � }t rt dt |� � � � | j � � � d S rS )
r? r rF r rU r rV r r$ rW r) r% rB rX s r* �test_fcntl_file_descriptorz$TestFcntl.test_fcntl_file_descriptor\ s� � ��f�d�#�#���
�[�[������
�
>�
>��� =��7��<�<�<�
�[�[������
:�
:��� A��5�t�B�x�x�@�@�@���������r4 c �L � | � t � � 5 t � dt j t j � � d d d � � n# 1 swxY w Y | � t � � 5 t � t
d� � t j t j � � d d d � � n# 1 swxY w Y | � t � � 5 t � dt j t j � � d d d � � n# 1 swxY w Y | � t � � 5 t � t
d� � t j t j � � d d d � � d S # 1 swxY w Y d S )N����spam)�assertRaises�
ValueErrorr rU r rV r- � TypeErrorr6 s r* �test_fcntl_bad_filezTestFcntl.test_fcntl_bad_fileg sN � �
�
�
�z�
*�
*� :� :��K�K��E�M�2�=�9�9�9� :� :� :� :� :� :� :� :� :� :� :���� :� :� :� :�
�
�
�z�
*�
*� C� C��K�K�����U�]�B�M�B�B�B� C� C� C� C� C� C� C� C� C� C� C���� C� C� C� C�
�
�
�y�
)�
)� >� >��K�K���
�r�}�=�=�=� >� >� >� >� >� >� >� >� >� >� >���� >� >� >� >�
�
�
�y�
)�
)� G� G��K�K��������
�F�F�F� G� G� G� G� G� G� G� G� G� G� G� G���� G� G� G� G� G� GsG �1A�A�A�=>C�C�C�,1D)�)D-�0D-�>F�F� Fc �t � ddl m}m} | � t � � 5 t
� |dz t
j t j � � d d d � � n# 1 swxY w Y | � t � � 5 t
� t |dz � � t
j t j � � d d d � � n# 1 swxY w Y | � t � � 5 t
� |dz
t
j t j � � d d d � � n# 1 swxY w Y | � t � � 5 t
� t |dz
� � t
j t j � � d d d � � d S # 1 swxY w Y d S )Nr )�INT_MAX�INT_MIN� )
� _testcapire rf r` �
OverflowErrorr rU r rV r- )r2 re rf s r* �test_fcntl_bad_file_overflowz&TestFcntl.test_fcntl_bad_file_overflowq s� � �.�.�.�.�.�.�.�.�
�
�
�}�
-�
-� C� C��K�K��!��U�]�B�M�B�B�B� C� C� C� C� C� C� C� C� C� C� C���� C� C� C� C�
�
�
�}�
-�
-� L� L��K�K���!��,�,�e�m�R�]�K�K�K� L� L� L� L� L� L� L� L� L� L� L���� L� L� L� L�
�
�
�}�
-�
-� C� C��K�K��!��U�]�B�M�B�B�B� C� C� C� C� C� C� C� C� C� C� C���� C� C� C� C�
�
�
�}�
-�
-� L� L��K�K���!��,�,�e�m�R�]�K�K�K� L� L� L� L� L� L� L� L� L� L� L� L���� L� L� L� L� L� LsI �4A#�#A'�*A'�AC�C�C�:4D:�:D>�D>�AF-�-F1�4F1�arm�Linuxz2ARM Linux returns EINVAL for F_NOTIFY DN_MULTISHOTc �� � t j }t j }n%# t $ r | � d� � Y nw xY wt j t
j � t
j � t � � � � t
j � � } t � |||� � t j |� � d S # t j |� � w xY w)Nz$F_NOTIFY or DN_MULTISHOT unavailable)
r �F_NOTIFY�DN_MULTISHOTr �skipTestr r? �path�dirname�abspathr �O_RDONLYrB )r2 rE �flags�fds r* �test_fcntl_64_bitzTestFcntl.test_fcntl_64_bit~ s� � � B��.�C��&�E�E��� B� B� B��M�M�@�A�A�A�A�A� B����
�W�R�W�_�_�R�W�_�_�V�%<�%<�=�=�r�{�
K�
K�� ��K�K��C��'�'�'��H�R�L�L�L�L�L��B�H�R�L�L�L�L���s � �=�=�C �C'c � � t t d� � | _ | j � � � }t � |t j � � t � |t j � � t � | j t j t j z � � t � | j t j � � t � |t j � � t � |t j � � | �
t t j dt j � � | �
t t j dt j � � d S )Nr>