B /g^y@svddlZddlZddlZddlZddlZddlZddlmZy ddlZWne k r`dZYnXddZ ddZ dS)N)supportc Cs&ytj}Wnttfk r*d}Yn^Xtjd|dg}ttdrT| tj ttdrj| tj x|D]}tj |d|dqpWt ttj|jrtjdtj|jxbtjD]T}t|drx(t|jD]\}}tj||j|<qWt|ddrtj|j|_qW|jr,d tj_|j dk rDt!|j |j"dk r\t#$|j"y ddl%}Wnt&k r~YnX|'|j(|j)B|j*B|j+By |j,Wntk rYn\XxX|j-|j.|j/gD]D}|j0r|j0d kr|,||j1|2||j3n |,|dqW|j4t_4dS) NT)Z all_threadsfileSIGALRMSIGUSR1)chainrr__path____file__F)5sys __stderr__fileno ValueErrorAttributeError faulthandlerZenablehasattrsignalappendrrregisterreplace_stdoutrZrecord_original_stdoutstdoutZtestdirpathinsertosabspathmodulesvalues enumeratergetattrrZ huntrleaksunittestZ BaseTestSuiteZ_cleanupZmemlimitZ set_memlimitZ thresholdgcZ set_thresholdmsvcrt ImportErrorZ SetErrorModeZSEM_FAILCRITICALERRORSZSEM_NOALIGNMENTFAULTEXCEPTZSEM_NOGPFAULTERRORBOXZSEM_NOOPENFILEERRORBOXZCrtSetReportModeZCRT_WARNZ CRT_ERRORZ CRT_ASSERTverboseZCRTDBG_MODE_FILEZCrtSetReportFileZCRTDBG_FILE_STDERRZ use_resources) nsZ stderr_fdZsignalsZsignummoduleindexrr mr'./usr/lib64/python3.7/test/libregrtest/setup.py setup_testssZ                 r)csZtjy }Wntk r&dSXt|djddddt_fdd}t|dS)NwbackslashreplaceF )encodingerrorsclosefdnewlinecstjt_dS)N)r rcloser')rr'r(restore_stdoutss z&replace_stdout..restore_stdout)r rr r openr-atexitr)fdr2r')rr(r_s   r) r4rrrr rZtestrrr!r)rr'r'r'r(s   Q