%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_journal.cpython-312.pyc

�

���bd+����ddlmZddlZddlZddlZddlZddlZddlZddlZddl	Z	ddl
Z
ddlmZm
Z
ddlmZddlZej"d�Zej"d�ZGd�d�Zej*d	��Zej*d
��Zd�Zd�Zd
�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$�Z1d%�Z2d&�Z3y)'�)�print_functionN)�journal�id128��
_make_line� 8441372f8dca4ca98694a6091fd8519f� 8441370000000000000000001fd85000c��eZdZd�Z		dd�Zy)�
MockSenderc��g|_y�N)�buf)�selfs �;/usr/lib/python3/dist-packages/systemd/test/test_journal.py�__init__zMockSender.__init__s	�����Nc���d|zg}|�!t|d|�}|jd|z�||cxur|cxur�#nn tjd��ddd\}}}|�|jd|z�|� |jd	j	|��|�|jd
|z�|jd�|j
�D��|jj|�y)NzMESSAGE=�hex�MESSAGE_ID=�)�limitr�z
CODE_FILE=zCODE_LINE={:d}z
CODE_FUNC=c3�:K�|]\}}t||����y�wr
r)�.0�key�vals   r�	<genexpr>z"MockSender.send.<locals>.<genexpr>*s����H�X�S�#�J�s�C�(�H�s�)�getattr�append�	traceback�
extract_stack�format�extend�itemsr)	r�MESSAGE�
MESSAGE_ID�	CODE_FILE�	CODE_LINE�	CODE_FUNC�kwargs�args�ids	         r�sendzMockSender.sends����W�$�%���!���U�J�7�B��K�K�
��*�+��	�6�Y�6�.7�.E�.E�A�.N�q�.Q�RT�ST�.U�+�I�y�)�� ��K�K��y�0�1�� ��K�K�(�/�/�	�:�;�� ��K�K��y�0�1����H�����H�H�������r)NNNN)�__name__�
__module__�__qualname__rr-�rrrrs���(,�7;�rrc#�K�	d��y#ttf$r)}|j|k(rtj��d}~wwxYw�wr
)�OSError�IOError�errno�pytest�skip)�code�es  r�skip_oserrorr:-s9�����
���W����7�7�d�?��K�K�M�
���s"�A�	�A�A�$<�A�Ac#�\K�	d��y#t$rtj�YywxYw�wr
)�
ValueErrorr6r7r1rr�skip_valueerrorr=6s%�����
�������
��s�,�	�,�)�,�)�,c��tjj}|tj�tj
k(sJ�|tj�tj
k(sJ�|tjdz
�tj
k(sJ�|tjdz�tjk(sJ�|tjdz
�tjk(sJ�|tj�tjk(sJ�|tjdz�tjk(sJ�|tjdz
�tjk(sJ�|tj�tjk(sJ�|tjdz�tjk(sJ�|tjdz
�tjk(sJ�|tj�tjk(sJ�|tjdz�tjk(sJ�|tj�tjk(sJ�|tj�tjk(sJ�|tjdz�tj k(sJ�y)N�)r�JournalHandler�map_priority�logging�NOTSET�	LOG_DEBUG�DEBUG�LOG_INFO�INFO�LOG_WARNING�WARN�LOG_ERR�ERROR�LOG_CRIT�FATAL�CRITICAL�	LOG_ALERT)�ps r�test_prioritiesrQ=s�����+�+�A��W�^�^��g�&7�&7�7�7�7��W�]�]��g�&7�&7�7�7�7��W�]�]�Q�
��g�&7�&7�7�7�7��W�]�]�Q�
��g�&6�&6�6�6�6��W�\�\�A�
��g�&6�&6�6�6�6��W�\�\�?�g�&6�&6�6�6�6��W�\�\�A�
��g�&9�&9�9�9�9��W�\�\�A�
��g�&9�&9�9�9�9��W�\�\�?�g�&9�&9�9�9�9��W�\�\�A�
��g�o�o�5�5�5��W�]�]�Q�
��g�o�o�5�5�5��W�]�]��g�o�o�5�5�5��W�]�]�Q�
��g�&6�&6�6�6�6��W�]�]��g�&6�&6�6�6�6��W�
�
��g�&6�&6�6�6�6��W�
�
��
!�"�g�&7�&7�7�7�7rc�,�ddi}tjt�5tjdi|��ddd�tjt�5tjj|�ddd�y#1swY�KxYw#1swYyxYw)Nz X  rr1)r6�raisesr<rr@�	with_args��kws r�"test_journalhandler_init_exceptionrWRsw��
���B�	���z�	"�%����$��$�%�	���z�	"�-����(�(��,�-�-�%�%��-�-�s�A>� B
�>B�
Bc��ddd�}tjtjfi|��tj|d<tjj	|�y)Nr�)�X�X3�level)rr@rBrGrTrUs r�test_journalhandler_initr]YsC���a��B����7�<�<�.�2�.��,�,�B�w�K����$�$�R�(rc	���tjdtjddddd�}t�}dd|jd�}tjtjfi|��}|j|�t|j�dk(sJ�d|jd	vsJ�d
|jd	vsJ�t�}t
jjtjdd|jd��}|j|�t|j�dk(sJ�d|jd	vsJ�d
|jd	vsJ�t
jj�y)N�test-logger�testpathr?�testrrY)rZr[�sender_functionzX=3rzX3=4)r\rZr[rb)rB�	LogRecordrGrr-rr@�emit�lenrrT)�record�senderrV�handlers    r�test_journalhandler_infori_s6��
�
�
�}�g�l�l�J��6�SW�Y]�
^�F�
�\�F��a�F�K�K�	8�B��$�$�W�\�\�8�R�8�G��L�L����v�z�z�?�a�����F�J�J�q�M�!�!�!��V�Z�Z��]�"�"�"�
�\�F��$�$�.�.����!�RS�gm�gr�gr�/s�t�G��L�L����v�z�z�?�a�����F�J�J�q�M�!�!�!��V�Z�Z��]�"�"�"����$�$�&rc	�`�tjdtjddddd�}t�}t	j
tj|j��}|j|�t|j�dk(sJ�td�|jdD��sJ�y)Nr_r`r?ra)rbc3�@K�|]}|jd����y�w)rN)�
startswith)r�ms  rrz4test_journalhandler_no_message_id.<locals>.<genexpr>zs����F�1�1�<�<�
�.�.�F�s�r)rBrcrGrrr@r-rdrer�all�rfrgrhs   r�!test_journalhandler_no_message_idrpts���
�
�
�}�g�l�l�J��6�SW�Y]�
^�F�
�\�F��$�$�W�\�\�6�;�;�O�G��L�L����v�z�z�?�a�����F��
�
�1�
�F�F�F�Frc	�p�tjdtjddddd�}t�}t	j
tj|jt��}|j|�t|j�dk(sJ�dtjz|jdvsJ�y�Nr_r`r?ra�rbr&rr)rBrcrGrrr@r-�TEST_MIDrdrerrros   r�)test_journalhandler_message_id_on_handlerru|s���
�
�
�}�g�l�l�J��6�SW�Y]�
^�F�
�\�F��$�$�W�\�\�6�;�;�08�:�G��L�L����v�z�z�?�a�����8�<�<�'�6�:�:�a�=�8�8�8rc	��tjdtjddddd�}t�}t	j
tj|jtj��}|j|�t|j�dk(sJ�dtjz|jdvsJ�yrr)rBrcrGrrr@r-rtrrdrerros   r�-test_journalhandler_message_id_on_handler_hexrw�s���
�
�
�}�g�l�l�J��6�SW�Y]�
^�F�
�\�F��$�$�W�\�\�6�;�;�08���>�G��L�L����v�z�z�?�a�����8�<�<�'�6�:�:�a�=�8�8�8rc	��tjdtjddddd�}t|jd<t�}t
jtj|jt��}|j|�t|j�dk(sJ�dtjz|jdvsJ�y�	Nr_r`r?rar&rsrr)rBrcrG�	TEST_MID2�__dict__rrr@r-rtrdrerrros   r�)test_journalhandler_message_id_on_messager|�s���
�
�
�}�g�l�l�J��6�SW�Y]�
^�F�$-�F�O�O�L�!�
�\�F��$�$�W�\�\�6�;�;�08�:�G��L�L����v�z�z�?�a�����9�=�=�(�F�J�J�q�M�9�9�9rc	��tjdtjddddd�}tj|j
d<t
�}tjtj|jt��}|j|�t|j�dk(sJ�dtjz|jdvsJ�yry)rBrcrGrzrr{rrr@r-rtrdrerros   r�-test_journalhandler_message_id_on_message_hexr~�s���
�
�
�}�g�l�l�J��6�SW�Y]�
^�F�$-�M�M�F�O�O�L�!�
�\�F��$�$�W�\�\�6�;�;�08�:�G��L�L����v�z�z�?�a�����9�=�=�(�F�J�J�q�M�9�9�9rc��tj�}tjtj�}tjtj�}tjtj�}tjtjtjztjz�}tjd�}y)Nr)r�Reader�
LOCAL_ONLY�RUNTIME_ONLY�SYSTEM_ONLY)�j1�j2�j3�j4�j5�j6s      r�test_reader_init_flagsr��s���	���	�B�	����*�*�	+�B�	����,�,�	-�B�	����+�+�	,�B�	����*�*�W�-A�-A�A�G�DW�DW�W�	X�B�	����	�Brc��tjt�5tjtj
�ddd�t
�5tj|jtj
��}ddd�t
�5tj|jtj
tjz��}ddd�tj|jtj
tjz��}y#1swY��xYw#1swY��xYw#1swY�bxYw)N)�path�flags)
r6rSr<rr��OS_ROOTr=�strpath�CURRENT_USERr�)�tmpdirr�r�r�s    r�test_reader_os_rootr��s���	���z�	"�(����w���'�(�	�	�3�
�^�^����")�/�/�3��3�
�	�J�
�^�^����")�/�/�G�4H�4H�"H�J��J�
���V�^�^�%�o�o��0C�0C�C�
E�B�(�(��3�3��J�J�s$�$D�0D(�AD4�D%�(D1�4D=c��tj|j��}tjd|j��tj|j��}tj|j��y)N�r�r)rr�r�)r�r�r�s   r�test_reader_init_pathr��sH��	���V�^�^�	,�B��N�N�1�6�>�>�*�	���V�^�^�	,�B��N�N����'rc��tjt�5tjdd��ddd�y#1swYyxYw)Nr���r��r6rSr3rr�r1rr� test_reader_init_path_invalid_fdr��s1��	���w�	�#����q�r�"�#�#�#��	�;�Ac��tjt�5tjdd��ddd�y#1swYyxYw)Nrr�r�r1rr�%test_reader_init_path_nondirectory_fdr��s1��	���w�	�"����q�q�!�"�"�"�r�c��tj|jtj�}t	t
j�5tj|��}ddd�t�gk(sJ�t�5tjtj|��}ddd�t�gk(sJ�tjtj|��}t|�gk(sJ�y#1swY��xYw#1swY�[xYw�Nr�)
�os�openr��O_RDONLYr:r5�ENOSYSrr��listr=�SYSTEMr�)r��fdr�r�r�s     r�test_reader_init_path_fdr��s���	���������	-�B�	�e�l�l�	#�%�
�^�^��
$��%���8�r�>��>�	�	�5�
�^�^�G�N�N��
4��5���8�r�>��>�	����,�,�2�	6�B���8�r�>��>�%�%��5�5�s�C5�&D�5C>�D
c��tj|j��}|5|jrJ�	ddd�|jsJ�t	j
t�5t|�ddd�y#1swY�ExYw#1swYyxYwr�)rr�r��closedr6rSr3�next�r��js  r�test_reader_as_cmr��sr�����F�N�N�+�A�	
���8�8��|�8���8�8�O�8�	���w�	���Q����	�����s�A7�"B�7B�Bc��tj|j��}|5|jtj
�|jtjj�ddd�y#1swYyxYwr�)rr�r��messageid_matchr�SD_MESSAGE_JOURNAL_START�SD_MESSAGE_JOURNAL_STOPrr�s  r�test_reader_messageid_matchr��sZ�����F�N�N�+�A�	
�=�	���%�8�8�9�	���%�7�7�;�;�<�=�=�=�s�A	A5�5A>c��tj|j��}|5|j�|jt�|jtj
�ddd�y#1swYyxYwr�)rr�r��	this_bootrtrr�s  r�test_reader_this_bootr��sQ�����F�N�N�+�A�	
�"�	���
�	���H��	���H�L�L�!�"�"�"���AA1�1A:c��tj|j��}|5|j�|jt�|jtj
�ddd�y#1swYyxYwr�)rr�r��this_machinertrr�s  r�test_reader_this_machiner��sR�����F�N�N�+�A�	
�%�	����	���x� �	���x�|�|�$�%�%�%�r�c�2�tj|j��}|5ttj
�5|j
d�}ddd�ddd�tt�sJ�|t�k(sJ�y#1swY�3xYw#1swY�7xYw)Nr��FOOBAR)	rr�r�r:r5r��query_unique�
isinstance�set�r�r��anss   r�test_reader_query_uniquer��s{�����F�N�N�+�A�	
�+�
�%�,�,�
'�	+��.�.��*�C�	+�+��c�3�����#�%�<��<�	+�	+��+�+�s"�B
�B�B
�B
	�B
�
Bc�0�tj|j��}|5ttj
�5|j
�}ddd�ddd�tt�sJ�|t�k(sJ�y#1swY�3xYw#1swY�7xYwr�)	rr�r�r:r5r��enumerate_fieldsr�r�r�s   r�test_reader_enumerate_fieldsr��s{�����F�N�N�+�A�	
�'�
�%�,�,�
'�	'��$�$�&�C�	'�'��c�3�����#�%�<��<�	'�	'��'�'�s"�B�B�B�B		�B�Bc��tj|j��}|5ttj
�5|j
�}ddd�ddd�dusJ�y#1swY�xYw#1swY�xYw�Nr�F�rr�r�r:r5r��has_runtime_filesr�s   r�test_reader_has_runtime_filesr��i�����F�N�N�+�A�	
�(�
�%�,�,�
'�	(��%�%�'�C�	(�(��%�<��<�	(�	(��(�(��"�A1�A%�A1�%A.	�*A1�1A:c��tj|j��}|5ttj
�5|j
�}ddd�ddd�dusJ�y#1swY�xYw#1swY�xYwr�r�r�s   r� test_reader_has_persistent_filesr�r�r�c��dd�i}tj|j|��}|jdd�}|dk(sJ�|jdd�}|dk(sJ�y)N�xxxc��y�N�yyyr1��args r�<lambda>z(test_reader_converters.<locals>.<lambda>��r�r��
converters�abcr��zzz���)rr�r��_convert_field�r�r�r�rs    r�test_reader_convertersr�s_���+�,�J����F�N�N�z�B�A�
�
�
�5�&�
)�C��%�<��<�
�
�
�5�+�
.�C��+���rc��d�d�d�}tj|j|��}|jddddgddgd	��}|d
dddgddgd	�k(sJ�y)Nc��yr�r1r�s rr�z+test_reader_convert_entry.<locals>.<lambda>r�rc��y)N�YYYr1r�s rr�z+test_reader_convert_entry.<locals>.<lambda>r�r)�x1�x2r�r�r�sdefs��)r��y1r��y2r�r�)rr�r��_convert_entryr�s    r�test_reader_convert_entryr�s{��*�*�,�J����F�N�N�z�B�A�
�
�
�6�#.�$*�F�#3�$/��#=�?�@�C��%�%� �%�.�&��4�6�6�6�6rc�x�tj|j��}|jdd�}tj
dk\r|j�J�|jdd�}tj
dk\r|j�J�|jdd�}tj
dk\r|j�J�yy)Nr��_SOURCE_REALTIME_TIMESTAMPlZKT.)r�__REALTIME_TIMESTAMP�COREDUMP_TIMESTAMP)rr�r�r��sys�version_info�tzinfo)r�r�rs   r�test_reader_convert_timestampsr�&s������F�N�N�+�A�
�
�
�7�9I�
J�C�
���4���z�z�%�%�%�
�
�
�1�3C�
D�C�
���4���z�z�%�%�%�
�
�
�/�1A�
B�C�
���4���z�z�%�%�%� rc��tj|j��}tj�}|j	|�|j	d�tj
ddd�}|j	|�y)Nr�i90i��rY)rr�r��time�
seek_realtime�datetime)r�r��now�long_agos    r�test_seek_realtimer�5sW�����F�N�N�+�A�
�)�)�+�C��O�O�C���O�O�E��� � ��q�!�,�H��O�O�H�rc���ttj�5tjd�}ddd�jd�}|dvsJ�t
d|��y#1swY�.xYw)Nztest_journal.pyzmessage...
)�Nzprinted message...)�file)r:r5�ENOENTr�stream�write�print)r��ress  r�test_journal_streamr@s[��	�e�l�l�	#�3���� 1�2��3��,�,�~�
&�C��*����	�
�V�,�
3�3�s�A�A&)4�
__future__r�
contextlibr�r5rBr�r��uuidr�r �systemdrr�systemd.journalrr6�UUIDrtrzr�contextmanagerr:r=rQrWr]rirprurwr|r~r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�rr1rr�<module>rs��%�����	���
��"�&�
��4�9�9�7�8���D�I�I�8�9�	���2������������8�*-�)�'�*G�9�9�:�:��
E�(�#�"���=�"�%������6�
&�	�-r

Zerion Mini Shell 1.0