+
    üÐj(  ã                   ó2  € R t ^ RIt^ RIt^ RIt^ RIt^ RIHtHtHtHt ^ RI	H
t
HtHtHtH	t	 ^ RIHt  ^ RI	HtHt Rt^ RIHt ^ R	IHt ^ R
IHtHt ^ RIHt ^ RIHt ^ RIH t  ^ RI!H"t" ^ RI#H$t$ ]"PJ                  ! 4       '       d
   ^ RI	H&t& Rt'MRt' ^ RI(H)t)H*t*H+t+H,t, Rt-Rt. ! R R4      t/R t0 ! R R]14      t2 ! R R]4      t3R t4]! ]-].4       ! R R]$4      4       t5]! ]-].4       ! R R]$4      4       t6R#   ] d    Rt LÆi ; i  ] d    Rt-Rt. Lri ; i) z&
Tests for L{twisted.python.sendmsg}.
N)ÚcloseÚpathsepÚpipeÚread)ÚAF_INETÚAF_INET6Ú
SOL_SOCKETÚerrorÚsocket)Úpack)ÚAF_UNIXÚ
socketpairFT)ÚskipIf)Úreactor)ÚDeferredÚinlineCallbacks)ÚProcessDone)ÚProcessProtocol)ÚFilePath)Úplatform)ÚTestCase)ÚMSG_DONTWAIT)Ú
SCM_RIGHTSÚgetSocketFamilyÚrecvmsgÚsendmsgÚ z!Platform doesn't support sendmsg.c                   óH   a € ] tR t^5t o RtR tR tR tR tR t	R t
RtV tR	# )
Ú	_FDHolderzH
A wrapper around a FD that will remember if it has been closed or not.
c                ó   € Wn         R # ©N©Ú_fd)ÚselfÚfds   &&ÚB/usr/lib/python3/dist-packages/twisted/python/test/test_sendmsg.pyÚ__init__Ú_FDHolder.__init__:   s   € ØŽó    c                ó   € V P                   # )z
Return the fileno of this FD.
r!   ©r#   s   &r%   ÚfilenoÚ_FDHolder.fileno=   s   € ð �x‰xˆr(   c                óf   € V P                   '       d   \        V P                   4       RV n         R# R# )z8
Close the FD. If it's already been closed, do nothing.
N)r"   r   r*   s   &r%   r   Ú_FDHolder.closeC   s$   € ð �8�8ˆ8Ü�$—(‘(ŒOØˆDŽHñ r(   c                ó    € V P                   '       d<   \        P                  ! RV P                    R2\        4       V P	                  4        R# R# )z.
If C{self._fd} is unclosed, raise a warning.
zFD z was not closed!N)r"   ÚwarningsÚwarnÚResourceWarningr   r*   s   &r%   Ú__del__Ú_FDHolder.__del__K   s7   € ð �8�8ˆ8Ü�MŠM˜C §¡˜zÐ)9Ð:¼OÔLØ�J‰JŽLñ r(   c                ó   € V # r    © r*   s   &r%   Ú	__enter__Ú_FDHolder.__enter__S   s   € Øˆr(   c                ó&   € V P                  4        R # r    )r   )r#   Úexc_typeÚ	exc_valueÚ	tracebacks   &&&&r%   Ú__exit__Ú_FDHolder.__exit__V   s   € Ø�
‰
Žr(   r!   N)Ú__name__Ú
__module__Ú__qualname__Ú__firstlineno__Ú__doc__r&   r+   r   r3   r7   r=   Ú__static_attributes__Ú__classdictcell__©Ú__classdict__s   @r%   r   r   5   s-   ø‡ € ñòòòòò÷ð r(   r   c                 óF   € \        4       w  r\        V 4      \        V4      3# )zA
Create a pipe, and return the two FDs wrapped in L{_FDHolders}.
)r   r   )ÚrÚws     r%   Ú	_makePiperK   Z   s    € ô ‹6�D€AÜ�a‹Lœ) A›,Ð'Ð'r(   c                   ó6   a € ] tR t^bt o RtV 3R lR ltRtV tR# )ÚExitedWithStderrz$
A process exited with some stderr.
c                ó    <€ V ^8„  d   QhRS[ /# )é   Úreturn)Ústr)ÚformatrG   s   "€r%   Ú__annotate__ÚExitedWithStderr.__annotate__g   s   ø€ ÷ ñ ™ñ r(   c                óp   € RP                  R.\        V P                  4      ,           4      p\        V4      # )zI
Dump the errors in a pretty way in the event of a subprocess traceback.
ó   
r(   )ÚjoinÚlistÚargsÚrepr©r#   Úresults   & r%   Ú__str__ÚExitedWithStderr.__str__g   s+   € ð —‘˜S˜E¤D¨¯©£OÕ3Ó4ˆÜ�F‹|Ðr(   r6   N)r?   r@   rA   rB   rC   r]   rD   rE   rF   s   @r%   rM   rM   b   s   ø‡ € ñ÷ö r(   rM   c                   óB   a € ] tR t^ot o RtR tR tR tR tR t	Rt
V tR# )	ÚStartStopProcessProtocolaÔ  
An L{IProcessProtocol} with a Deferred for events where the subprocess
starts and stops.

@ivar started: A L{Deferred} which fires with this protocol's
    L{IProcessTransport} provider when it is connected to one.

@ivar stopped: A L{Deferred} which fires with the process output or a
    failure if the process produces output on standard error.

@ivar output: A C{str} used to accumulate standard output.

@ivar errors: A C{str} used to accumulate standard error.
c                ó^   € \        4       V n        \        4       V n        R V n        R V n        R# )r(   N)r   ÚstartedÚstoppedÚoutputÚerrorsr*   s   &r%   r&   Ú!StartStopProcessProtocol.__init__   s"   € Ü“zˆŒÜ“zˆŒØˆŒØˆŽr(   c                óP   € V P                   P                  V P                  4       R # r    )rb   ÚcallbackÚ	transportr*   s   &r%   ÚconnectionMadeÚ'StartStopProcessProtocol.connectionMade…   s   € Ø�‰×Ñ˜dŸn™nÖ-r(   c                ó8   € V ;P                   V,          un         R # r    )rd   ©r#   Údatas   &&r%   ÚoutReceivedÚ$StartStopProcessProtocol.outReceivedˆ   ó   € Ø�Š�tÕ�r(   c                ó8   € V ;P                   V,          un         R # r    )re   rm   s   &&r%   ÚerrReceivedÚ$StartStopProcessProtocol.errReceived‹   rq   r(   c                óü   € VP                  \        4      '       d(   V P                  P                  V P                  4       R # V P                  P                  \        V P                  V P                  4      4       R # r    )Úcheckr   rc   rh   rd   ÚerrbackrM   re   )r#   Úreasons   &&r%   ÚprocessEndedÚ%StartStopProcessProtocol.processEndedŽ   sI   € Ø�<‰<œ×$Ò$Ø�L‰L×!Ñ! $§+¡+Ö.à�L‰L× Ñ Ô!1°$·+±+¸t¿{¹{Ó!KÖLr(   )re   rd   rb   rc   N)r?   r@   rA   rB   rC   r&   rj   ro   rs   ry   rD   rE   rF   s   @r%   r`   r`   o   s*   ø‡ € ñòò.òò÷Mð Mr(   r`   c                ó   € \        \        P                  4      P                  4       P                  p\        \        P                  4      p\        \        P                  ! \        P                  4      4      P                  4       P                  VR&   \        4       p\        P                  ! VVV\        \        4      P                  V R,           4      P                  4       P                  R.V^ R^R^R^V/R7       V# )zÙ
Start a script that is a peer of this test as a subprocess.

@param script: the module name of the script in this directory (no
    package prefix, no '.py')
@type script: C{str}

@rtype: L{StartStopProcessProtocol}
Ú
PYTHONPATHz.pys   17rJ   rI   )ÚenvÚchildFDs)r   ÚsysÚ
executableÚ
asTextModeÚpathÚdictÚosÚenvironr   rW   r`   r   ÚspawnProcessÚ__file__Úsibling)ÚscriptÚoutputFDÚpyExer}   Ússpps   &&   r%   Ú_spawnr�   •   sÇ   € ô ”S—^‘^Ó$×/Ñ/Ó1×6Ñ6€EÜ
Œr�z‰zÓ
€CÜ ¤§¢¬c¯h©hÓ!7Ó8×CÑCÓE×JÑJ€CˆÑÜ#Ó%€DÜ×ÒØØàÜ”XÓ×&Ñ& v°¥~Ó6×AÑAÓC×HÑHØð	
ð
 Ø�S˜!˜S ! S¨"¨hÐ7õ
ð €Kr(   c                   ó|   a € ] tR t^±t o RtR tR tR tR tR t	R t
R t]! ]R	4      R
 4       t]R 4       tRtV tR# )ÚSendmsgTestsz:
Tests for the Python2/3 compatible L{sendmsg} interface.
c                ó>   € \        \        4      w  V n        V n        R# )z 
Create a pair of UNIX sockets.
N)r   r   Úinputrd   r*   s   &r%   ÚsetUpÚSendmsgTests.setUp·   s   € ô #-¬WÓ"5ÑˆŒ
�D–Kr(   c                ón   € V P                   P                  4        V P                  P                  4        R# )z$
Close the sockets opened by setUp.
N)r‘   r   rd   r*   s   &r%   ÚtearDownÚSendmsgTests.tearDown½   s$   € ð 	�
‰
×ÑÔØ�‰×ÑÖr(   c                óè   € V P                   P                  4        V P                  \        \        V P                   R4      pV P                  VP                  ^ ,          \        P                  4       R# )z
If the underlying C{sendmsg} call fails, L{send1msg} raises
L{socket.error} with its errno set to the underlying errno value.
ó   hello, worldN©	r‘   r   ÚassertRaisesr	   r   ÚassertEqualrY   ÚerrnoÚEBADF©r#   Úexcs   & r%   Útest_syscallErrorÚSendmsgTests.test_syscallErrorÄ   sJ   € ð
 	�
‰
×ÑÔØ×Ñ¤¤w°·
±
¸OÓLˆØ×Ñ˜Ÿ™ !�¤e§k¡kÖ2r(   c                óî   € V P                   P                  4        V P                  \        \        V P                   RR.^ 4      pV P                  VP                  ^ ,          \        P                  4       R# )zx
The behavior when the underlying C{sendmsg} call fails is the same
whether L{sendmsg} is passed ancillary data or not.
r˜   N)é    r£   s   0123r™   rž   s   & r%   Ú#test_syscallErrorWithControlMessageÚ0SendmsgTests.test_syscallErrorWithControlMessageÍ   sV   € ð
 	�
‰
×ÑÔØ×ÑÜ”7˜DŸJ™J¨¸/Ð9JÈAó
ˆð 	×Ñ˜Ÿ™ !�¤e§k¡kÖ2r(   c                ó:  € RpV P                  \        V4      \        V P                  V4      4       \	        V P
                  4      pV P                  VP                  R4       V P                  VP                  ^ 4       V P                  VP                  . 4       R# )z9
L{recvmsg} will retrieve a message sent via L{sendmsg}.
ó   hello, world!N)	r›   Úlenr   r‘   r   rd   rn   ÚflagsÚ	ancillary)r#   Úmessager\   s   &  r%   Útest_roundtripÚSendmsgTests.test_roundtripØ   su   € ð #ˆØ×Ñœ˜W›¤w¨t¯z©z¸7Ó'CÔDä˜Ÿ™Ó%ˆØ×Ñ˜Ÿ™Ð&6Ô7Ø×Ñ˜Ÿ™ qÔ)Ø×Ñ˜×)Ñ)¨2Ö.r(   c                óD  € RR,          ^,          pV P                   P                  R4       \        V P                   V4      pV P                  V\	        V4      8  4       \        V P                  \	        V4      4      pV P                  \	        V^ ,          4      V4       R# )zC
L{sendmsg} returns the number of bytes which it was able to send.
é   FNó   xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx)r‘   Úsetblockingr   Ú
assertTruer¨   r   rd   r›   )r#   r«   ÚsentÚreceiveds   &   r%   Útest_shortsendÚSendmsgTests.test_shortsendä   sy   € ð  Õ$ rÕ)ˆØ�
‰
×Ñ˜uÔ%Ü�t—z‘z 7Ó+ˆð
 	�‰˜œs 7›|Ñ+Ô,Ü˜4Ÿ;™;¬¨G«Ó5ˆØ×Ñœ˜X a�[Ó)¨4Ö0r(   c                óŠ   € \        V P                  R. ^ 4       \        V P                  4      pV P	                  VR. ^ 34       R# )z�
L{sendmsg} treats an empty ancillary data list the same way it treats
receiving no argument for the ancillary parameter at all.
r§   N)r   r‘   r   rd   r›   r[   s   & r%   Útest_roundtripEmptyAncillaryÚ)SendmsgTests.test_roundtripEmptyAncillaryó   s=   € ô
 	�—
‘
Ð,¨b°!Ô4ä˜Ÿ™Ó%ˆØ×Ñ˜Ð"2°B¸Ð!:Ö;r(   z7MSG_DONTWAIT is only known to work as intended on Linuxc                ó  € \        R4       F   p \        V P                  R\        R7       K"  	  V P                  R4       R#   \         d>   pT P                  TP                  ^ ,          \        P                  4        Rp? R# Rp?ii ; i)z�
The C{flags} argument to L{sendmsg} is passed on to the underlying
C{sendmsg} call, to affect it in whatever way is defined by those
flags.
)r©   NzHFailed to fill up the send buffer, or maybe send1msg blocked for a whilei    r°   )
Úranger   r‘   r   ÚOSErrorr›   rY   rœ   ÚEAGAINÚfail)r#   ÚiÚes   &  r%   Ú
test_flagsÚSendmsgTests.test_flagsý   sk   € ô �x–ˆAðÜ˜Ÿ
™
 K´|×Dñ !ð �I‰Ið8öøô	 ô Ø× Ñ  §¡¨¥¬E¯L©LÔ9Þûðús   �AÁBÁ1BÂBc              #  ó|  "  € \        RV P                  P                  4       4      pVP                  x € \	        4       w  r#V P                  VP                  4       V P                  VP                  4       V;_uu_ 4        \        V P                  R\        \        \        RVP                  4       4      3.4       RRR4       VP                  x € V P                  \        VP                  4       R4      R4       V P                  \        VP                  4       R4      R4       R#   + '       g   i     Lt; i5i)zÎ
Calling L{sendmsg} with SOL_SOCKET, SCM_RIGHTS, and a platform-endian
packed file descriptor number should send that file descriptor to a
different process, where it can be retrieved by using L{recv1msg}.
Úpullpipes   blonkr¿   Nr¯   s   Test fixture data: blonk.
r(   )r�   rd   r+   rb   rK   Ú
addCleanupr   r   r‘   r   r   r   rc   r›   r   )r#   rŒ   ÚpipeOutÚpipeIns   &   r%   Útest_sendSubProcessFDÚ"SendmsgTests.test_sendSubProcessFD  sÙ   é € ô �j $§+¡+×"4Ñ"4Ó"6Ó7ˆØ�l‰lÒÜ#›+‰ˆØ�‰˜Ÿ™Ô&Ø�‰˜Ÿ™Ô%çŠVÜØ—
‘
ØÜœj¬$¨s°F·M±M³OÓ*DÐEÐFô÷ ð �l‰lÒØ×Ñœ˜gŸn™nÓ.°Ó5Ð7UÔVà×Ñœ˜gŸn™nÓ.°Ó5°sÖ;÷ �Vüs   ‚A?D<Â<D)Â=A,D<Ä)D9	Ä4D<)r‘   rd   N)r?   r@   rA   rB   rC   r’   r•   r    r¤   r¬   rµ   r¸   r   ÚdontWaitSkiprÁ   r   rÈ   rD   rE   rF   s   @r%   r�   r�   ±   s^   ø‡ € ñò6òò3ò	3ò
/ò1ò<ñ ˆLÐSÓTñó Uðð* ñ<ó ö<r(   r�   c                   óT   a € ] tR tRt o RtR tR tR t]! ]	R4      R 4       t
RtV tR	# )
ÚGetSocketFamilyTestsi-  z
Tests for L{getSocketFamily}.
c                óR   € \        V4      pV P                  VP                  4       V# )z£
Create a new socket using the given address family and return that
socket's file descriptor.  The socket will automatically be closed when
the test is torn down.
)r
   rÅ   r   )r#   ÚaddressFamilyÚss   && r%   Ú_socketÚGetSocketFamilyTests._socket3  s#   € ô �=Ó!ˆØ�‰˜Ÿ™Ô Øˆr(   c                ój   € V P                  \        \        V P                  \        4      4      4       R# )z€
When passed the file descriptor of a socket created with the C{AF_INET}
address family, L{getSocketFamily} returns C{AF_INET}.
N)r›   r   r   rÐ   r*   s   &r%   Ú	test_inetÚGetSocketFamilyTests.test_inet=  s"   € ð
 	×Ñœ¤/°$·,±,¼wÓ2GÓ"HÖIr(   c                ój   € V P                  \        \        V P                  \        4      4      4       R# )z‚
When passed the file descriptor of a socket created with the
C{AF_INET6} address family, L{getSocketFamily} returns C{AF_INET6}.
N)r›   r   r   rÐ   r*   s   &r%   Ú
test_inet6ÚGetSocketFamilyTests.test_inet6D  s"   € ð
 	×Ñœ¤?°4·<±<ÄÓ3IÓ#JÖKr(   z)Platform does not support AF_UNIX socketsc                ój   € V P                  \        \        V P                  \        4      4      4       R# )z€
When passed the file descriptor of a socket created with the C{AF_UNIX}
address family, L{getSocketFamily} returns C{AF_UNIX}.
N)r›   r   r   rÐ   r*   s   &r%   Ú	test_unixÚGetSocketFamilyTests.test_unixK  s"   € ð 	×Ñœ¤/°$·,±,¼wÓ2GÓ"HÖIr(   r6   N)r?   r@   rA   rB   rC   rÐ   rÓ   rÖ   r   ÚnonUNIXSkiprÙ   rD   rE   rF   s   @r%   rÌ   rÌ   -  s:   ø‡ € ñòòJòLñ ˆKÐDÓEñJó FöJr(   rÌ   )7rC   rœ   r„   r   r0   r   r   r   r   r
   r   r   r   r	   Ústructr   r   r   rÛ   ÚImportErrorÚunittestr   Útwisted.internetr   Útwisted.internet.deferr   r   Útwisted.internet.errorr   Útwisted.internet.protocolr   Útwisted.python.filepathr   Útwisted.python.runtimer   Útwisted.trial.unittestr   ÚisLinuxr   rÊ   Útwisted.python.sendmsgr   r   r   r   ÚdoImportSkipÚimportSkipReasonr   rK   Ú	ExceptionrM   r`   r�   r�   rÌ   r6   r(   r%   Ú<module>rë      s3  ðñó Û 	Û 
Û ß )Ó )ß ?Õ ?Ý ðß*ð €Kå å $ß <Ý .Ý 5Ý ,Ý +Ý +à×Ò×ÒÝ#à�Lð €LðßTÓTð
 €LØÐ÷"ñ "òJ(ô
�yô 
ô#M˜ô #MòLñ8 ˆÐ&Ó'ôx<�8ó x<ó (ðx<ñv ˆÐ&Ó'ô#J˜8ó #Jó (ò#Jøðy ô Ø‚Kðûð6 ô ;Ø€LØ:Òð;ús#   ´C9 ÂD Ã9	DÄDÄDÄD