관리-도구
편집 파일: test_mman.cpython-311.pyc
� �܋fB* � � � d dl mZmZ ddlmZmZmZ ddlmZ ddl m Z ddlmZ ddlZddl Z ddlmZ G d � d e� � ZdS )� )�TestBase�FileCreator� )�WindowCursor�SlidingWindowMapManager�StaticWindowMapManager)� align_to_mmap)�randint)�timeN)�copyc � � e Zd Zd� Zd� Zd� ZdS )�TestMManc � � t | j d� � 5 }t � � }t |� � }|� � � rJ �|� � � rJ �|� � � dk sJ �|� |j � � }|� � � rJ �|� � � sJ �|� � � |j k sJ �|� � � |j k sJ � d d d � � n# 1 swxY w Y t |� � }|� � � s|� � � sJ �|� � � rJ �|� |� � |� � � s|� � � sJ �|� � � |� � � |� � � t |� � � � � d S )N�cursor_testr )r �k_window_test_sizer r �is_valid� is_associated�size�make_cursor�path� file_sizer �assign�unuse_region�_destroy)�self�fc�man�ci�cv�cios �e/builddir/build/BUILD/cloudlinux-venv-1.0.6/venv/lib/python3.11/site-packages/smmap/test/test_mman.py�test_cursorzTestMMan.test_cursor s � � ��0�-� @� @� (�B�)�+�+�C��c�"�"�B��{�{�}�}�$�$�$��'�'�)�)�)�)�)��7�7�9�9��>�>�>�>������)�)�B��{�{�}�}�$�$�$��#�#�%�%�%�%�%��<�<�>�>�R�W�,�,�,�,��7�7�9�9���'�'�'�'�'� (� (� (� (� (� (� (� (� (� (� (���� (� (� (� (� �2�h�h���<�<�>�>�9�c�&7�&7�&9�&9�9�9�9� �#�#�%�%�%�%�%� � � �"� � � ��;�;�=�=�7�R�%5�%5�%7�%7�7�7�7� ������ ������ ��� � � ��S���"�"�$�$�$�$�$s �C(D�D�Dc �� � t � � }t � � }||fD �]�}|� � � dk sJ �|� � � dk sJ �d}t |t � � rd}|� � � |k sJ �|� � � dk sJ �|� � � dk sJ �|� d� � |� d� � |� t j � � dk sJ �t | j d� � 5 }t j |j t j � � } |j |fD ]�}|� |� � }|� � � |u sJ �|� dd� � � � � sJ �|� � � dk sJ �|� � � dk sJ �t |j d� � 5 } |� � � d d � | � d� � dd � k sJ � d d d � � n# 1 swxY w Y ��t |t2 � � r!| � t6 |j � � n | � t6 |j � � t j |� � n# t j |� � w xY w d d d � � n# 1 swxY w Y ���d S )Nr ���� �manager_test�rb� )r r �num_file_handles�num_open_files� isinstance�window_size�mapped_memory_size�max_mapped_memory_size�_collect_lru_region�sys�maxsizer r �os�openr �O_RDONLYr � path_or_fd� use_regionr � ofs_beginr �buffer�read�int�assertRaises� ValueError�fd�close) r � slide_man� static_manr �winsize_cmp_valr r= �item�c�fps r! �test_memory_managerzTestMMan.test_memory_manager2 s^ � �+�-�-� �+�-�-� �� �*� ' !� ' !�C��'�'�)�)�Q�.�.�.�.��%�%�'�'�1�,�,�,�,��O��#�5�6�6� %�"$���?�?�$�$��6�6�6�6��)�)�+�+�q�0�0�0�0��-�-�/�/�!�3�3�3�3� �#�#�A�&�&�&��#�#�B�'�'�'� �*�*�3�;�7�7�1�<�<�<�<� �T�4�n�E�E� !���W�R�W�b�k�2�2��!�!#��"� � E� E���O�O�D�1�1�� �|�|�~�~��5�5�5�5� �|�|�B��3�3�<�<�>�>�>�>�>� �{�{�}�}��2�2�2�2� �v�v�x�x�2�~�~�~�~�!�"�'�4�0�0� E�B�#$�8�8�:�:�a�a�a�=�B�G�G�B�K�K����4D�#D�#D�#D�#D�#D�E� E� E� E� E� E� E� E� E� E� E���� E� E� E� E�� "�$��,�,� <��)�)�*�a�f�=�=�=�=��)�)�*�a�d�;�;�;� �H�R�L�L�L�L��B�H�R�L�L�L�L����L�' !� !� !� !� !� !� !� !� !� !� !���� !� !� !� !��)' !� ' !sP �#%K� B+J6�4>H? �3J6�?I �J6�I �AJ6�!K�6K�K�K �#K c � � t | j d� � 5 }t |j d� � 5 }|� � � }d d d � � n# 1 swxY w Y t j |j t j � � } d}t d|j dz |fft |j dz |j dz |fffD �]E\ }}|j |fD �]4}t |� � |j k sJ � ||d |d |d � � � } | � |� � } | � � � dk sJ �| � � � dk sJ �d }| � � � dz }| � ||� � � � � sJ �| � � � } | � � � dk sJ �| � � � dk sJ �| � � � dk sJ �| � � � | � � � k sJ �| � � � |k sJ �| � � � dk sJ �| � � � r;| � � � t+ | � � � d� � k sJ �n| � � � |j k sJ �| � � � d d � ||||p| � � � z � k sJ �|p|j dz }| � d|� � � � � sJ �| � � � | k sJ �| � � � dk sJ �| � � � |k sJ �| � � � dk sJ �| � � � d d � |d |� k sJ �d }|j |p| � � � z |z }| � ||� � � � � sJ �| � � � rg| � � � dk sJ �| � � � |k sJ �| � � � | usJ �| � � � dk sJ �n| � � � |j k sJ �| � � � } | � � � dk sJ �| � � � | � � � k sJ �| � � � |j k sJ �| � � � d d � ||||p| � � � z � k sJ �| � � � | � � � rJ �| � � � r| � � � dk sJ �d }|}d}t3 � � }| j }| � � � }| � � � }| j }| j }|�r|dz }t; d|j dz � � }| � � � r| |� � k sJ �| |� � k sJ �| � ||p| � � � � � � � � sJ �| � � � }| � � � d d � ||||z � k sJ �||z } ||� � sJ � |||z dz � � sJ � |||z � � rJ �|��t= t3 � � |z d� � }t? d� � }tA d|||z |tC |� � |||z |z fz tD j# �� � | � |j |� � � � � rJ �| � � � sJ �| �$ � � sJ �| � � � dk sJ ���6��G t j% |� � n# t j% |� � w xY w d d d � � d S # 1 swxY w Y d S )N�manager_operation_testr'