| 23 | |
| 24 | |
| 25 | def output_controls(stdout, code): |
| 26 | clean = common.ANSI.sub("", stdout) |
| 27 | rows = re.findall(r"(?m)^ ([A-Za-z_][A-Za-z0-9_]*)[ \t]+(PASS|FAIL|SKIP)\b", clean) |
| 28 | starts = re.findall(r"(?m)^ (coverage_[A-Za-z0-9_]+)\b", clean) |
| 29 | summaries = re.findall(r"(?m)^[ \t]*(\d+) passed(?:, (\d+) failed)?(?:, (\d+) skipped)?" |
| 30 | r"(?:, (\d+) deselected)?[ \t]*$", clean) |
| 31 | if rows != [(name, "PASS") for name in TESTS] or starts != TESTS or len(summaries) != 1: |
| 32 | raise common.Infrastructure("native fixture and later sentinel must both PASS exactly once") |
| 33 | counts = [int(value or 0) for value in summaries[0]] |
| 34 | if code not in (0, 1) or counts[:3] != [2, code, 0]: |
| 35 | raise common.Infrastructure("unrelated native failure or unexpected report-once summary") |
| 36 | return counts |
| 37 | |
| 38 | |
| 39 | def event_controls(stderr, mode, owner_pid): |