Uname:Linux server2.hostofiraq.site 5.15.0-186-generic #196-Ubuntu SMP Sat Jun 20 16:09:34 UTC 2026 x86_64

Base Dir : /home/iscmbt-kufa-atu/public_html

User : iscmbt-kufa-atu


403WebShell
403Webshell
Server IP : 89.117.53.150  /  Your IP : 216.73.216.11
Web Server : Apache
System : Linux server2.hostofiraq.site 5.15.0-186-generic #196-Ubuntu SMP Sat Jun 20 16:09:34 UTC 2026 x86_64
User : iscmbt-kufa-atu ( 1014)
PHP Version : 8.2.32
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : OFF  |  Sudo : ON  |  Pkexec : ON
Directory :  /lib/python3/dist-packages/psutil/tests/__pycache__/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /lib/python3/dist-packages/psutil/tests/__pycache__/test_memleaks.cpython-310.pyc
o

���a :�@sdZddlmZddlZddlZddlZddlZddlmZddlmZddlm	Z	ddlm
Z
ddlmZdd	lmZdd
l
mZddl
mZddlmZdd
lmZddlmZddlmZddlmZddlmZddlmZddlmZddlmZddlmZddlmZddlmZddlmZddlmZddlmZddlm Z ddlm!Z!ddlm"Z"ddlm#Z#ddlm$Z$dd lm%Z%ej&j'Z'e�(�Z)d!Z*d"d#�Z+Gd$d%�d%e�Z,Gd&d'�d'e,�Z-e%�.ed(�Gd)d*�d*e��Z/Gd+d,�d,e�Z0e1d-k�rdd.l2m3Z3e3e4�dSdS)/a�
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)�TestMemoryLeak)�create_sockets)�
get_testfn)�process_namespace)�skip_on_access_denied)�spawn_testproc)�system_namespace)�	terminate)�unittest�cCsdd�}|S)zsDecorator for those Linux functions which are implemented in pure
    Python, and which we want to run faster.
    cst����fdd��}|S)NcsVtr |jj}zt|j_�|g|�Ri|��W||j_S||j_w�|g|�Ri|��S�N)r�	__class__�times�	FEW_TIMES)�self�args�kwargs�before��fun��</usr/lib/python3/dist-packages/psutil/tests/test_memleaks.py�wrapperBsz5fewtimes_if_linux.<locals>.decorator.<locals>.wrapper)�	functools�wraps)r*r-r+r)r,�	decoratorAs
z$fewtimes_if_linux.<locals>.decoratorr+)r0r+r+r,�fewtimes_if_linux=s
r1c@s�eZdZdZeZdd�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.cCs td�}|�||j|j�dSr!)r�test_class_coverage�getters�setters�r%�nsr+r+r,�
test_coverage[�z$TestProcessObjectLeaks.test_coveragecC�|�|jj�dSr!)�execute�proc�name�r%r+r+r,�	test_name_�z TestProcessObjectLeaks.test_namecCr:r!)r;r<�cmdliner>r+r+r,�test_cmdlinecr@z#TestProcessObjectLeaks.test_cmdlinecCr:r!)r;r<�exer>r+r+r,�test_exegr@zTestProcessObjectLeaks.test_execCr:r!)r;r<�ppidr>r+r+r,�	test_ppidkr@z TestProcessObjectLeaks.test_ppidz
POSIX onlycCr:r!)r;r<�uidsr>r+r+r,�	test_uidso�z TestProcessObjectLeaks.test_uidscCr:r!)r;r<�gidsr>r+r+r,�	test_gidstrIz TestProcessObjectLeaks.test_gidscCr:r!)r;r<�statusr>r+r+r,�test_statusyr@z"TestProcessObjectLeaks.test_statuscCr:r!)r;r<�nicer>r+r+r,�	test_nice}�z TestProcessObjectLeaks.test_nicecs t�������fdd��dS)Nc��j���Sr!)r<rNr+��nicenessr%r+r,�<lambda>��z6TestProcessObjectLeaks.test_nice_set.<locals>.<lambda>)�thisprocrNr;r>r+rRr,�
test_nice_set�r9z$TestProcessObjectLeaks.test_nice_set�
not supportedcCr:r!)r;r<�ionicer>r+r+r,�test_ionice�r@z"TestProcessObjectLeaks.test_ionicecs\trt�������fdd��dS���fdd��t�tjt�	�dd�}��
t|�dS)Ncs�j���Sr!)r<rYr+�r%�valuer+r,rT�rUz8TestProcessObjectLeaks.test_ionice_set.<locals>.<lambda>c��j�tj�Sr!)r<rY�psutil�IOPRIO_CLASS_NONEr+r>r+r,rT�����r)rrVrYr;r.�partial�cext�proc_ioprio_set�os�getpid�
execute_w_exc�OSError�r%r*r+r[r,�test_ionice_set�sz&TestProcessObjectLeaks.test_ionice_setcCr:r!)r;r<�io_countersr>r+r+r,�test_io_counters�rIz'TestProcessObjectLeaks.test_io_counterszworthless on POSIXcCst����|�|jj�dSr!)r^�Process�usernamer;r<r>r+r+r,�
test_username�sz$TestProcessObjectLeaks.test_usernamecCr:r!)r;r<�create_timer>r+r+r,�test_create_time�r@z'TestProcessObjectLeaks.test_create_time)�only_ifcCr:r!)r;r<�num_threadsr>r+r+r,�test_num_threads�rIz'TestProcessObjectLeaks.test_num_threads�WINDOWS onlycCr:r!)r;r<�num_handlesr>r+r+r,�test_num_handles�r@z'TestProcessObjectLeaks.test_num_handlescCr:r!)r;r<�num_fdsr>r+r+r,�test_num_fds�rIz#TestProcessObjectLeaks.test_num_fdscCr:r!)r;r<�num_ctx_switchesr>r+r+r,�test_num_ctx_switches�r@z,TestProcessObjectLeaks.test_num_ctx_switchescCr:r!)r;r<�threadsr>r+r+r,�test_threads�rIz#TestProcessObjectLeaks.test_threadscCr:r!)r;r<�	cpu_timesr>r+r+r,�test_cpu_times�r@z%TestProcessObjectLeaks.test_cpu_timescCr:r!)r;r<�cpu_numr>r+r+r,�test_cpu_num�rIz#TestProcessObjectLeaks.test_cpu_numcCr:r!)r;r<�memory_infor>r+r+r,�test_memory_info�r@z'TestProcessObjectLeaks.test_memory_infocCr:r!)r;r<�memory_full_infor>r+r+r,�test_memory_full_info�r@z,TestProcessObjectLeaks.test_memory_full_infocCr:r!)r;r<�terminalr>r+r+r,�
test_terminal�rIz$TestProcessObjectLeaks.test_terminalcCs$trtn|j}|j|jj|d�dS)N�r#)rr$r#r;r<�resume�r%r#r+r+r,�test_resume��z"TestProcessObjectLeaks.test_resumecCr:r!)r;r<�cwdr>r+r+r,�test_cwd�r@zTestProcessObjectLeaks.test_cwdcCr:r!)r;r<�cpu_affinityr>r+r+r,�test_cpu_affinity�r@z(TestProcessObjectLeaks.test_cpu_affinitycs4t�������fdd����t�fdd��dS)NcrQr!�r<r�r+��affinityr%r+r,rT�rUz>TestProcessObjectLeaks.test_cpu_affinity_set.<locals>.<lambda>cs�j�dg�S�Nrar�r+r>r+r,rT�r`)rVr�r;rg�
ValueErrorr>r+r�r,�test_cpu_affinity_set�s
�z,TestProcessObjectLeaks.test_cpu_affinity_setcCs@tt�d��|�|jj�Wd�dS1swYdS)N�w)�openrr;r<�
open_filesr>r+r+r,�test_open_files�s"�z&TestProcessObjectLeaks.test_open_filescCr:r!)r;r<�memory_mapsr>r+r+r,�test_memory_maps�rIz'TestProcessObjectLeaks.test_memory_mapsz
LINUX onlycs���fdd��dS)Ncr]r!�r<�rlimitr^�
RLIMIT_NOFILEr+r>r+r,rT�r`z4TestProcessObjectLeaks.test_rlimit.<locals>.<lambda>�r;r>r+r>r,�test_rlimit�sz"TestProcessObjectLeaks.test_rlimitcs<t�tj������fdd����ttf�fdd��dS)Ncs�j�tj��Sr!r�r+��limitr%r+r,rT�sz8TestProcessObjectLeaks.test_rlimit_set.<locals>.<lambda>cs�j�d�Sr�)r<r�r+r>r+r,rT�rU)rVr�r^r�r;rgrhr�r>r+r�r,�test_rlimit_set�sz&TestProcessObjectLeaks.test_rlimit_setzworthless on WINDOWScsLt��trdnd�����fdd��Wd�dS1swYdS)N�inet�allcrQr!)r<�connectionsr+��kindr%r+r,rTrUz9TestProcessObjectLeaks.test_connections.<locals>.<lambda>)rrr;r>r+r�r,�test_connections�s"�z'TestProcessObjectLeaks.test_connectionscCr:r!)r;r<�environr>r+r+r,�test_environr@z#TestProcessObjectLeaks.test_environcC�|�dd��dS)NcS�t�t���Sr!)rc�	proc_inforerfr+r+r+r,rT	r`z7TestProcessObjectLeaks.test_proc_info.<locals>.<lambda>r�r>r+r+r,�test_proc_infor@z%TestProcessObjectLeaks.test_proc_infoN)9�__name__�
__module__�__qualname__�__doc__rVr<r8r1r?rBrDrFr�skipIfrrHrKrMrOrWrrZrjrrlrorqrrrtrrwryr{r}rrr�r�r�r�r�r�rr�r�r�rr�rrr�r�r�r
r�r�r+r+r+r,r2Vs�






	













r2csxeZdZdZe�fdd��Ze�fdd��Zdd�Zer8dd	�Z	d
d�Z
dd
�Zdd�Zdd�Z
dd�Z�ZS�ZS)�TestTerminatedProcessLeaksz�Repeat the tests above looking for leaks occurring when dealing
    with terminated processes raising NoSuchProcess exception.
    The C functions are still invoked but will follow different code
    paths. We'll check those code paths.
    cs:t���t�|_t�|jj�|_|j��|j�	�dSr!)
r
�
setUpClassr�subpr^rm�pidr<�kill�wait��cls�r"r+r,r�s


z%TestTerminatedProcessLeaks.setUpClasscst���t|j�dSr!)r
�
tearDownClassrr�r�r�r+r,r�s
z(TestTerminatedProcessLeaks.tearDownClasscCs$z|�WdStjyYdSwr!)r^�
NoSuchProcessrir+r+r,�call s
�zTestTerminatedProcessLeaks.callcCr:r!)r;r<r�r>r+r+r,�	test_kill(rPz$TestTerminatedProcessLeaks.test_killcCr:r!)r;r<rr>r+r+r,�test_terminate+rPz)TestTerminatedProcessLeaks.test_terminatecCr:r!)r;r<�suspendr>r+r+r,�test_suspend.rPz'TestTerminatedProcessLeaks.test_suspendcCr:r!)r;r<r�r>r+r+r,r�1rPz&TestTerminatedProcessLeaks.test_resumecCr:r!)r;r<r�r>r+r+r,�	test_wait4rPz$TestTerminatedProcessLeaks.test_waitcs�fdd�}��|�dS)Ncs&zt��jj�WStyYdSwr!)rcr�r<r�r	r+r>r+r,r�9s
�z7TestTerminatedProcessLeaks.test_proc_info.<locals>.callr�)r%r�r+r>r,r�7sz)TestTerminatedProcessLeaks.test_proc_info)r�r�r�r��classmethodr�r�r�rr�r�r�r�r�r��
__classcell__r+r+r�r,r�s�r�ruc@seZdZdd�Zdd�ZdS)�TestProcessDualImplementationcCr�)NcS�tjt��dd�S)NT��use_peb�rc�proc_cmdlinererfr+r+r+r,rTF�zETestProcessDualImplementation.test_cmdline_peb_true.<locals>.<lambda>r�r>r+r+r,�test_cmdline_peb_trueErPz3TestProcessDualImplementation.test_cmdline_peb_truecCr�)NcSr�)NFr�r�r+r+r+r,rTIr�zFTestProcessDualImplementation.test_cmdline_peb_false.<locals>.<lambda>r�r>r+r+r,�test_cmdline_peb_falseHrPz4TestProcessDualImplementation.test_cmdline_peb_falseN)r�r�r�r�r�r+r+r+r,r�Bsr�c@s�eZdZdZdd�Ze�dd��Ze�dd��Ze�dd	��Ze�d
d��Z	e�dd
��Z
e�e�e
d�dd���Ze�ed�dd��Zdd�Ze�ed�dd��Zdd�Zdd�Zdd�Ze�eojej�d�d �e�d!d"���Ze�d#d$��Ze�e�ed�d%d&���Ze�e�eo�e� �d'kd(�d)d*���Z!d+d,�Z"d-d.�Z#e�e�e$d�d/d0���Z%e�e�e&d�d1d2���Z'e�e�e(d�d3d4���Z)e�d5d6��Z*d7d8�Z+d9d:�Z,er�d;d<�Z-d=d>�Z.d?d@�Z/dAdB�Z0dCdD�Z1dESdES)F�TestModuleFunctionsLeaksz&Test leaks of psutil module functions.cCst�}|�||j�dSr!)rr3r�r6r+r+r,r8Tsz&TestModuleFunctionsLeaks.test_coveragecCr�)NcS�tjdd�S)NT��logical�r^�	cpu_countr+r+r+r,rT\rUz9TestModuleFunctionsLeaks.test_cpu_count.<locals>.<lambda>r�r>r+r+r,�test_cpu_countZr@z'TestModuleFunctionsLeaks.test_cpu_countcCr�)NcSr�)NFr�r�r+r+r+r,rT`rUz?TestModuleFunctionsLeaks.test_cpu_count_cores.<locals>.<lambda>r�r>r+r+r,�test_cpu_count_cores^r@z-TestModuleFunctionsLeaks.test_cpu_count_corescC�|�tj�dSr!)r;r^r~r>r+r+r,rb�z'TestModuleFunctionsLeaks.test_cpu_timescCr�)NcSr�)NT)�percpu)r^r~r+r+r+r,rThrUz=TestModuleFunctionsLeaks.test_per_cpu_times.<locals>.<lambda>r�r>r+r+r,�test_per_cpu_timesfr@z+TestModuleFunctionsLeaks.test_per_cpu_timescCr�r!)r;r^�	cpu_statsr>r+r+r,�test_cpu_statsjr�z'TestModuleFunctionsLeaks.test_cpu_statsrXcCr�r!)r;r^�cpu_freqr>r+r+r,�
test_cpu_freqn�z&TestModuleFunctionsLeaks.test_cpu_freqrucCst��|�tj�dSr!)r^�
getloadavgr;r>r+r+r,�test_getloadavgssz(TestModuleFunctionsLeaks.test_getloadavgcCr�r!)r;r^�virtual_memoryr>r+r+r,�test_virtual_memoryz�z,TestModuleFunctionsLeaks.test_virtual_memoryz&worthless on SUNOS (uses a subprocess)cCr�r!)r;r^�swap_memoryr>r+r+r,�test_swap_memory~r�z)TestModuleFunctionsLeaks.test_swap_memorycC�$trtn|j}|jdd�|d�dS)NcSr�r!)r^�
pid_existsrerfr+r+r+r,rT�r`z:TestModuleFunctionsLeaks.test_pid_exists.<locals>.<lambda>r��rr$r#r;r�r+r+r,�test_pid_exists�r�z(TestModuleFunctionsLeaks.test_pid_existscCr�)NcS�
t�d�S)N�.)r^�
disk_usager+r+r+r,rT��
z:TestModuleFunctionsLeaks.test_disk_usage.<locals>.<lambda>r�r�r�r+r+r,�test_disk_usage�r�z(TestModuleFunctionsLeaks.test_disk_usagecCr�r!)r;r^�disk_partitionsr>r+r+r,�test_disk_partitions�r�z-TestModuleFunctionsLeaks.test_disk_partitionsz/proc/diskstatsz3/proc/diskstats not available on this Linux versioncCr�)NcSr��NF)�nowrap)r^�disk_io_countersr+r+r+r,rT�rUz@TestModuleFunctionsLeaks.test_disk_io_counters.<locals>.<lambda>r�r>r+r+r,�test_disk_io_counters�sz.TestModuleFunctionsLeaks.test_disk_io_counterscCr�r!)r;r^�pidsr>r+r+r,�	test_pids�r�z"TestModuleFunctionsLeaks.test_pidscCr�)NcSr�r�)r^�net_io_countersr+r+r+r,rT�rUz?TestModuleFunctionsLeaks.test_net_io_counters.<locals>.<lambda>r�r>r+r+r,�test_net_io_counters�rIz-TestModuleFunctionsLeaks.test_net_io_countersrzneed root accesscCsFtjdd�t��|�dd��Wd�dS1swYdS)Nr��r�cSr�)Nr�r�)r^�net_connectionsr+r+r+r,rT�rUz?TestModuleFunctionsLeaks.test_net_connections.<locals>.<lambda>)r^r�rr;r>r+r+r,�test_net_connections�s"�z-TestModuleFunctionsLeaks.test_net_connectionscCs"trdn|j}|jtj|d�dS)Ni@)�	tolerance)rrr;r^�net_if_addrs)r%rr+r+r,�test_net_if_addrs�sz*TestModuleFunctionsLeaks.test_net_if_addrscCr�r!)r;r^�net_if_statsr>r+r+r,�test_net_if_stats�r�z*TestModuleFunctionsLeaks.test_net_if_statscCr�r!)r;r^�sensors_batteryr>r+r+r,�test_sensors_battery�r�z-TestModuleFunctionsLeaks.test_sensors_batterycCr�r!)r;r^�sensors_temperaturesr>r+r+r,�test_sensors_temperatures�r�z2TestModuleFunctionsLeaks.test_sensors_temperaturescCr�r!)r;r^�sensors_fansr>r+r+r,�test_sensors_fans�r�z*TestModuleFunctionsLeaks.test_sensors_fanscCr�r!)r;r^�	boot_timer>r+r+r,�test_boot_time�r�z'TestModuleFunctionsLeaks.test_boot_timecCr�r!)r;r^�usersr>r+r+r,�
test_users�r�z#TestModuleFunctionsLeaks.test_userscCr�)NcSr�)NF)r^�
_set_debugr+r+r+r,rT�r�z9TestModuleFunctionsLeaks.test_set_debug.<locals>.<lambda>r�r>r+r+r,�test_set_debug�rPz'TestModuleFunctionsLeaks.test_set_debugcCr�r!)r;rc�winservice_enumerater>r+r+r,�test_win_service_iter�r�z.TestModuleFunctionsLeaks.test_win_service_itercCsdSr!r+r>r+r+r,�test_win_service_get�sz-TestModuleFunctionsLeaks.test_win_service_getc�&tt������|��fdd��dS)Nc�
t���Sr!)rc�winservice_query_configr+�r=r+r,rT�r�zFTestModuleFunctionsLeaks.test_win_service_get_config.<locals>.<lambda>��nextr^�win_service_iterr=r;r>r+rr,�test_win_service_get_config��z4TestModuleFunctionsLeaks.test_win_service_get_configcr)Ncrr!)rc�winservice_query_statusr+rr+r,rT�r�zFTestModuleFunctionsLeaks.test_win_service_get_status.<locals>.<lambda>rr>r+rr,�test_win_service_get_status�rz4TestModuleFunctionsLeaks.test_win_service_get_statuscr)Ncrr!)rc�winservice_query_descrr+rr+r,rT�r�zKTestModuleFunctionsLeaks.test_win_service_get_description.<locals>.<lambda>rr>r+rr,� test_win_service_get_description�rz9TestModuleFunctionsLeaks.test_win_service_get_descriptionN)2r�r�r�r�r8r1r�r�rr�r�rr�rr�rr�r�rr�r�r�r�rre�path�existsr�r�rr�r�getuidr�rrrrrrrr
rrrrrrrr r+r+r+r,r�Qsv







�

�r��__main__)�
run_from_name)5r��
__future__rr.rer^�psutil._commonrrrrrr�psutil._compatr	r
�psutil.testsrrr
rrrrrrrrrrrrrrrrrr�_psplatformrcrmrVr$r1r2r�r�r�r�r��psutil.tests.runnerr%�__file__r+r+r+r,�<module>sd76
�

Youez - 2016 - github.com/yon3zu
LinuXploit