+
    Bi+                     (   R t ^ RIt^ RIt^ RIt^ RIHt ^ RIHt ^ RIHt ]	! ]R4      '       d   ]	! ]R4      '       g   ]P                  ! R4      h]P                  ! R4      t ! R	 R
]P                  4      t]R8X  d   ]P                   ! 4        R# R# )z)Tests for sys.audit and sys.addaudithook
N)support)import_helper)	os_helperaddaudithookauditz.test only relevant when sys.audit is availablezaudit-tests.pyc                     a  ] tR t^t o Rt]P                  ! 4       R 4       tR tRR/R lt	R t
R tR	 tR
 tR tR tR tR tR tR tR tR tR tR tR tR t]P4                  ! R4      R 4       tR tR tR tR tR t R t!R t"R  t#R! t$R" t%R# t&R$ t']PP                  ]PR                  R% 4       4       t*R&t+V t,R# )'	AuditTestNc                t   \         P                  ! \        P                  R \        .VORR\         P
                  \         P
                  R7      ;_uu_ 4       pVP                  4        W"P                  P                  4       VP                  P                  4       3uuRRR4       #   + '       g   i     R# ; i)z-X utf8zutf-8backslashreplace)encodingerrorsstdoutstderrN)

subprocessPopensys
executableAUDIT_TESTS_PYPIPEwaitr   readr   )selfargsps   &* &/usr/lib/python3.14/test/test_audit.pyrun_test_in_subprocess AuditTest.run_test_in_subprocess   s{    ^^Y>>%????
 
 FFHhhmmoqxx}}6
 
 
 
s   AB&&B7	c                    V P                   ! V!  w  r#p\        P                  P                  V4       \        P                  P                  V4       VP
                  '       d   V P                  V4       R # R # )N)r   r   r   writer   
returncodefail)r   r   procr   r   s   &*   r   do_testAuditTest.do_test!   sU    #::DAf

 

 ???IIf     expect_stderrFc               B   . pV P                   ! V!  w  rEpV'       d   \        P                  '       d    \        P                  P                  V4       VP                  VP                  4        Uu. uF!  qwP                  4       P                  R 4      NK#  	  upV3# u upi ) )
r   r   verboser   r   r   r   
splitlinesstrip	partition)r   r%   r   eventsr!   r   r   lines   &$*     r   
run_pythonAuditTest.run_python)   s|    #::DAfJJV$OO5;5F5F5HI5HTZZ\##C(5HI
 	
Is   0'Bc                (    V P                  R 4       R# )
test_basicNr"   r   s   &r   r1   AuditTest.test_basic4   s    \"r$   c                (    V P                  R 4       R# )test_block_add_hookNr2   r3   s   &r   r6   AuditTest.test_block_add_hook7   s    *+r$   c                (    V P                  R 4       R# )!test_block_add_hook_baseexceptionNr2   r3   s   &r   r9   +AuditTest.test_block_add_hook_baseexception:   s    89r$   c                T    \         P                  ! R 4       V P                  R4       R# )marshaltest_marshalNr   import_moduler"   r3   s   &r   r=   AuditTest.test_marshal=   s    ##I.^$r$   c                T    \         P                  ! R 4       V P                  R4       R# )pickletest_pickleNr>   r3   s   &r   rC   AuditTest.test_pickleB   s    ##H-]#r$   c                (    V P                  R 4       R# )test_monkeypatchNr2   r3   s   &r   rF   AuditTest.test_monkeypatchG   s    '(r$   c                F    V P                  R \        P                  4       R# )	test_openN)r"   r   TESTFNr3   s   &r   rI   AuditTest.test_openJ   s    [)"2"23r$   c                (    V P                  R 4       R# )test_cantraceNr2   r3   s   &r   rM   AuditTest.test_cantraceM   s    _%r$   c                (    V P                  R 4       R# )	test_mmapNr2   r3   s   &r   rP   AuditTest.test_mmapP   s    [!r$   c                T    \         P                  ! R 4       V P                  R4       R# )ctypestest_ctypes_call_functionNr>   r3   s   &r   rT   #AuditTest.test_ctypes_call_functionS   s    ##H-01r$   c                T    \         P                  ! R 4       V P                  R4       R# )_posixsubprocesstest_posixsubprocessNr>   r3   s   &r   rX   AuditTest.test_posixsubprocessW   s    ##$67+,r$   c                    V P                  R 4      w  rpV'       g   V P                  RV 24       V P                  R.V4       R# )test_excepthookzExpected fatal exception
N)zsys.excepthookr'   zRuntimeError('fatal-error'))r.   r    assertSequenceEqualr   r   r,   r   s   &   r   r[   AuditTest.test_excepthook[   sC    %)__5F%G"
FII26(;<  CDf	
r$   c                   \         P                  ! R 4       V P                  R4      w  rpV'       d   V P                  V4       V P	                  V^ ,          ^ ,          R4       V P	                  V^ ,          ^,          R4       R# )	_testcapitest_unraisablehookzsys.unraisablehookzDRuntimeError('nonfatal-error') Exception ignored for audit hook testN)r   r?   r.   r    assertEqualr]   s   &   r   ra   AuditTest.test_unraisablehookd   sh    ##K0%)__5J%K"
FIIf1';<1IaLR	
r$   c                   \         P                  ! R 4       V P                  R4      w  rpV'       d   V P                  V4       V P	                  V^ ,          ^ ,          R4       V P	                  V^,          ^ ,          R4       V^,          ^,          pV P                  V4       V P                  RRV R2.V^,          4       V P                  RRV R2.V^,          4       V P                  RRV.V^,          4       R	# )
winregtest_winregzwinreg.OpenKeyzwinreg.OpenKey/resultzwinreg.EnumKeyr'   z 0z 10000zwinreg.PyHKEY.DetachN)r   r?   r.   r    rb   
assertTruer\   )r   r   r,   r   expecteds   &    r   rf   AuditTest.test_winregp   s    ##H-%)__]%C"
FIIf1'781'>?!9Q<!  "2CH:R!I6RS9U  "2CH:V9L!MvVWyY  "8#x!H&QR)Tr$   c                   \         P                  ! R 4       V P                  R4      w  rpV'       d   V P                  V4       \        P
                  '       d   \        VRR/  V P                  V^ ,          ^ ,          R4       V P                  V^,          ^ ,          R4       V P                  V^,          ^ ,          R4       V P                  V^,          ^,          R4       R# )	sockettest_socketsep
zsocket.gethostnamezsocket.__new__zsocket.bindz('127.0.0.1', 8080)N)	r   r?   r.   r    r   r(   printrb   assertEndsWithr]   s   &   r   rl   AuditTest.test_socket~   s    ##H-%)__]%C"
FIIf???6$t$1';<1'781}5F1IaL*?@r$   c                    V P                  R 4      w  rpV'       d   V P                  V4       \        P                  '       d   \	        VRR/  T P                  V Uu. uF  qD^ ,          NK  	  up. RO4       R# u upi )test_gcrm   rn   N)zgc.get_objectszgc.get_referrerszgc.get_referentsr.   r    r   r(   ro   rb   r   r   r,   r   events   &    r   rs   AuditTest.test_gc   sd    %)__Y%?"
FIIf???6$t$#)*6%1XX6*F	
*s   A;networkc                   \         P                  ! R 4       V P                  R4      w  rpV'       d   V P                  V4       \        P
                  '       d   \        VRR/  V P                  V^ ,          ^ ,          R4       V P                  V^ ,          ^,          R4       V P                  V^,          ^ ,          R4       V^,          ^,          R8w  d#   V P                  RV^,          ^,          4       R	# R	# )
zhttp.clienttest_http_clientrm   rn   zhttp.client.connectzwww.python.org 80zhttp.client.sendz[cannot send]HTTPN)	r   r?   r.   r    r   r(   ro   rb   assertInr]   s   &   r   	test_httpAuditTest.test_http   s    ##M2%)__5G%H"
FIIf???6$t$1'<=1':;1'9:!9Q<?*MM&&)A,/ +r$   c                   \         P                  ! R 4      pV P                  R4      w  r#pV'       d   V P                  V4       \        P
                  '       d   \        VRR/  V Uu. uF  qU^ ,          NK  	  ppRR.^,          p\        VP                  R4      '       d   VRR.,          pV P                  Wg4       R	# u upi )
sqlite3test_sqlite3rm   rn   zsqlite3.connectzsqlite3.connect/handleenable_load_extensionzsqlite3.enable_load_extensionzsqlite3.load_extensionN)
r   r?   r.   r    r   r(   ro   hasattr
Connectionrb   )r   r   r   r,   r   evactualrh   s   &       r   r   AuditTest.test_sqlite3   s    --i8%)__^%D"
FIIf???6$t$"()&BQ%%&)%'?@1D7%%'>??/( H 	* *s   )Cc                   V P                  R 4      w  rpV'       d   V P                  V4       \        P                  '       d   \	        VRR/  V Uu. uF  qD^ ,          V^,          3NK  	  ppR.pV P                  WV4       R# u upi )test_sys_getframerm   rn   N)zsys._getframer   rt   r   r   r,   r   r   r   rh   s   &      r   r   AuditTest.test_sys_getframe   st    %)__5H%I"
FIIf???6$t$+126Ra5"Q%.62:;* 3   Bc                   V P                  R 4      w  rpV'       d   V P                  V4       \        P                  '       d   \	        VRR/  V Uu. uF  qD^ ,          V^,          3NK  	  ppR.pV P                  WV4       R# u upi )test_sys_getframemodulenamerm   rn   N)zsys._getframemodulename0rt   r   s   &      r   r   %AuditTest.test_sys_getframemodulename   st    %)__5R%S"
FIIf???6$t$+126Ra5"Q%.6245* 3r   c                   V P                  R 4      w  rpV'       d   V P                  V4       \        P                  '       d   \	        VRR/  V Uu. uF  qD^ ,          V^,          3NK  	  pp. ROpV P                  WV4       R# u upi )test_threadingrm   rn   N))z_thread.start_new_threadz(<test_func>, (), None)ztest.test_funcz())z_thread.start_joinable_threadz(<test_func>, 1, None)r   rt   r   s   &      r   r   AuditTest.test_threading   su    %)__5E%F"
FIIf???6$t$+126Ra5"Q%.62
 	* 3s   Bc                @   \         P                  ! R 4       V P                  R4      w  rpV'       d   V P                  V4       \        P
                  '       d   \        VRR/  V Uu. uF  qD^ ,          V^,          3NK  	  ppR.pV P                  WV4       R# u upi )_wmitest_wmi_exec_queryrm   rn   N)z_wmi.exec_queryz#SELECT * FROM Win32_OperatingSystemr   r?   r.   r    r   r(   ro   rb   r   s   &      r   r   AuditTest.test_wmi_exec_query   s    ##F+%)__5J%K"
FIIf???6$t$+126Ra5"Q%.62NO* 3s   )Bc                   \         P                  ! R 4      pV P                  R4      w  r#pV'       d   V P                  V4       \        P
                  '       d   \        R.VO5RR/  V P                  VRRRVP                   23RRVP                   R	23R
RVP                   3RRRVP                   R23RRRVP                   23RRRVP                   RVP                   23RRRVP                   23R.	4       R# )syslogtest_syslogzEvents:rm   z
  zsyslog.openlogr'   z	python 0 zsyslog.syslogz testzsyslog.setlogmaskz test2zaudit-tests.py 0 zaudit-tests.py zNone 0 N)zsyslog.closelog r   )r   r?   r.   r    r   r(   ro   r\   LOG_USERLOG_INFO	LOG_DEBUG
LOG_NDELAY
LOG_LOCAL0)r   r   r   r,   r   s   &    r   r   AuditTest.test_syslog   s   ,,X6%)__]%C"
FIIf???)1f1&1  y0A%BCcfoo%6e#<= #&*:*:);='cfoo%6f#=>s&77H$IJsof6G6G5H&J[J[I\$]^sgfoo->$?@')	
r$   c                d    V P                  R 4      w  rpV'       d   V P                  V4       R# R# )test_not_in_gcNr.   r    r   r   _r   s   &   r   r   AuditTest.test_not_in_gc
  s*     $0@ A
vIIf r$   c                   V P                  R R4      w  rpV'       d   V P                  V4       \        P                  '       d   \	        VRR/  V Uu. uF  qD^ ,          V^,          3NK  	  pp. ROpV P                  WV4       R# u upi )	test_timero   rm   rn   N))
time.sleepr   )r   z0.0625)r   z-1rt   r   s   &      r   r   AuditTest.test_time  sv    %)__['%J"
FIIf???6$t$+126Ra5"Q%.62* 	* 3s   Bc                    V P                  R RRR7      w  rpV P                  V^ 4       V P                  RVP                  4       R,          4       R# )r   r    T)r%   zhook failedN)r.   assertNotEqualr|   r)   r]   s   &   r   test_time_failAuditTest.test_time_fail  sN    %)__[&CG &5 &I"
FJ*mV%6%6%8%<=r$   c                   V P                  R 4      w  rpV'       d   V P                  V4       \        P                  '       d   \	        VRR/  V Uu. uF  qD^ ,          V^,          3NK  	  ppR.pV P                  WV4       R# u upi )%test_sys_monitoring_register_callbackrm   rn   N)z sys.monitoring.register_callbackz(None,)rt   r   s   &      r   r   /AuditTest.test_sys_monitoring_register_callback$  st    %)__5\%]"
FIIf???6$t$+126Ra5"Q%.62CD* 3r   c                T   \         P                  ! R 4      pRpV P                  RV4      w  r4pV'       d   V P                  V4       \        P
                  '       d   \        VRR/  V Uu. uF  qf^ ,          V^,          3NK  	  ppRRV: R23.pV P                  Wx4       R# u upi )	_winapiz+\\.\pipe\LOCAL\test_winapi_createnamed_pipetest_winapi_createnamedpiperm   rn   z_winapi.CreateNamedPipe(z, 3, 8)Nr   )	r   winapi	pipe_namer   r,   r   r   r   rh   s	   &        r   r   %AuditTest.test_winapi_createnamedpipe0  s    ,,Y7B	%)__5RT]%^"
FIIf???6$t$+126Ra5"Q%.62.!I=0HIJ* 3s   ,B%c                d    V P                  R 4      w  rpV'       d   V P                  V4       R# R# )test_assert_unicodeNr   r   s   &   r   r   AuditTest.test_assert_unicode?  s*     $0E F
vIIf r$   c           	     ,   V P                  R 4      w  rpT P                  \        V Uu. uF  pRV9   NK
  	  up4      4       T P                  \        V Uu. uF  pRV9   NK
  	  up4      4       V'       d   V P                  V4       R# R# u upi u upi )test_sys_remote_execzsys.remote_execzcpython.remote_debugger_scriptN)r.   rg   anyr    ru   s   &    r   r   AuditTest.test_sys_remote_execE  s     &*__5K%L"
FVLVE.%7VLMNTZ[TZ5=FTZ[\]IIf  M[s   BB )-__name__
__module____qualname____firstlineno__maxDiffr   requires_subprocessr   r"   r.   r1   r6   r9   r=   rC   rF   rI   rM   rP   rT   rX   r[   ra   rf   rl   rs   requires_resourcer}   r   r   r   r   r   r   r   r   r   r   r   r   support_remote_exec_onlycpython_onlyr   __static_attributes____classdictcell__)__classdict__s   @r   r   r      s    G  "	7 #	7	
e 	
#,:%
$
)4&"2-


UA

 y)0 *0+&
+
++$+
.
+>
++ %%  &r$   r   __main__)__doc__r   r   unittesttestr   test.supportr   r   r   SkipTestfindfiler   TestCaser   r   mainr   r$   r   <module>r      s     
   & " sN##73+@+@


L
MM!!"23z!! zx	 zMMO r$   