%PDF- %PDF-
Mini Shell

Mini Shell

Direktori : /lib/python3.12/test/libregrtest/__pycache__/
Upload File :
Create Path :
Current File : //lib/python3.12/test/libregrtest/__pycache__/main.cpython-312.pyc

�

���f�f��X�ddlZddlZddlZddlZddlZddlZddlZddlmZm	Z	m
Z
ddlmZm
Z
ddlmZmZmZddlmZddlmZddlmZdd	lmZmZdd
lmZmZddlmZmZddl m!Z!m"Z"dd
l#m$Z$ddl%m&Z&m'Z'm(Z(m)Z)m*Z*m+Z+m,Z,m-Z-m.Z.m/Z/m0Z0m1Z1m2Z2m3Z3m4Z4m5Z5m6Z6m7Z7m8Z8m9Z9Gd�d�Z:dd�Z;y)�N)�	os_helper�
MS_WINDOWS�flush_std_streams�)�_parse_args�	Namespace)�	findtests�split_test_packages�
list_cases)�Logger)�setup_pgo_tests)�State)�TestResults�EXITCODE_INTERRUPTED)�RunTests�HuntRefleak)�
setup_process�setup_test_dir)�run_single_test�PROGRESS_MIN_TIME)�setup_tsan_tests)�StrPath�StrJSON�TestName�TestList�	TestTuple�
TestFilter�strip_py_suffix�count�format_duration�	printlist�get_temp_dir�get_work_dir�exit_timeout�display_header�cleanup_temp_dir�
print_warning�is_cross_compiled�get_host_runner�process_cpu_count�EXIT_TIMEOUTc�\�eZdZdZd%dedefd�Zd&d�Zd'dedzde	e
edzffd	�Zede
fd
��Z
defd�Zdefd
�Zdedededefd�Zdeddfd�Zd�Zdedefd�Zd�Zd�Zdededdfd�Zd�Zd�Zde
fd�Zde
dedzdefd�Zde
dedzdefd�Zd�Z d �Z!d!�Z"d"�Z#d#�Z$d'dedzfd$�Z%y)(�RegrtestaaExecute a test suite.

    This also parses command-line options and modifies its behavior
    accordingly.

    tests -- a list of strings containing test names (optional)
    testdir -- the directory in which to look for tests (optional)

    Users other than the Python test suite will certainly want to
    specify testdir; if it's omitted, the directory containing the
    Python test suite is searched for.

    If the tests argument is omitted, the tests listed on the
    command-line will be used.  If that's empty, too, then all *.py
    files beginning with test_ will be used.

    The other default arguments (verbose, quiet, exclude,
    single, randomize, use_resources, trace, coverdir,
    print_slow, and random_seed) allow programmers calling main()
    directly to set the values that would normally be set by flags
    on the command line.
    �ns�_add_python_optsc��t|j�|_|j|_|j|_|j|_|j
|_t
�|_d|_t|j|j|j�|_
|j|_|j|_|j|_|j"|_|j&|_|j*|_|j.|_|j2|_|j6xs|j8|_|xr|j<|_|j@|_ |jB|_!|jD|_"|jF|_$|jJ|_&|jN�d}n|jNdkrd}n|jN}||_(|jR|_)|jT|_+|jX|_,|jZ|_-|j\|_.|j^|_0|jb|_1|jdrB|jd\}}}tfjhjk|�}tm|||�|_7nd|_7|jp|_9|jt|_;|jx|_=|j||_?t�|j��|_A|j�rt�|j��|_Cnd|_C|j�|_E|j�|_G|j�|_I|j�|_Jdtfj�vr3tfj�dr d|_Jtfj�d|_Ln8|j��t�j�d�|_Ln|j�|_Ld|_O|j�|_Qt�j��|_T|j�|_Vd|_Wd|_Xy)Nr����SOURCE_DATE_EPOCHF� )Y�int�verbose�quiet�pgo�pgo_extended�tsanr�results�first_stater�logger�header�want_header�
list_tests�want_list_testsr�want_list_cases�wait�	want_wait�cleanup�want_cleanup�rerun�
want_rerun�runleaks�want_run_leaks�bisect�want_bisect�fast_ci�slow_ci�ci_moder/�want_add_python_opts�match_tests�exclude�fromfile�start�
starting_test�args�cmdline_args�use_mp�num_workers�worker_json�failfast�	fail_fast�fail_env_changed�
fail_rerun�forever�verbose3�output_on_failure�timeout�
huntrleaks�os�path�abspathr�hunt_refleak�testdir�test_dir�xmlpath�junit_filename�memlimit�memory_limit�	threshold�gc_threshold�tuple�
use_resources�python�
python_cmd�trace�coverage�coverdir�coverage_dir�tempdir�tmp_dir�	randomize�environ�random_seed�random�getrandbits�first_runtests�
print_slow�
print_slowest�time�perf_counter�
start_time�single�single_test_run�next_single_test�next_single_filename)�selfr.r/rX�warmups�runs�filenames       �,/usr/lib/python3.12/test/libregrtest/main.py�__init__zRegrtest.__init__5s5����
�
�O����8�8��
������"$�/�/����'�'��	�%0�M���'+����T�\�\�4�:�:�t�x�x�@���"$�����%'�]�]���%'�]�]���!�w�w���"$�*�*��� "�����$&�K�K���!#����� �j�j�6�B�J�J���+;�,C�/1�/B�/B�	
�!�(*�~�~����Z�Z���(*����
�.0�h�h���&(�g�g����9�9���K�
�Y�Y�!�^��K��)�)�K� +���+-�>�>��� "�{�{���&(�&9�&9��� "�
�
����Z�Z���')�{�{���%'�Z�Z���
�=�=�&(�m�m�#�G�T�8��w�w���x�0�H�4?���x�4X�D�� $�D��(*�
�
��
�.0�j�j���(*�����(*�����.3�B�4D�4D�.E���
�9�9�6;�B�I�I�6F�D�O�"�D�O� �h�h��
�,.�K�K���')�z�z��� "�|�|����2�:�:�-��
�
�.�/�"�D�N�+-�*�*�5H�*I�D��
�^�^�
#�%�1�1�"�5�D��!�~�~�D��04���$&�=�=����+�+�-���&(�Y�Y���15���48��!�c�:�|jj|�y�N)r<�log)r��lines  r�r�zRegrtest.log�s��������r�N�tests�returnc��|jrptjj|jd�|_	t
|j
d�5}|j�j�}|g}ddd�|jr�g}tjd�}t
tjjtj|j��5}|D]Z}|jdd�d}|j�}|j!|�}|��<|j#|j%���\	ddd�t'|�|j(r t+|j,|j.�|j0rt3|j,�t5�}|j6r)|j,D]}|j9|��g|_t;|j<|��}	|js!|xs|j,}
|
rt?|
�}
n|	}
n|}
|jr'|
dd}
	|	jA|
d�}|	|dz|_!|jFr	|
d|
jA|jF��=tQjR|jT�|jVrtQjX|
�t[|
�|fS#1swY��_xYw#t$rY��nwxYw#1swY���xYw#tD$rY��wxYw#tH$r0tKd|jF���tMjNd�Y��wxYw)	N�
pynexttest�rz\btest_[a-zA-Z0-9_]+\b�#rr)rgrQzCannot find starting test: ).r�rcrd�joinrxr��open�read�strip�OSErrorrR�re�compiler�SAVEDCWD�split�search�append�grouprr7r
rVr8r9r�setrQ�addr	rhr
�indexr��
IndexErrorrT�
ValueError�print�sys�exitr|�seedr{ry�shufflero)r�r��fp�	next_test�regexr��match�
exclude_tests�arg�alltests�selected�poss            r��
find_testszRegrtest.find_tests�s������(*�����T�\�\�<�(P�D�%�
��$�3�3�S�9�(�R� "���	��� 1�I�&�K�E�(��=�=��E��J�J�8�9�E��b�g�g�l�l�9�#5�#5�t�}�}�E�F�
4�"��4�D��:�:�c�1�-�a�0�D��:�:�<�D�!�L�L��.�E��(����U�[�[�]�3�4�
4�	����8�8��D�-�-�t�/@�/@�A��9�9��T�.�.�/���
��<�<��(�(�
'���!�!�#�&�
'� "�D���T�]�]�%2�4���}�}��1�� 1� 1�H��.�x�8��#���H�������|�H�
��n�n�X�a�[�1��(0��q��(9��%�
���
��@�h�n�n�T�-?�-?�@�@�A�
	���D�$�$�%��>�>��N�N�8�$��h���'�'�E(�(���
��
��
4�
4��P�
��
���
��3�D�4F�4F�3G�H�I������
�s_�K�"K�5K�!>K/� !K/�9!K<�'L�K�K�	K,�+K,�/K9�<	L�L�6M�Mc�(�|D]
}t|��yr�)r�)r��names  r�r?zRegrtest.list_tests�s���	�D��$�K�	r��runtestsc	�F�|jdk(rd|_|jj�\}}|jdt	|��d��|j|dddd|d��}|jj|�|j||j�|S)NrrzRe-running z- failed tests in verbose mode in subprocessesTF)r�rFr5r^r[�match_tests_dictr`)	rXr:�
prepare_rerunr��len�copyr<�	set_tests�
_run_tests_mp)r�r�r�r�s    r��_rerun_failed_testszRegrtest._rerun_failed_tests�s������q� �
 !�D��"&�,�,�"<�"<�">����	
���;�s�5�z�l�*W�X�Y��=�=������-�#�!�%��	
�����h�'����8�T�%5�%5�6��r�c��|jr|jd�y|j�|_t	�|j|�}|jjrRt	tt|jj�d�d�t|jj�|j|�y)NzJRe-running failed tests is not supported with --python host runner option.�testz
failed again:)rrr��	get_stater;r�r�r:�badrr�r!�display_result)r�r��rerun_runtestss   r��rerun_failed_testszRegrtest.rerun_failed_testss����?�?��H�H�&�
�
��>�>�+���
���1�1�(�;���<�<����%��D�L�L�,�,�-�v�6��H��d�l�l�&�&�'����N�+r�r��progressc�p�t�d|��}|r|�d|�d�}t|�tdt|�z�t�|j�}|jgd��|j|j	��|j|�tdt
j|�d��t�d	dl	}|j||j�
�}|j}|�d|��}t|�tdt|�z�td��|rtd|���y
y)NzBisect z (�)r�)�-uz-mztest.bisect_cmdz
--max-iter�25z-v�+T��flushr�raz: exit code zBisect failed with exit code F)
r�r��create_python_cmd�extend�bisect_cmd_argsr��shlexr�r�
subprocess�runra�
returncode)	r�r�r�r��title�cmdr��proc�exitcodes	         r��_run_bisectzRegrtest._run_bisects��
���$�� ����g�R��z��+�E�
�e��
�c�C��J���
���(�(�*���
�
�
�	�	�
�
�8�+�+�-�.��
�
�4��
�c�5�:�:�c�?�$�/�����~�~�c�8�+;�+;�~�<���?�?���'��h�Z�0��
�e��
�c�C��J���
�D����1�(��<�=��r�c���|jjd��\}}t|d�D];\}}t|�dkDr|�dt|���}nd}|j	|||�r�;yy)NF)�clearr�/�)r:r��	enumerater�r�)r�r�r��_r�r�r�s       r��
run_bisectzRegrtest.run_bisect>sp���<�<�-�-�E�-�:���q�$�U�A�.�	�K�E�4��5�z�A�~�#�W�A�c�%�j�\�2�����#�#�H�d�H�=��
	r�c���|jry|j�}t�td|�d��|jj	|j
|j|j�y)Nz== Tests result: z ==)r7r�r�r:r�r�r6r�)r�r��states   r�r�zRegrtest.display_resultIsW���<�<����� ��
��
�!�%���,�-����#�#�H�N�N�$(�J�J��0B�0B�	Dr��	test_namec���|�7d}tt��}|j|t�|��|d}nt	||�}|j
j
||�|S)Nz-result = run_single_test(test_name, runtests))�globals�locals�result)�dictr��runctxr�rr:�accumulate_result)r�r�r��tracerr��	namespacer�s       r��run_testzRegrtest.run_testUs^����C�C��V�X��I��M�M�#�w�y��M�C��x�(�F�$�Y��9�F����&�&�v�x�8��
r�c��|jrddl}|jdd��}nd}ttj
�}|j
�}|�
t|d�}nd}d|�d�}|jr|d	t|j�zz
}|j|�d}|j�}	t|	d
�D�]f\}
}tj�}|}
|r|
�d|��}
|jj!|
|
�|j#|||�}tj
D�cgc]}||vr|j%d�r|��}}|D]U}tj
j'|d�|j)d
�\}}}	t+tj
||��W|j1|j2|j4�rnat7|�}tj�|z
}|t8k\r|�dt|���}��F|j:t<j>k(s��ed}��i|rtA|�|Scc}w#t,t.f$rY��wxYw)NrFT)rsrr�r�zRun z
 sequentiallyz (timeout: %s)rz -- )ztest.�test_�.z in )!rtrs�Tracer�r��modules�get_jobsrrar r��
iter_testsr�r�r�r<�display_progressr��
startswith�pop�
rpartition�delattr�KeyError�AttributeError�	must_stopr[r\�strrr�r�PASSEDr�)r�r�rsr��save_modules�jobsr��msg�
previous_test�
tests_iter�
test_indexr�r��textr��module�new_modules�parentr�r��	test_times                     r��run_tests_sequentiallyzRegrtest.run_tests_sequentiallyds/���=�=���[�[�u�D�[�9�F��F��3�;�;�'��� � �"�����$��'�E��E��U�G�=�)������#�o�h�6F�6F�&G�G�G�C�����
��
��(�(�*�
�%.�z�1�%=� 	%�!�J�	��*�*�,�J��D��%)�=�9���K�K�(�(��T�:��]�]�9�h��?�F�14���G�f�$�L�8� &� 1� 1�2D� E�"�G�K�G�&�
���������-�"(�"3�"3�C�"8����4���C�K�K��/��6�
��������0E�0E�F����K�M��)�)�+�j�8�I��-�-�.;�_�Y�=W� X�
�������-� $�
�A 	%�D��-� ��
��5G��!�.�1����s�$H6�?H;�;I�
Ic��|jj|j�}|jr|j�d|��}|S)Nz then )r:r�r\r;)r�r�s  r�r�zRegrtest.get_state�sA�����&�&�t�'<�'<�=������'�'�(��u�g�6�E��r�rXc�j�ddlm}||||j|j�j	�y)Nr)�
RunWorkers)�run_workersrr<r:r�)r�r�rXrs    r�r�zRegrtest._run_tests_mp�s$��+��;��$�+�+�t�|�|�D�H�H�Jr�c�6�|jri|jr>t|jd�5}|j|jdz�ddd�nt	j
|j�|�.|j
�}|jdd|j��|jr*t	jdt	j�z�|jr&|jj|j�yy#1swY��xYw)N�w�
T)�show_missing�summaryruzleaks %d)r�r�r��writerc�unlinkr:�
write_resultsrvrI�system�getpidrj�write_junit)r�r�r�r:s    r��finalize_testszRegrtest.finalize_tests�s����$�$��$�$��$�3�3�S�9�;�R��H�H�T�2�2�T�9�:�;�;��	�	�$�3�3�4����n�n�&�G��!�!�t�T�+/�+<�+<�
"�
>�����I�I�j�2�9�9�;�.�/�����L�L�$�$�T�%8�%8�9��;�;�s�D�Dc�N�tj�|jjz
}t	|j
�}t
�t
dt|�z�|jj|j|�|j�}t
d|���y)NzTotal duration: %szResult: )r�r�r<r��boolrPr�r r:�display_summaryr~r�)r��duration�filteredr�s    r�r#zRegrtest.display_summary�s����$�$�&����)?�)?�?����(�(�)��	��
�"�_�X�%>�>�?����$�$�T�%8�%8�(�C���� ��
���� �!r�c��t|fid|j�d|j�d|j�dd�dd�d|j�d|j
�d	|j�d
|j�d|j�d|j�d
|j�d|j�d|j�d|jdu�d|j�d|j�d|j �d|j"�d|j$�d|j&��S)Nr[r\rPr�rFFr^r7r8r`rar5r6rfrh�	use_junitrlrnrprrryr{)rr[r\rPr^r7r8r`rar5r6rfrhrjrlrnrprrryr{)r�r�s  r��create_run_testszRegrtest.create_run_tests�sG����
��n�n�
�"�2�2�
��(�(�	
�
"�
��

��L�L�
����
��*�*�
�#�4�4�
��L�L�
��L�L�
��*�*�
��*�*�
��]�]�
� �*�*�$�6�!
�"�*�*�#
�$�*�*�%
�&�,�,�'
�(���)
�*�n�n�+
�,�(�(�-
�	
r�r�c�F�|jr7|jjdkrd}t|tjd��|j
dkrt
�xsddz|_|js2|jsF|js:|js.|s,|js t|j|j�td|j�|j!|�}||_|j$j'|�t)�|j�|j
sd	}nt*}|r|j$j-�	|j
r|j/||j
�d}n|j1|�}|j3|�|j4r+|j6j9�r|j;|�|j<r+|j6j9�r|j?|�|r|j$jA�	|jC�|jE|�|j6jG|jH|jJ�S#|r|j$jA�wwxYw)
N�zhWARNING: Running tests with --huntrleaks/-R and less than 3 warmup repetitions can give false positives!T)�filer�rr�zUsing random seed:F)&rfr�r�r��stdoutrXr*r>r7r6r�rVr%rprrr{r(r~r<r�rr�start_load_trackerr�rr�rGr:�
need_rerunr�rKr��stop_load_trackerr#r �get_exitcoder\r])r�r�r�rr��use_load_trackerr�s       r��
_run_testszRegrtest._run_tests�s
������!2�!2�!:�!:�Q�!>�N�C��#�C�J�J�d�3����a��!2� 3� 8�q�A�=�D��
����8�8�t�z�z�T�-A�-A��t�0�0��4�-�-�t���?�
�"�D�$4�$4�5��(�(��2��&��������h�'����!�!�-��8H�8H�$�� *����K�K�*�*�,�	0�����"�"�8�T�-=�-=�>����4�4�X�>������)����4�<�<�#:�#:�#<��'�'��1����D�L�L�$;�$;�$=�����)�����-�-�/��������F�#��|�|�(�(��)>�)>�)-���:�	:��
 ����-�-�/� �s
�B;J�J c�@�tj|jd��t|j�}t	�5tj|d��5|j||�cddd�cddd�S#1swYnxYw	ddd�y#1swYyxYw)NT)�exist_ok)r6)rc�makedirsrxr#r$r�temp_cwdr3)r�r�r��work_dirs    r��	run_testszRegrtest.run_testss���
���D�L�L�4�0�����-���^�
	8�
�#�#�H�D�9�
8�
���x��7�
8�
8�
	8�
	8�

8�
8��
8�
	8�
	8�
	8�s$�B�A>�+	B�>B	�B�Bc��t|j�}d}t�}t�}|rchd�}tj
}tj
j
�D��	cic]\}}	|jd�r||vr||	��}
}}	|
|k7r|
}d}|ra|r_|jdk(r|jddg�|js1tjd�}|�d|��}|jd	|g�d}||fScc}	}w)
N>�
PYTHONPATH�_PYTHON_PROJECT_BASE�_PYTHON_HOST_PLATFORM�_PYTHON_SYSCONFIGDATA_NAME)�PYTHON�_PYTHONTrz-j�2�BUILDPYTHON� z--python)r"rrr(r)rcrz�itemsr�rXr��	sysconfig�get_config_var)
r��
regrtest_opts�keep_environrz�
cross_compile�
hostrunner�keep�old_environr��value�new_environ�buildpythonrrs
             r��_add_cross_compile_optsz Regrtest._add_cross_compile_opts0s���D�O�O�,����*�+�
�%�&�
���D��*�*�K�/1�z�z�/?�/?�/A�� +��e����'<�=�����e���K��
�k�)�%���L��Z����1�$��$�$�d�C�[�1��?�?�'�6�6�}�E�� *�|�1�[�M�:�
��$�$�j�*�%=�>�#����&�&��/s�#"C8c�Z�tjjs|jd�dtjvr|jd�tjjdkr|jd�|s-tjjs|jd�yyy)Nr��default)z-WrRr,z-bbz-E)	r�r-�
write_throughr��warnoptionsr��flags�
bytes_warning�ignore_environment)r��python_optsrHs   r��_add_ci_python_optszRegrtest._add_ci_python_opts_s���
�z�z�'�'����t�$��C�O�O�+����0�1��9�9�"�"�Q�&����u�%���9�9�/�/��"�"�4�(�0�r�c��tjj�tjj�t	j
|�}	t
d|��d��ttd�r tstj|d|�yddl}|j||��5}	|j�ddd�tj$j(�y#t$ri	|jt��nN#|j $r<|j#�|j�tj$t&�YnwxYwY��wxYw#1swY��xYw#t*$r}t-d|�d	|���Yd}~yd}~wwxYw)
Nz+ Tr��execvr)�envr�z!Failed to change Python options: z

Command: )r�r-r��stderrr�r�r��hasattrrcrr[r��PopenrB�KeyboardInterruptr+�TimeoutExpired�killr�rr��	Exceptionr')r�r�rz�cmd_textr�r��excs       r��_execute_pythonzRegrtest._execute_pythonts>���
�
�����
�
�����:�:�c�?��	2��B�x�j�/��.��r�7�#�J�����Q���%�"��%�%�c�w�%�7�;�4�
;��	�	��;�������)��-�;�;� �I�I�l�I�;��)�8�8�;� �I�I�K� �I�I�K��H�H�%9�:�;��;��;�;���	2��=�c�W�E&�&.�Z�1�
2�
2��	2�sy�?E%�E%�*E�,C$�<'E%�$	E�.D�E�AE�
E�E�E�E�E�E�E"�E%�%	F	�.F�F	c�*�g}g}|j|�\}}|jr|j||�|s|s|�yttj
�}|r||dd|r|j
|�|jd�|j||�y)Nrz--dont-add-python-opts)	rPrNrY�listr��	orig_argvr�r�rf)r�rXrGrzrHr�s      r�r/zRegrtest._add_python_opts�s������
� $� <� <�]� K�����<�<��$�$�[�,�?��m�'�/���3�=�=�!���"�C��!�H���J�J�}�%��
�
�+�,����S�'�*r�c�h�tjjd��|jrWtj
j
|j�s.tj
j|j�|_t|j�t|j�|_y)N�backslashreplace)�errors)r�r-�reconfigurerjrcrd�isabsrerrVr"rx)r�s r��_initzRegrtest._init�sq��	�
�
���&8��9����r�w�w�}�}�T�5H�5H�'I�"$�'�'�/�/�$�2E�2E�"F�D����)�)�*�#�D�L�L�1��r�c�4�|jr|j�|j�|jr*t	|j
�t
jd�|jrtd�t|j�|j|�\}}d}|jr|j|�nA|jr#t!||j"|j��n|j%||�}t
j|�y)NrzPress any key to continue...)rPrh)rOr/rorEr&rxr�r�rC�inputrrhr�r@r?rArrPr9)r�r�r�r�s    r��mainz
Regrtest.main�s����$�$��!�!�#��
�
������T�\�\�*��H�H�Q�K��>�>��0�1��t�}�}�%��/�/�%�0���%�������O�O�H�%�
�
!�
!��x�#'�#3�#3� $�
�
�
/��~�~�h��6�H�����r�)F)r�r�)&�__name__�
__module__�__qualname__�__doc__rr"r�r�rrorr��staticmethodr?rr�r�rr�r�r�rr�rr�r4r�r r#r(r3r9rPrYrfr/rorr�r�r�r-r-su���,d9�9�d9��d9�L�F(��4��F(�5��H�W[�O�A[�;\�F(�P��)�����H��2,�8�,�($�H�$�C�$�3�$�4�$�L	�8�	��	�
D�
�(�
�h�
�:�x�K�h�K�S�K�T�K�:�&"�
�i�
�48:�9�8:�X��_�8:��8:�t8�)�8�H�t�O�8��8�"-'�^)�*2�D+�,2��(�T�/�r�r-c�x�ttjddfi|��}t||��j	|��y)zRun the Python suite.rN)r/)r�)rr��argvr-rr)r�r/�kwargsr.s    r�rrrr�s4��	�S�X�X�a�b�\�	,�V�	,�B��R�"2�3�8�8�u�8�Er�)NF)<rcr|r�r�r�rEr��test.supportrrr�cmdlinerrr	r
rr<rr7r
r�rr:rrr�rr�setuprrr�rrr9r�utilsrrrrrrrrr r!r"r#r$r%r&r'r(r)r*r+r-rrrxr�r��<module>r�sr��	�
�	��
���A�A�+�A�A�� ��6�+�0�6�"�������u
�u
�pFr�

Zerion Mini Shell 1.0