feat: Phase 3+4 - gcov support + enhanced report

This commit is contained in:
hangshuo652
2026-06-18 16:31:54 +08:00
parent e2486db510
commit c93104e6bf
3 changed files with 131 additions and 10 deletions
+5 -3
View File
@@ -4,11 +4,13 @@ from runners.runner import BuildResult, RunResult
class CobolRunner:
def compile(self, src: str, dialect="ibm") -> BuildResult:
def compile(self, src: str, dialect="ibm", gcov: bool = False) -> BuildResult:
stem = Path(src).stem
out = str(Path(src).parent / stem)
p = subprocess.run(["cobc", "-x", f"-std={dialect}-strict", "-o", out, src],
capture_output=True, text=True, timeout=30)
cmd = ["cobc", "-x", f"-std={dialect}-strict", "-o", out, src]
if gcov:
cmd = ["cobc", "-x", f"-std={dialect}-strict", "-fprofile-arcs", "-ftest-coverage", "-o", out, src]
p = subprocess.run(cmd, capture_output=True, text=True, timeout=30)
return BuildResult(success=p.returncode == 0, artifact_path=out, log=p.stdout + p.stderr)
def run(self, binary: str, input_path: str, output_path: str) -> RunResult: