%PDF- %PDF-
Mini Shell

Mini Shell

Direktori : /usr/local/lib/python2.7/test/
Upload File :
Create Path :
Current File : //usr/local/lib/python2.7/test/test_signal.pyc

ó
Nêáac@shddlZddlmZddlmZddlZddlZddlZddlZddl	Z	ddl
Z
ddlZddlZddl
Z
ddlZejdkrÌejdejƒ‚ndefd„ƒYZd	„Zd
„Zejejdkdƒd
ejfd„ƒYƒZejejdkdƒdejfd„ƒYƒZejejdkdƒdejfd„ƒYƒZdejfd„ƒYZejejdkdƒdejfd„ƒYƒZejejdkdƒdejfd„ƒYƒZejejdkdƒdejfd„ƒYƒZd„Ze dkrdeƒndS(iÿÿÿÿN(ttest_support(tclosingtos2triscossCan't test signal on %stHandlerBCalledcBseZRS((t__name__t
__module__(((s,/usr/local/lib/python2.7/test/test_signal.pyRscCstjdƒdS(sñUse os._exit(0) to exit the current subprocess.

    Otherwise, the test catches the SystemExit and continues executing
    in parallel with the original test, so you wind up with an
    exponential number of tests running concurrently.
    iN(tost_exit(((s,/usr/local/lib/python2.7/test/test_signal.pytexit_subprocessscOsDy|||ŽSWn,tk
r?}|jtjkr;‚ndSXdS(N(tEnvironmentErrorterrnotEINTRtNone(t__functargstkwargste((s,/usr/local/lib/python2.7/test/test_signal.pytignoring_eintrstwin32sNot valid on WindowstInterProcessSignalTestscBsteZdZd„Zd„Zdd„Zd„Zd„Zd„Z	d„Z
eje
jdkd	ƒd
„ƒZRS(icCstjƒ|_tjƒdS(N(tgct	isenabledtusing_gctdisable(tself((s,/usr/local/lib/python2.7/test/test_signal.pytsetUp+scCs|jrtjƒndS(N(RRtenable(R((s,/usr/local/lib/python2.7/test/test_signal.pyttearDown/s	cCsdjtj|d|ƒƒS(Nttlimit(tjoint	tracebacktformat_stack(RtframeR((s,/usr/local/lib/python2.7/test/test_signal.pytformat_frame3scCs7t|_tjr3d||j|ddƒfGHndS(Ns&handlerA invoked from signal %s at:
%sRi(tTrueta_calledRtverboseR#(RtsignumR"((s,/usr/local/lib/python2.7/test/test_signal.pythandlerA6s		cCsOt|_tjr3d||j|ddƒfGHnt||j|ƒƒ‚dS(Ns&handlerB invoked from signal %s at:
%sRi(R$tb_calledRR&R#R(RR'R"((s,/usr/local/lib/python2.7/test/test_signal.pythandlerB<s
		cCsQxJtrLy|jƒdSWqtk
rH}|jtjkrI‚qIqXqWdS(s)Wait for child to finish, ignoring EINTR.N(R$twaittOSErrorRR(RtchildR((s,/usr/local/lib/python2.7/test/test_signal.pyR+Cs	
cCs\tjtj|jƒtjtj|jƒtjtjtjƒtjtjtjƒt	|_
t	|_tj
ƒ}tjr‹dG|GHnttjddt|ƒgƒ}|rÛ|j|ƒ|j
sÛtjdƒqÛn|j|j
ƒ|j|jƒt	|_
~yItjddt|ƒgƒ}|j|ƒtjdƒ|jdƒWnBtk
r”|j|jƒ|j|j
ƒtjr•dGHq•nXttjddt|ƒgƒ}|rÌ|j|ƒnz{y(tjdƒtjƒtjdƒWn?tk
rtjrFd	GHqFn+|jd
tjƒƒnX|jdƒWdtjdƒXdS(
Nstest runner's pid istkills-HUPis-USR1s#HandlerBCalled exception not raisedsHandlerBCalled exception caughts-USR2s(KeyboardInterrupt (the alarm() went off)s+Some other exception woke us from pause: %ssTpause returned of its own accord, and the signal didn't arrive after another second.i( tsignaltSIGHUPR(tSIGUSR1R*tSIGUSR2tSIG_IGNtSIGALRMtdefault_int_handlertFalseR%R)RtgetpidRR&Rt
subprocesstPopentstrR+ttimetsleept
assertTruetassertFalsetfailRtalarmtpausetKeyboardInterruptR t
format_exc(RtpidR-((s,/usr/local/lib/python2.7/test/test_signal.pytrun_testMsX			!
		


	!


		tfreebsd6sOinter process signals not reliable (do not mix well with threading) on freebsd6c
Cs“tjƒ\}}ttj|ƒƒf}ttj|dƒƒE}tjƒ}|dkrçz|y_|jƒt|ƒCy|jƒWntjt	j
ƒ|ƒnXtjd|ƒWdQXWndGHt	jƒnXWdt
ƒXn|jƒtj|ggg|jƒ\}}}||krLtj|ƒ}	|	rs|j|	ƒqsn'tj|tjƒ|jd|jƒtj|dƒWdQXWdQXdS(NtwisUh oh, raised from pickle.s!Test deadlocked after %d seconds.(RtpipeRtfdopentforktcloseREtpickletdumpR RCR
t	print_excR	tselecttMAX_DURATIONtloadR?R.R/tSIGKILLtwaitpid(
Rt	os_done_rt	os_done_wtdone_rtdone_wR-trRGtxttb((s,/usr/local/lib/python2.7/test/test_signal.pyt	test_main‘s8	


'	N(RRRPRRR
R#R(R*R+REtunittesttskipIftsystplatformR[(((s,/usr/local/lib/python2.7/test/test_signal.pyR's					
	DtBasicSignalTestscBs,eZd„Zd„Zd„Zd„ZRS(cGsdS(N((RR((s,/usr/local/lib/python2.7/test/test_signal.pyttrivial_signal_handlerÄscCs6|jttjdƒ|jttjd|jƒdS(Ni’(tassertRaisest
ValueErrorR/t	getsignalRa(R((s,/usr/local/lib/python2.7/test/test_signal.pyt,test_out_of_range_signal_number_raises_errorÇscCs |jttjtjdƒdS(N(Rbt	TypeErrorR/R1R
(R((s,/usr/local/lib/python2.7/test/test_signal.pyt0test_setting_signal_handler_to_none_raises_errorÍscCsjtjtj|jƒ}|jtjtjƒ|jƒtjtj|ƒ|jtjtjƒ|ƒdS(N(R/R0RatassertEqualRd(Rthup((s,/usr/local/lib/python2.7/test/test_signal.pyttest_getsignalÑs

(RRRaReRgRj(((s,/usr/local/lib/python2.7/test/test_signal.pyR`Âs			sWindows specifictWindowsSignalTestscBseZd„ZRS(cCs°d„}xTtjtjtjtjtjtjtjfD]"}tj|tj||ƒƒq:W|jt	ƒtjd|ƒWdQX|jt	ƒtjd|ƒWdQXdS(NcSsdS(N(R
(RYty((s,/usr/local/lib/python2.7/test/test_signal.pyt<lambda>ÝRiÿÿÿÿi(
R/tSIGABRTtSIGBREAKtSIGFPEtSIGILLtSIGINTtSIGSEGVtSIGTERMRbRc(Rthandlertsig((s,/usr/local/lib/python2.7/test/test_signal.pyttest_issue9324Ûs	 (RRRw(((s,/usr/local/lib/python2.7/test/test_signal.pyRkÙst
WakeupFDTestscBseZd„ZRS(cCs&tjƒ}|jttj|ƒdS(N(Rtmake_bad_fdRbRcR/t
set_wakeup_fd(Rtfd((s,/usr/local/lib/python2.7/test/test_signal.pyttest_invalid_fdís(RRR|(((s,/usr/local/lib/python2.7/test/test_signal.pyRxëstWakeupSignalTestscBs8eZdZdZd„Zd„Zd„Zd„ZRS(i
icCs¹ddl}tjdƒz,tjƒ}tj|jƒtjƒ}WdtjdƒX|j|||jkƒ|j|jggg|jƒtjƒ}|j|||jkƒdS(Niÿÿÿÿii(	ROR/R@R;R<tTIMEOUT_FULLR=tTIMEOUT_HALFtread(RROtbefore_timetmid_timet
after_time((s,/usr/local/lib/python2.7/test/test_signal.pyttest_wakeup_fd_early÷s
cCsddl}tjdƒzGtjƒ}|j|j|j|jggg|jƒtjƒ}WdtjdƒX|j|||j	kƒdS(Niÿÿÿÿii(
ROR/R@R;RbterrorR€R~R=R(RRORRƒ((s,/usr/local/lib/python2.7/test/test_signal.pyttest_wakeup_fd_during	s
cCs™ddl}tjtjd„ƒ|_tjƒ\|_|_|j|j|jdƒ}|tj	B}|j|j|j
|ƒtj|jƒ|_dS(NiÿÿÿÿcSsdS(N(R
(RYRl((s,/usr/local/lib/python2.7/test/test_signal.pyRmRi(
tfcntlR/R4talrmRRHR€twritetF_GETFLt
O_NONBLOCKtF_SETFLRzt
old_wakeup(RR‡tflags((s,/usr/local/lib/python2.7/test/test_signal.pyRs
cCsJtj|jƒtj|jƒtj|jƒtjtj|jƒdS(N(	R/RzRRRKR€R‰R4Rˆ(R((s,/usr/local/lib/python2.7/test/test_signal.pyR"s(RRR~RR„R†RR(((s,/usr/local/lib/python2.7/test/test_signal.pyR}òs			
tSiginterruptTestcBs5eZd„Zd„Zd„Zd„Zd„ZRS(cCsAtj|_tj|jd„ƒ}|jtj|j|ƒdS(s½Install a no-op signal handler that can be set to allow
        interrupts or not, and arrange for the original signal handler to be
        re-installed when the test is finished.
        cSsdS(N(R
(RYRl((s,/usr/local/lib/python2.7/test/test_signal.pyRm1RN(R/R1R't
addCleanup(Rt
oldhandler((s,/usr/local/lib/python2.7/test/test_signal.pyR+scCsøtjƒ\}}|jtj|ƒtjƒ}tjƒ}|dkrˆz1tjdƒtj||j	ƒtjdƒWdt
ƒXnl|jtj|dƒtj|ƒytj|dƒ}t
SWn,tk
ró}|jtjkrï‚ntSXdS(s¿Perform a read during which a signal will arrive.  Return True if the
        read is interrupted by the signal and raises an exception.  Return False
        if it returns normally.
        igš™™™™™É?Ni(RRHRRKR7RJR;R<R.R'R	RSR€R6R,RRR$(RRXRGtppidRDtdterr((s,/usr/local/lib/python2.7/test/test_signal.pytreadpipe_interrupted4s&

cCs6|jƒ}|j|ƒ|jƒ}|j|ƒdS(s¦If a signal handler is installed and siginterrupt is not called
        at all, when that signal arrives, it interrupts a syscall that's in
        progress.
        N(R•R=(Rti((s,/usr/local/lib/python2.7/test/test_signal.pyttest_without_siginterruptjs
cCsItj|jdƒ|jƒ}|j|ƒ|jƒ}|j|ƒdS(sÅIf a signal handler is installed and siginterrupt is called with
        a true value for the second argument, when that signal arrives, it
        interrupts a syscall that's in progress.
        iN(R/tsiginterruptR'R•R=(RR–((s,/usr/local/lib/python2.7/test/test_signal.pyttest_siginterrupt_onus

cCsItj|jdƒ|jƒ}|j|ƒ|jƒ}|j|ƒdS(sÎIf a signal handler is installed and siginterrupt is called with
        a false value for the second argument, when that signal arrives, it
        does not interrupt a syscall that's in progress.
        iN(R/R˜R'R•R>(RR–((s,/usr/local/lib/python2.7/test/test_signal.pyttest_siginterrupt_offs

(RRRR•R—R™Rš(((s,/usr/local/lib/python2.7/test/test_signal.pyR(s
			6		t
ItimerTestcBs˜eZd„Zd„Zd„Zd„Zd„Zd„Zd„Ze	j
ejdkd	ƒd
„ƒZ
e	j
ejdkdƒd„ƒZd
„ZRS(cCs:t|_d|_d|_tjtj|jƒ|_dS(Ni(	R6thndl_calledt
hndl_countR
titimerR/R4tsig_alrmt	old_alarm(R((s,/usr/local/lib/python2.7/test/test_signal.pyRs			cCs?tjtj|jƒ|jdk	r;tj|jdƒndS(Ni(R/R4R RžR
t	setitimer(R((s,/usr/local/lib/python2.7/test/test_signal.pyR–scGs$t|_tjr d|fGHndS(NsSIGALRM handler invoked(R$RœRR&(RR((s,/usr/local/lib/python2.7/test/test_signal.pyRŸœs		cGsŠt|_|jdkr*tjdƒ‚n6|jdkr`tjtjdƒtjr`dGHq`n|jd7_tjr†d|fGHndS(Nis.setitimer didn't disable ITIMER_VIRTUAL timer.islast SIGVTALRM handler callisSIGVTALRM handler invoked(	R$RœRR/tItimerErrorR¡tITIMER_VIRTUALRR&(RR((s,/usr/local/lib/python2.7/test/test_signal.pyt
sig_vtalrm¡s			cGs7t|_tjtjdƒtjr3d|fGHndS(NisSIGPROF handler invoked(R$RœR/R¡tITIMER_PROFRR&(RR((s,/usr/local/lib/python2.7/test/test_signal.pytsig_prof³s		cCs |jtjtjddƒdS(Niÿÿÿÿi(RbR/R¢R¡(R((s,/usr/local/lib/python2.7/test/test_signal.pyttest_itimer_excºscCsQtj|_tj|jdƒtjr0dGHntjƒ|j|jt	ƒdS(Ngð?s
call pause()...(
R/tITIMER_REALRžR¡RR&RARhRœR$(R((s,/usr/local/lib/python2.7/test/test_signal.pyttest_itimer_realÃs	
RFtnetbsd5sDitimer not reliable (does not mix well with threading) on some BSDs.cCsÏtj|_tjtj|jƒtj|jddƒtjƒ}xUtjƒ|dkrŽtdddƒ}tj|jƒd	krGPqGqGW|j	dƒ|j
tj|jƒd
ƒ|j
|jtƒdS(Ng333333Ó?gš™™™™™É?gN@i90i2	i“–˜gs8timeout: likely cause: machine too slow or load too high(gg(gg(
R/R£Ržt	SIGVTALRMR¤R¡R;tpowt	getitimertskipTestRhRœR$(Rt
start_timet_((s,/usr/local/lib/python2.7/test/test_signal.pyttest_itimer_virtualÍs
sBitimer not reliable (does not mix well with threading) on freebsd6cCsÏtj|_tjtj|jƒtj|jddƒtjƒ}xUtjƒ|dkrŽtdddƒ}tj|jƒdkrGPqGqGW|j	dƒ|j
tj|jƒd	ƒ|j
|jtƒdS(
Ngš™™™™™É?gN@i90i2	i“–˜gs8timeout: likely cause: machine too slow or load too high(gg(gg(
R/R¥RžtSIGPROFR¦R¡R;R¬R­R®RhRœR$(RR¯R°((s,/usr/local/lib/python2.7/test/test_signal.pyttest_itimer_profäs
cCsCtj|_tj|jdƒtjdƒ|j|jtƒdS(Ngíµ ÷ư>i(	R/R¨RžR¡R;R<RhRœR$(R((s,/usr/local/lib/python2.7/test/test_signal.pyttest_setitimer_tinyús
(RFRª(RRRRRŸR¤R¦R§R©R\R]R^R_R±R³R´(((s,/usr/local/lib/python2.7/test/test_signal.pyR›Žs								
cCs#tjtttttttƒdS(N(	Rtrun_unittestR`RRxR}RR›Rk(((s,/usr/local/lib/python2.7/test/test_signal.pyR[st__main__(RR(!R\ttestRt
contextlibRRRLROR/R8R R^RR;RR_tSkipTestt	ExceptionRR	RR]tTestCaseRR`t
skipUnlessRkRxR}RR›R[R(((s,/usr/local/lib/python2.7/test/test_signal.pyt<module>s<0	
		š5eu	

Zerion Mini Shell 1.0