MCPcopy Create free account
hub / github.com/DeusData/codebase-memory-mcp / main

Function main

tests/test_coverage_parent_failure.py:174–230  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

172
173
174def main():
175 parser = argparse.ArgumentParser(description=__doc__)
176 parser.add_argument("--runner", required=True)
177 parser.add_argument("--llvm-profdata", required=True)
178 parser.add_argument("--reducer", required=True)
179 parser.add_argument("--output-dir", required=True)
180 args = parser.parse_args()
181 if os.name != "posix":
182 print("INFRASTRUCTURE: native fixture requires the frozen POSIX boundary", file=sys.stderr)
183 return 2
184 try:
185 inputs = {"runner": common.identity(args.runner, True),
186 "profdata": common.identity(args.llvm_profdata, True),
187 "reducer": common.identity(args.reducer), "driver": common.identity(__file__),
188 "shared_driver": common.identity(common.__file__)}
189 expected_helper = Path(__file__).resolve().with_name("test_coverage_children.py")
190 if Path(inputs["shared_driver"]["path"]) != expected_helper:
191 raise common.Infrastructure("shared process helper is not the checked-in sibling")
192 root = Path(args.output_dir).resolve()
193 if any(char in str(root) for char in ("%", "\n", "\r")):
194 raise common.Infrastructure("output path contains LLVM pattern tokens/newlines")
195 root.mkdir(mode=0o700)
196 except (OSError, common.Infrastructure) as exc:
197 print("INFRASTRUCTURE: " + str(exc), file=sys.stderr)
198 return 2
199 receipt = {"schema": 1, "fixed_oracle": True, "runner_invocations": 2,
200 "inputs": inputs, "cases": [], "overall": "infrastructure_error",
201 "deadline_seconds": common.DEADLINE, "grace_seconds_per_phase": common.GRACE,
202 "log_bytes_per_stream": common.LOG_CAP, "stdin": "DEVNULL",
203 "capture_limit": "external streams only; reducer internal capture unchanged"}
204 try:
205 for mode in ("control", "emfile"):
206 case = run_case(root, mode, inputs)
207 receipt["cases"].append(case)
208 if not case["controls_passed"]:
209 break
210 for name, value in inputs.items():
211 if common.identity(value["path"], name in ("runner", "profdata")) != value:
212 raise common.Infrastructure("proof input changed: " + name)
213 if len(receipt["cases"]) == 2 and all(case["controls_passed"] for case in receipt["cases"]):
214 failed = False
215 for case in receipt["cases"]:
216 case["classification"] = "regression_failure" if case["feature_problems"] else "pass"
217 failed = failed or bool(case["feature_problems"])
218 print(case["mode"] + ": " + case["classification"])
219 receipt["overall"] = "regression_failure" if failed else "pass"
220 except (common.Infrastructure, OSError, ValueError, KeyboardInterrupt) as exc:
221 receipt["error"] = type(exc).__name__ + ": " + str(exc)
222 finally:
223 receipt["processes"] = common.PROCESS_RECORDS
224 receipt["all_owned_groups_quiescent"] = all(record["quiescent"] for record in common.PROCESS_RECORDS
225 if "pid" in record)
226 commands = {(inputs["runner"]["path"], SUITE), (inputs["runner"]["path"], OPTION, SUITE)}
227 receipt["runner_invocations_actual"] = sum(tuple(record["argv"]) in commands
228 for record in common.PROCESS_RECORDS)
229 common.save(root / "result.json", receipt)
230 return {"pass": 0, "regression_failure": 1, "infrastructure_error": 2}[receipt["overall"]]
231

Callers 1

Calls 6

strFunction · 0.85
sumFunction · 0.85
saveMethod · 0.80
run_caseFunction · 0.70
allFunction · 0.50
typeFunction · 0.50

Tested by

no test coverage detected