%PDF- %PDF-
Mini Shell

Mini Shell

Direktori : /lib/python3/dist-packages/systemd/test/__pycache__/
Upload File :
Create Path :
Current File : //lib/python3/dist-packages/systemd/test/__pycache__/test_daemon.cpython-312.pyc

�

���bS/���ddlZddlZddlZddlZddlZddlZddlmZmZm	Z	m
Z
mZmZm
Z
mZmZmZmZmZmZmZmZmZddlZej0d��Zej0d��Zd�Zd�Zd�Zd�Zd	�Zd
�Z d�Z!d�Z"d
�Z#d�Z$d�Z%d�Z&d�Z'd�Z(d�Z)d�Z*d�Z+d�Z,d�Z-d�Z.d�Z/d�Z0d�Z1ejddk\re3Z4ne5Z4d�Z6d�Z7d�Z8y) �N)�booted�is_fifo�_is_fifo�	is_socket�
_is_socket�is_socket_inet�_is_socket_inet�is_socket_unix�_is_socket_unix�is_socket_sockaddr�_is_socket_sockaddr�is_mq�_is_mq�
listen_fds�listen_fds_with_names�notifyc#�K�	d��y#t$r7}|jtjk(rtj��d}~wwxYw�w�N)�OSError�errno�ENOSYS�pytest�skip)�es �:/usr/lib/python3/dist-packages/systemd/test/test_daemon.py�skip_enosysrs9�����
�����7�7�e�l�l�"��K�K�M�
���s$�A�	�A�	A	�2A�A	�	Ac#��K�tj|�}	|��|dj�|dj�y#|dj�|dj�wxYw�w)Nr�)�socket�
socketpair�close)�family�pairs  r�closing_socketpairr$sW�������V�$�D���
��Q��
�
���Q��
�
���	
�Q��
�
���Q��
�
��s�A/�A�'A/�(A,�,A/c�x�tjjd�r
t�sJ�yt�dvsJ�y)Nz/run/systemd/system>FT)�os�path�existsr��r�test_bootedr+&s.��	�w�w�~�~�+�,��x��x��x�=�(�(�(r*c��|jd�j}tj|�t	j
|tjtjz�}t|d�sJ�t||�sJ�y)N�	test.fifo)	�join�strpath�posix�mkfifor&�open�O_RDONLY�
O_NONBLOCKr)�tmpdirr'�fds   r�
test__is_fifor7.s_���;�;�{�#�+�+�D�	�L�L���	����r�{�{�2�=�=�0�	1�B��B������B����r*c��|jd�}|jd�|j}tj|tj
tjz�}t|d�rJ�t||�rJ�y)Nr-�boo)r.�writer/r&r2r3r4r�r5�filer'r6s    r�test__is_fifo_filer=6se���;�;�{�#�D��J�J�u���<�<�D�	����r�{�{�2�=�=�0�	1�B���D�!�!�!���D�!�!�!�!r*c�.�|jd�j}tjt�5tdd�rJ�	ddd�tjt�5td|�rJ�	ddd�y#1swY�;xYw#1swYyxYw�Nr-���)r.r/r�raisesrr�r5r's  r�test__is_fifo_bad_fdrC?s����;�;�{�#�+�+�D�	���w�	�&��B��%�%�%�%�&�
���w�	�&��B��%�%�%�%�&�&�&�&��&�&���A?�&B�?B�Bc�j�|jd�j}tj|�t	j
|tjtjz�}t	j|d�}t|d�sJ�t||�sJ�t|d�sJ�t||�sJ�y)Nr-�r)
r.r/r0r1r&r2r3r4�fdopenr)r5r'r6r<s    r�test_is_fiforHHs����;�;�{�#�+�+�D�	�L�L���	����r�{�{�2�=�=�0�	1�B�
�9�9�R���D��4������4������2�t�����2�t���r*c�f�|jd�}|jd�|j}tj|tj
tjz�}tj|d�}t|d�rJ�t||�rJ�t|d�rJ�t||�rJ�y)Nr-r9rF)	r.r:r/r&r2r3r4rGrr;s    r�test_is_fifo_filerJSs����;�;�{�#�D��J�J�u���<�<�D�	����r�{�{�2�=�=�0�	1�B�
�9�9�R���D��t�T�"�"�"��t�T�"�"�"��r�4� � � ��r�4� � � � r*c�.�|jd�j}tjt�5tdd�rJ�	ddd�tjt�5td|�rJ�	ddd�y#1swY�;xYw#1swYyxYwr?)r.r/rrArrrBs  r�test_is_fifo_bad_fdrL_s����;�;�{�#�+�+�D�	���w�	�%��2�t�$�$�$�$�%�
���w�	�%��2�t�$�$�$�$�%�%�%�%��%�%�rDc��	t|�S#t$r)}|jtjk(sJ�Yd}~yd}~wwxYw�NF)rrr�EBADF��arg�errors  r�
is_mq_wrapperrShs:����S�z������{�{�e�k�k�)�)�)������

�	?�:�?c��	t|�S#t$r)}|jtjk(sJ�Yd}~yd}~wwxYwrN)rrrrOrPs  r�_is_mq_wrapperrVps:����c�{������{�{�e�k�k�)�)�)����rTc��ttj�5}|D]�}t|�rJ�t	|�rJ�t|�rJ�t
�5t|d�rJ�	ddd�|j�}t|�rJ�t	|�rJ�t|�rJ�t
�5t|d�rJ�	ddd�t|�rJ�t|�rJ�t|�rJ�t
�5t|d�rJ�	ddd���	ddd�y#1swY��xYw#1swY�jxYw#1swY��xYw#1swYyxYw)Nz127.0.0.1:2000)
r$r�AF_UNIXrrSrrr�filenorrVr	r
�r#�sockr6s   r�test_no_mismatchr\xse��	�F�N�N�	+�E�t��	E�D��t�}�$�$�$�T�*�*�*�%�d�+�+�+���
F�-�d�4D�E�E�E�E�
F�����B��r�{�"�?�$�R�(�(�(�%�b�)�)�)���
D�-�b�2B�C�C�C�C�
D� ��|�#�#�%�b�)�)�)�&�r�*�*�*���
E�.�r�3C�D�D�D�D�
E�
E�#	E�E�E�

F�
F��
D�
D��
E�
E��%E�E�sT�7D<�D�!A	D<�*D#�:9D<�3D/�
D<�D �D<�#D,�(D<�/D9�4D<�<Ec��ttj�5}|D�]�}||j�fD]�}t	|�sJ�t	|tj�sJ�t	|tj
�rJ�t	|tjtj�sJ�t	|tj
tj�rJ�t�5t|dtjdd�rJ�	ddd���t�sJ�t|tj�sJ�t|tj
�rJ�t|tjtj�sJ�t|tj
tj�rJ�t�5t|dtjdd�rJ�	ddd����	ddd�y#1swY���xYw#1swY���xYw#1swYyxYw)Nz8.8.8.8:2000r)r$rrXrYr�AF_INET�SOCK_STREAM�
SOCK_DGRAMrrrr
�r#r[rQs   r�test_is_socketrb�s���	�F�N�N�	+�]�t��	]�D��d�k�k�m�,�
`�� ��~�%�~� ��f�n�n�5�5�5�$�S�&�.�.�9�9�9� ��f�n�n�f�6H�6H�I�I�I�$�S�&�.�.�&�:K�:K�L�L�L� �]�`�1�#�~�v�GX�GX�Z[�]^�_�_�_�_�`�`�

`��c�?�"�?��c�6�>�>�2�2�2�!�#�v�~�~�6�6�6��c�6�>�>�6�3E�3E�F�F�F�!�#�v�~�~�v�7H�7H�I�I�I���
]�.�s�N�F�DU�DU�WX�Z[�\�\�\�\�
]�
]�	]�]�]�`�`��
]�
]��!]�]�s=�CG;� G!	�<B/G;�+ G.�G;�!G+
�&G;�.G8�3G;�;Hc	��tjtjtj��5}|j	d�|j�\}}dj
|�}dD�],}||j�fD�]p}t�5t|dtj�sJ�	ddd�t�5t|d|ztj�sJ�	ddd�t�5t|d|z|��sJ�	ddd�t�5t|d|zd��sJ�	ddd�t�5t|d|z|��rJ�	ddd�tjt�5t|dd��ddd�t�5t|d	tj�rJ�	ddd�t�5t|dtj�rJ�	ddd���stjt�5tdd
d�ddd�t�5td	tj�rJ�	ddd�t�5tdtj�rJ�	ddd�|j!d���/	ddd�y#1swY���xYw#1swY���xYw#1swY���xYw#1swY���xYw#1swY���xYw#1swY��`xYw#1swY��<xYw#1swY���xYw#1swY��xYw#1swY��xYw#1swY��xYw#1swYyxYw)N)�	127.0.0.1rz:{})rrrd)�	listeningr@i@�)�flowinfoz129.168.11.11:23r�)�
contextlib�closingrr^�bind�getsockname�formatrYrrr_rrA�
ValueErrorr`r
�listen)r[�addr�portrerQs     r�test_is_socket_sockaddrrq�s��	�	�	�F�M�M�&�.�.�9�	:�#�d��	�	�"�#��%�%�'�
��d��|�|�D�!���	�I��d�k�k�m�,�
W�� �]�T�-�c�;��@R�@R�S�S�S�T� �]�[�-�c�;��3E�v�GY�GY�Z�Z�Z�[�!�]�\�-�c�;��3E�QZ�[�[�[�\� �]�U�-�c�;��3E�QS�T�T�T�U� �]�d�1�#�{�T�7I�Yb�Ub�c�c�c�c�d��]�]�:�.�J�&�s�K�&�I�J�!�]�_�1�#�7I�6�K]�K]�^�^�^�^�_� �]�W�1�#�{�F�DU�DU�V�V�V�V�W�W�%
W�*���z�*�
A�#�C��a��@�
A���
\�.�s�4F��HZ�HZ�[�[�[�[�
\���
T�.�s�K��AR�AR�S�S�S�S�
T�
�K�K��O�=	�#�#�T�T��[�[��\�\��U�U��d�d��J�J��_�_��W�W��
A�
A��
\�
\��
T�
T��A#�#�s�AL5�J)	�2L5�!J6	�&L5�8K	�
L5�K	�4L5�K	�!L5�=K*	�L5�K7	�=L5�L	�.$L5�L�!L5�3L�L5�$L)�L5�)J3
�.L5�6K
�;L5�K

�L5�K
�L5�K'
�"L5�*K4
�/L5�7L
�<L5�L
�	L5�L�L5�L&�"L5�)L2�.L5�5L>c��ttj�5}|D�]I}|j�}t	|�sJ�t	|tj�sJ�t	|tj
�rJ�t	|tjtj�sJ�t	|tj
tj�rJ�t	|�sJ�t	|tj�sJ�t	|tj
�rJ�t	|tjtj�sJ�t	|tj
tj�s��JJ�	ddd�y#1swYyxYwr)r$rrXrYrr^r_r`rZs   r�test__is_socketrs�s��	�F�N�N�	+�
I�t��	I�D�����B��b�>�!�>��b�&�.�.�1�1�1�!�"�f�n�n�5�5�5��b�&�.�.�&�2D�2D�E�E�E�!�"�f�n�n�f�6G�6G�H�H�H��b�>�!�>��b�&�.�.�1�1�1�!�"�f�n�n�5�5�5��b�&�.�.�&�2D�2D�E�E�E�!�"�f�n�n�f�6G�6G�H�H�H�	I�
I�
I�
I�s�EE4�'E4�4E=c�F�ttj�5}|D]m}||j�fD]V}t	|�sJ�t	|d��rJ�t	|tj
�sJ�t	|tj�s�VJ��o	ddd�y#1swYyxYw)N�
/no/such/path)r')r$rrXrYr
r_r`ras   r�test_is_socket_unixrv�s���	�F�N�N�	+�B�t��	B�D��d�k�k�m�,�
B��%�c�*�*�*�)�#�O�D�D�D�%�c�6�+=�+=�>�>�>�)�#�v�/@�/@�A�A�A�	
B�	B�B�B�B�s�A-B�B�B c�:�ttj�5}|D]g}|j�}t	|�sJ�t	|ddd�rJ�t	|tj
�sJ�t	|tj�s�gJ�	ddd�y#1swYyxYw)Nrr@ru)r$rrXrYrr_r`rZs   r�test__is_socket_unixrx�s���	�F�N�N�	+�>�t��	>�D�����B�"�2�&�&�&�&�r�1�b�/�B�B�B�"�2�v�'9�'9�:�:�:�&�r�6�+<�+<�=�=�=�	>�>�>�>�s�A)B�B�Bc��tjd�tjd�t�gk(sJ�td�gk(sJ�td�gk(sJ�y)N�
LISTEN_FDS�
LISTEN_PIDTF)r&�unsetenvrr)r*r�test_listen_fds_no_fdsr}�sP���K�K����K�K����<�2�����d��r�!�!�!��e���"�"�"r*c���dtjd<ttj��tjd<t	d�gd�k(sJ�t	d�gd�k(sJ�t	�gk(sJ�y)N�3rzr{F����T�r&�environ�str�getpidrr)r*r�test_listen_fdsr��s_��"�B�J�J�|��"�2�9�9�;�/�B�J�J�|���e��	�)�)�)��d��y�(�(�(��<�2���r*c���dtjd<ttj��tjd<t	d�dgk(sJ�t	�dgk(sJ�t	�gk(sJ�y)N�1rzr{Fr�r�r)r*r�test_listen_fds_default_unsetr��s`��"�B�J�J�|��"�2�9�9�;�/�B�J�J�|���e����#�#�#��<�A�3�����<�2���r*c���tjd�tjd�tjd�t�ik(sJ�td�ik(sJ�td�ik(sJ�y)Nrzr{�LISTEN_FDNAMESTF)r&r|rr)r*r�"test_listen_fds_with_names_nothingr�s^���K�K����K�K����K�K� �!� �"�b�(�(�(� ��&�"�,�,�,� ��'�2�-�-�-r*c��dtjd<ttj��tjd<tjd�td�ddik(sJ�td�ddik(sJ�t�ik(sJ�y)	Nr�rzr{r�Fr��unknownT)r&r�r�r�r|rr)r*r�#test_listen_fds_with_names_no_namesr�
su��"�B�J�J�|��"�2�9�9�;�/�B�J�J�|���K�K� �!� ��'�A�y�>�9�9�9� ��&�1�i�.�8�8�8� �"�b�(�(�(r*c��dtjd<ttj��tjd<dtjd<t	d�ddik(sJ�t	�ddik(sJ�t	d�ik(sJ�y)	Nr�rzr{�cmdsr�Fr�T�r&r�r�r�rr)r*r�!test_listen_fds_with_names_singler�sw��"�B�J�J�|��"�2�9�9�;�/�B�J�J�|��#)�B�J�J�� � ��'�A�v�;�6�6�6� �"�q�&�k�1�1�1� ��&�"�,�,�,r*c��dtjd<ttj��tjd<dtjd<t	d�ddd	d
�k(sJ�t	d�ddd	d
�k(sJ�t	�ik(sJ�y)Nrrzr{zcmds:data:errsr�Fr��data�errsr�Tr�r)r*r�#test_listen_fds_with_names_multipler�!s}��"�B�J�J�|��"�2�9�9�;�/�B�J�J�|��#3�B�J�J�� � ��'�v�&�V�+L�L�L�L� ��&�f��F�*K�K�K�K� �"�b�(�(�(r*c�x�tjjdd�td�dusJ�t	�5tdg��dusJ�	ddd�tdddg��dusJ�tdtj
���dusJ�tdtj
�d	�
�dusJ�y#1swY�dxYw)N�
NOTIFY_SOCKET�READY=1F�	FDSTORE=1��fdsr���pid�r�r�r�)r&r��poprrr�r)r*r�test_notify_no_socketr�+s����J�J�N�N�?�D�)��)���%�%�%�	��4��k�r�*�e�3�3�3�4��+�A�q�6�*�e�3�3�3��+�2�9�9�;�/�5�8�8�8��+�2�9�9�;�D�9�U�B�B�B�	4�4�s�B0�0B9)r�c��dtjd<tjt�5td�ddd�tjt�5t
�5tdg��ddd�ddd�tjt�5tdddg��ddd�tjt�5tdtj���ddd�tjt�5tdtj�d	�
�ddd�y#1swY��xYw#1swY��xYw#1swY��xYw#1swY��xYw#1swY�}xYw#1swYyxYw)Nz	/dev/nullr�r�r�r�rr�r�r�r�)r&r�rrA�connection_errorrrr�r)r*r�test_notify_bad_socketr�:s��"-�B�J�J���	���'�	(���y���	���'�	(�(�
�]�	(��;�B�'�	(�(�
���'�	(�(��{��A��'�(�	���'�	(�-��{��	�	��,�-�	���'�	(�7��{��	�	���6�7�7����	(�	(��(�(��(�(��-�-��7�7�sS�D8�E�%E�3E�E�
 E)�!E5�8E�E	�
E�E�E&�)E2�5E>c���|jd�j}tjtjtj�}	|j|�ttdd�}|jtj|d�|tjd<td�sJ�t�5tdg�	�sJ�	ddd�tddd
g�	�sJ�tdtj ���sJ�tdtj �d�
�sJ�y#tj$r"}tjd|z�Yd}~��d}~wwxYw#1swY��xYw)Nrzfailed to bind socket (%s)�SO_PASSCRED�rr�r�r�r�r�r�r�r�)r.r/rrXr`rjrRr�xfail�getattr�
setsockopt�
SOL_SOCKETr&r�rrr�)r5r'r[rr�s     r�test_notify_with_socketr�Is���;�;�x� �(�(�D��=�=�����):�):�;�D�7��	�	�$���&�-��4�K��O�O�F�%�%�{�A�6�"&�B�J�J����)����	��+��k�r�*�*�*�+��+�A�q�6�*�*�*��+�2�9�9�;�/�/�/��+�2�9�9�;�D�9�9�9���<�<�7����1�A�5�6�6��7��+�+�s$�D*�<E"�*E�=E�E�"E+c��d}|g}tj|�}	tddd|�tj|�|ksJd��y#t$rY�+wxYw)Nr�Tr�leak)�sys�getrefcountrr�)r6r��ref_cnts   r�test_daemon_notify_memleakr�\sa��	
�B�
�$�C��o�o�b�!�G�
��r�4��C� ��?�?�2��'�)�1�6�1�)���
��
�s�A
�
	A�A)9r�r&r0rrhr�systemd.daemonrrrrrrr	r
rrr
rrrrrr�contextmanagerrr$r+r7r=rCrHrJrLrSrVr\rbrqrsrvrxr}r�r�r�r�r�r�r��version_info�ConnectionRefusedErrorr�rr�r�r�r)r*r�<module>r�s��
�	��
���$�$�$�$�$��������������)��"�&�	�
!�%���E�,]�($�LI� B�>�#���.�)�-�)�C����t��-����
7�:�&2r*

Zerion Mini Shell 1.0