gfdZddlZddlmZddlmZddlmZddlmZddlZeje dGdd eZ e d krdd l m Z e e dSdS) zAIX specific tests.N)AIX)PsutilTestCase)sh)unittestzAIX onlyc,eZdZdZdZdZdZdZdS)AIXSpecificTestCasectd}d}dD] }|d|dz } tj||}||dd}t |d|z}t |d |z}t |d |z}t |d |z} tj} d |z|z} | | j || | j || | | j || | | j| | dS)Nz/usr/bin/svmon -O unit=KBz memory\s*z+size inuse free pin virtual available mmode(?P<>\S+)\s+z(svmon command returned unexpected outputisize availableinusefreedelta)rsplitresearchassertIsNotNoneintgrouppsutilvirtual_memory assertEqualtotalassertAlmostEqualusedr r) selfout re_patternfieldmatchobjKBrr rr psutil_resultTOLERANCE_SYS_MEMs w/builddir/build/BUILD/imunify360-venv-2.3.5/opt/imunify360/venv/lib64/python3.11/site-packages/psutil/tests/test_aix.pytest_virtual_memoryz'AIXSpecificTestCase.test_virtual_memorys,--! CJJLL 7 7E Juuu6 6JJ9Z--  @ B B BHNN6**++b0{3344r9 8>>'**++b08>>&))**R/-// FRK ,e444   ,=  ? ? ?   #Y6G  I I I   ,=  ? ? ? ? ?c>td}tjd|}||dt |d}d}t j}|t |j |z |dS)Nz/usr/sbin/lsps -az=(?P\S+)\s+(?P\S+)\s+(?P\S+)\s+(?P\d+)MBz'lsps command returned unexpected outputr i) rrrrrrr swap_memoryrr)rr r#total_mbMBr%s r'test_swap_memoryz$AIXSpecificTestCase.test_swap_memory5s$%% 902566  ? A A Ax~~f--.. *,,  ]02566AAAAAr)ctd}d}dD] }|d|dz } tj||}||dd}t j}||jt| d| ||j t| d | ||j t| d | ||j t| d | dS) N/usr/bin/mpstat -azALL\s*zfmin maj mpcs mpcr dev soft dec ph cs ics bound rq push S3pull S3grd S0rd S1rd S2rd S3rd S4rd S5rd syscr r z)mpstat command returned unexpected outputicsrsyscdevsoft)rrrrrr cpu_statsr ctx_switchesrrsyscalls interruptssoft_interrupts)rr r!r"r#CPU_STATS_TOLERANCEr%s r'test_cpu_statsz"AIXSpecificTestCase.test_cpu_statsJs%&& #egg 7 7E Juuu6 6JJ9Z--  A C C C#(**    & t$$ % %%  ' ' '   " v&& ' '%  ' ' '   $ u%% & &%  ' ' '   ) v&& ' '%  ' ' ' ' 'r)ctd}ttjd|d}t jd}|||dS)Nr0z lcpu=(\d+)T)logical)rrrrrr cpu_countr)rr mpstat_lcpu psutil_lcpus r'test_cpu_count_logicalz*AIXSpecificTestCase.test_cpu_count_logicalksf%&&")M377==a@@AA &t444  k22222r)ctd}t|}ttj}|||dS)Nz/etc/ifconfig -l)rsetrr net_if_addrskeysassertSetEqual)rr ifconfig_names psutil_namess r'test_net_if_addrs_namesz+AIXSpecificTestCase.test_net_if_addrs_namesqsc#$$SYY[[))6.00557788  NL99999r)N)__name__ __module__ __qualname__r(r.r;rBrJr)r'rrsc???<BBB*'''B333 :::::r)r__main__) run_from_name)__doc__rrr psutil.testsrrrskipIfrrKpsutil.tests.runnerrP__file__rNr)r'rVs ''''''!!!!!! S*%%`:`:`:`:`:.`:`:&%`:F z111111M(r)