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.149.235.138
User: edustar (269686) | Group: tty (888)
Safe Mode: OFF
Disable Function:
NONE

name : test_file_eintr.pyc
�
?��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�}t|�dks*td��tjtjddd|dd|ddgd	tjd
tjdtj�|_|jj	j
td��}|dkr�|jd
d|�n|jjj
|�d}g}xz|sVtj|jj	gddd�\}}}|jjtj�|d7}|dkr�|jj�|jd�q�q�W|jj	j�}|dkr�|jdd|�n|jjdd�\}	}
|jjr�|jd|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.
        is#data_to_write must fit in pipe buf.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tlentAssertionErrort
subprocesstPopentsyst
executabletPIPERRtreadRRtwritetselecttsend_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(R4t_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-R5t	readlinesR6shello
sworld!
N(R4R7R8(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-R5treadallR6s
hello
world!
R#N(R4R7R8(R((s;/usr/local/python-2.7/lib/python2.7/test/test_file_eintr.pyttest_readall�s	
	(t__name__t
__module__RRRtTrueRR4R7R9R;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-R5R#R6s
hello
world!
N(R4R7R8(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.pyRA�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-R5R)R6shello, world!
N(R4R7R8(R((s;/usr/local/python-2.7/lib/python2.7/test/test_file_eintr.pyR9�s
	c
Cs5|jddd|jjdddddg��d	S(
s2readlines() must handle signals and not lose data.R,s
hello
world!R-R5R:R6shello
sworld!
N(R4R7R8(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-R5R#R6s
hello
world!
N(R4R7R8(R((s;/usr/local/python-2.7/lib/python2.7/test/test_file_eintr.pyR=�s
	(R>R?RR9R;R=(((s;/usr/local/python-2.7/lib/python2.7/test/test_file_eintr.pyRB�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'RR ttest.test_supportRRRHt_ioRt
skipUnlesstnameRIRRARBRLR>(((s;/usr/local/python-2.7/lib/python2.7/test/test_file_eintr.pyt<module>s�	
© 2025 GrazzMean