Uname: Linux web3.us.cloudlogin.co 5.10.226-xeon-hst #2 SMP Fri Sep 13 12:28:44 UTC 2024 x86_64
Software: Apache
PHP version: 8.1.31 [ PHP INFO ] PHP os: Linux
Server Ip: 162.210.96.117
Your Ip: 3.133.157.86
User: edustar (269686) | Group: tty (888)
Safe Mode: OFF
Disable Function:
NONE

name : test_file_eintr.pyo
�
?��cc@s�ddlZddlZddlZddlZddlZddlmZddlZddlZddl	m
Z
ejejdkd�dej
fd��Y�Zdefd	��YZd
efd��YZd�Zed
kr�e�ndS(i����N(trun_unittest(tFileIOtposixstests requires a posix system.tTestFileIOSignalInterruptcBs_eZd�Zd�Zd�Zdded�Zd�ZdZd�Z	d�Z
d	�ZRS(
cCs
d|_dS(N(tNonet_process(tself((s;/usr/local/python-2.7/lib/python2.7/test/test_file_eintr.pytsetUpscCsJ|jrF|jj�dkrFy|jj�WqFtk
rBqFXndS(N(RtpollRtkilltOSError(R((s;/usr/local/python-2.7/lib/python2.7/test/test_file_eintr.pyttearDown s

cCsdS(s�Returns the infile = ... line of code for the reader process.

        subclasseses should override this to test different IO objects.
        s9import _io ;infile = _io.FileIO(sys.stdin.fileno(), "rb")((R((s;/usr/local/python-2.7/lib/python2.7/test/test_file_eintr.pyt_generate_infile_setup_code'stcCs�|jj�dkrJtjd�y|jj�WqJtk
rFqJXn|r||jj�\}}||7}||7}n|jd||j	�|j	�f�dS(s;A common way to cleanup and fail with useful debug output.

        Kills the process if it is still running, collects remaining output
        and fails the test with an error message including the output.

        Args:
            why: Text to go after "Error from IO process" in the message.
            stdout, stderr: standard output and error from the process so
                far to include in the error message.
            communicate: bool, when True we call communicate() on the process
                after killing it to gather additional output.
        g�������?s/Error from IO process %s:
STDOUT:
%sSTDERR:
%s
N(
RRRttimetsleept	terminateR
tcommunicatetfailtdecode(RtwhytstdouttstderrRt
stdout_endt
stderr_end((s;/usr/local/python-2.7/lib/python2.7/test/test_file_eintr.pytfail_with_process_info/s



	cCs�|j�}tjtjddd|dd|ddgdtjdtjd	tj�|_|jjjt	d
��}|d
kr�|j
dd	|�n|jjj|�d}g}xz|s8t
j
|jjgddd
�\}}}|jjtj�|d7}|dkr�|jj�|jd�q�q�W|jjj�}|dkrm|j
dd	|�n|jjdd�\}	}
|jjr�|j
d|jj|	|
dt�ndS(snGeneric buffered read method test harness to validate EINTR behavior.

        Also validates that Python signal handlers are run during the read.

        Args:
            data_to_write: String to write to the child process for reading
                before sending it a signal, confirming the signal was handled,
                writing a final newline and closing the infile pipe.
            read_and_verify_code: Single "line" of code to read from a file
                object named 'infile' and validate the result.  This will be
                executed as part of a python subprocess fed data_to_write.
        s-us-cs\import io, signal, sys ;signal.signal(signal.SIGINT, lambda s, f: sys.stderr.write("$\n")) ;s ;s"sys.stderr.write("Worm Sign!\n") ;sinfile.close()tstdinRRsWorm Sign!
swhile awaiting a signig�������?ii�s,reader process failed to handle our signals.s$
swhile awaiting signaltinputs
sexited rc=%dRN(((Rt
subprocesstPopentsyst
executabletPIPERRtreadtlenRRtwritetselecttsend_signaltsignaltSIGINTR	RtreadlineRt
returncodetFalse(Rt
data_to_writetread_and_verify_codetinfile_setup_codet	worm_signtsignals_senttrlistt_tsignal_lineRR((s;/usr/local/python-2.7/lib/python2.7/test/test_file_eintr.pyt
_test_readingJs<


	*



s�got = infile.{read_method_name}() ;expected = {expected!r} ;assert got == expected, ("{read_method_name} returned wrong data.\n""got data %r\nexpected %r" % (got, expected))c	Cs/|jddd|jjdddd��dS(	s1readline() must handle signals and not lose data.R+s
hello, world!R,tread_method_nameR(texpectedshello, world!
N(R3t_READING_CODE_TEMPLATEtformat(R((s;/usr/local/python-2.7/lib/python2.7/test/test_file_eintr.pyt
test_readline�s
	c
Cs5|jddd|jjdddddg��d	S(
s2readlines() must handle signals and not lose data.R+shello
world!R,R4t	readlinesR5shello
sworld!
N(R3R6R7(R((s;/usr/local/python-2.7/lib/python2.7/test/test_file_eintr.pyttest_readlines�s
	c	CsZ|jddd|jjdddd��|jddd|jjdddd��d	S(
s0readall() must handle signals and not lose data.R+shello
world!R,R4treadallR5s
hello
world!
R!N(R3R6R7(R((s;/usr/local/python-2.7/lib/python2.7/test/test_file_eintr.pyttest_readall�s	
	(t__name__t
__module__RRRtTrueRR3R6R8R:R<(((s;/usr/local/python-2.7/lib/python2.7/test/test_file_eintr.pyRs				I		tTestBufferedIOSignalInterruptcBseZd�Zd�ZRS(cCsdS(s?Returns the infile = ... line of code to make a BufferedReader.seinfile = io.open(sys.stdin.fileno(), "rb") ;import _io ;assert isinstance(infile, _io.BufferedReader)((R((s;/usr/local/python-2.7/lib/python2.7/test/test_file_eintr.pyR�sc	Cs/|jddd|jjdddd��dS(	s<BufferedReader.read() must handle signals and not lose data.R+shello
world!R,R4R!R5s
hello
world!
N(R3R6R7(R((s;/usr/local/python-2.7/lib/python2.7/test/test_file_eintr.pyR<�s
	(R=R>RR<(((s;/usr/local/python-2.7/lib/python2.7/test/test_file_eintr.pyR@�s	tTestTextIOSignalInterruptcBs,eZd�Zd�Zd�Zd�ZRS(cCsdS(s>Returns the infile = ... line of code to make a TextIOWrapper.srinfile = io.open(sys.stdin.fileno(), "rt", newline=None) ;import _io ;assert isinstance(infile, _io.TextIOWrapper)((R((s;/usr/local/python-2.7/lib/python2.7/test/test_file_eintr.pyR�sc	Cs/|jddd|jjdddd��dS(	s1readline() must handle signals and not lose data.R+s
hello, world!R,R4R(R5shello, world!
N(R3R6R7(R((s;/usr/local/python-2.7/lib/python2.7/test/test_file_eintr.pyR8�s
	c
Cs5|jddd|jjdddddg��d	S(
s2readlines() must handle signals and not lose data.R+s
hello
world!R,R4R9R5shello
sworld!
N(R3R6R7(R((s;/usr/local/python-2.7/lib/python2.7/test/test_file_eintr.pyR:�s
	c	Cs/|jddd|jjdddd��dS(	s-read() must handle signals and not lose data.R+shello
world!R,R4R!R5s
hello
world!
N(R3R6R7(R((s;/usr/local/python-2.7/lib/python2.7/test/test_file_eintr.pyR<�s
	(R=R>RR8R:R<(((s;/usr/local/python-2.7/lib/python2.7/test/test_file_eintr.pyRA�s			cCsQgt�j�D]-}t|t�rt|tj�r|^q}t|�dS(N(tglobalstvaluest
isinstancettypet
issubclasstunittesttTestCaseR(ttct
test_cases((s;/usr/local/python-2.7/lib/python2.7/test/test_file_eintr.pyt	test_main�s-t__main__(tosR$R&RRttest.test_supportRRRGt_ioRt
skipUnlesstnameRHRR@RARKR=(((s;/usr/local/python-2.7/lib/python2.7/test/test_file_eintr.pyt<module>s�	
© 2025 GrazzMean