Q"iFSrSSKrSSKrSSKrSSKrSSKrSSKrSSKrSSK r SSK r Sr Sr Sr SrSrS SjrS rS r\S :Xa\"5 gg) a Command line tool to bisect failing CPython tests. Find the test_os test method which alters the environment: ./python -m test.bisect_cmd --fail-env-changed test_os Find a reference leak in "test_os", write the list of failing tests into the "bisect" file: ./python -m test.bisect_cmd -o bisect -R 3:3 test_os Load an existing list of tests from a file using -i option: ./python -m test --list-cases -m FileTests test_os > tests ./python -m test.bisect_cmd -i tests test_os Nc[US5nUH n[X2S9 M UR5 SSS5 g!,(df  g=f)Nw)file)openprintflush)filenametestsfpnames 6/opt/alt/python313/lib64/python3.13/test/bisect_cmd.py write_testsrs5 h D $      s #9 AcdU(dg[S[U5<SU<35 [X5 U$)NzWriting z tests into )rlenr)r r s r write_outputr&s&  E H => Oc$SRU5$)N )join)argss r format_shell_argsr.s 88D>rc[R/nUR[R"55 UR[R "55 URS5 U$)N)z-X faulthandler)sys executableextend subprocess_args_from_interpreter_flags"_optim_args_from_interpreter_flags)cmds r python_cmdr!2sJ >> CJJz6689JJz<<>?JJ%& Jrc[5nUR/SQ5 URUR5 [R"U[R SS9nUR nU(a4[U5n[SU<SU<35 [R"U5 URR5nU$)N)-mtestz --list-casesT)stdoutuniversal_newlineszFailed to list tests: z failed with exit code ) r!r test_argsrrunPIPE returncoderrrexitr% splitlines)rr procexitcoder s r list_casesr/:s ,CJJ-.JJt~~ >>#!+-1 3DH$ h  !  KK " " $E Lrc[R"5n[X15 [5nUR SSSSU/5 UR UR 5 [ S[U5-5 [RR5 [RR5 [R"U5nUR[R R#U5(a[R$"U5 $$![R R#U5(a[R$"U5 ff=f)Nz-ur#r$z --matchfilez+ %s)tempfilemktemprr!rr'rrrr%rstderrrr(r*ospathexistsunlink)rr huntrleakstmpr r-s r run_testsr:Ks // CCl D$ s;< 4>>" f(--.  ~~c" 77>>#   IIcN 277>>#   IIcN s B:D =E c[R"5nURSSSS9 URSSSS9 URSS [S S S 9 URS S[SSS 9 UR 5upX!lU$)Nz-iz--inputzUTest names produced by --list-tests written into a file. If not set, run --list-tests)helpz-oz--outputzResult of the bisectionz-nz --max-testsz:Maximum number of tests to stop the bisection (default: 1))typedefaultr<z-Nz --max-iterdz5Maximum number of bisection iterations (default: 100))argparseArgumentParser add_argumentintparse_known_argsr')parserrr's r parse_argsrG_s  $ $ &F iIJ j68 m#q,- lc./ --/ODN Krc J[5nSH-nXR;dM[SUS35 [5 M/ UR(a>[ UR5nUVs/sHo3R 5PM nnSSS5 O [ U5n[S[W5-5 [S[UR5-5 [SUR<SUR<S35 [URU5n[5 [R"5nS n[U5UR:Ga XpR::Ga[U5n[US -S 5n[ R""XH5n [S US URS [U 5S[U535 [5 [%X 5n [SU<S[U5<35 [SU 5 U (a$[S5 U n[URU5nO [S5 [5 US - n[U5UR:aXpR::aGM[S[U5-5 UHn [SU -5 M [5 U(a[SU-5 [(R*"[R"5U- 5n [U5UR::a&[SU<S[,R."U S9<35 g[SU<S[,R."U S9<35 [0R2"S 5 gs snf!,(df  GN=f![&a# [5 [S5 [5 GN7f=f)N)z-wz--rerunz --verbose2z WARNING: z% option should not be used to bisect!zStart bisection with %s testszTest arguments: %sz!Bisection will stop when getting z1 or less tests (-n/--max-tests option), or after z" iterations (-N/--max-iter option)r=z[+] Iteration /z: run z tests/zran r+z*Tests failed: continuing with this subtestz;Tests succeeded: skipping this subtest, trying a new subsetzBisection interrupted!z Tests (%s):z* %szOutput written into %szBisection completed in z iterations and )secondszBisection failed after )rGr'rinputrstripr/rr max_testsmax_iterroutputtime monotonicmaxrandomsampler:KeyboardInterruptmathceildatetime timedeltarr+) roptr liner rP start_time iterationntestsubtestsr.r$dts r mainrbss >!B BC ^^T]] ,-$++u -F G!JI%j4>>)i==.HJE A&E}}U2H N9+Qt}}o>Xws5zl< = G 0H uc%j9 : &( #BC %dkk59ST G NI)%j4>>)i==.H4 -#e* $% ftm G  &/0 4>>#j0 1B 5zT^^# H..r:< = H..r:< =  s2 L   &' s1$M#)MM#0D7M5M## M25)N"!N"__main__)N)__doc__rArYos.pathr4rWrTrrr1rQrrrr!r/r:rGrb__name__rr rhse$   "((BJ zFr