Repository navigation
#4023: COBOL paragraph / branch coverage per program (CICS crucible, CardDemo, cobol4j) - #4027
Merged
Merged
Conversation
…ucible, CardDemo and cobol4j
A proven port only proves the paths its scenarios run. tests/tools/cobol_coverage.py
says which ones those are. The COBOL is compiled with cobc -ftraceall and run with
COB_TRACE_FILE. Per program it reports the live paragraphs and sections entered, the
IF / EVALUATE outcomes taken, and the HANDLE labels entered. Dead code (the engine's
reachability: procedure_units / reachable_units) is listed apart from code no scenario
reaches. Branch points come from the original source, and a trace line maps back
through a difflib alignment, so the CICS translator's rewritten lines and its own IFs
are handled. An IF whose arms cannot be told apart by (line, verb) is listed as
unresolvable, not guessed.
- CICS crucible: the cobol-stub side is traced. The report has a COBOL coverage section
with each ported program's claim ("proven on N scenarios, covering X/Y paragraphs and
A/B branches") and the live code no scenario reaches (scenarios to propose).
tests/cics_crucible/coverage.json holds what each passing scenario executes, and --ci
ratchets it. A port proof (--report-dir) carries its claim.
- CardDemo (equivalence.py, batch and CICS): each run writes coverage.json, and the
report gives the claim when proven.
- cobol4j: `cobol_coverage.py autotest` runs at_extract cases under GnuCOBOL with shims
for ${COMPILE} / java.
The trace also shows units the engine's unit reader misses: non-ASCII names, and
paragraphs named END-... (#4026, field-testing D036). They are reported as "unread",
not counted.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01RZE6us7fUL6Hynk59rWLvZ
…rt section Every equivalence run now goes through tests/tools/cobol_coverage.py, so it belongs in trial.py's HARNESS_PATHS with the rest of the frozen harness. The harness report's coverage section no longer repeats a blank line. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01RZE6us7fUL6Hynk59rWLvZ
Contributor
This was referenced Sep 30, 2026
… on both sides of the equivalence harness (#4029) A proof only covered the success path. CardDemo's programs are mostly error handling (file status checks, abends, RESP arms), and the normal run reaches about half their branches. A case's faults now inject the same condition on both sides, at the same statement. Each fault run is proven like the normal run. - GnuCOBOL: tests/equivalence/faults/ggfault.c is preloaded in front of libcob's file I/O (OPEN / CLOSE / READ / WRITE / REWRITE / DELETE / START). A planned statement returns its FILE STATUS and I/O exception instead of running. ggabend.c is CEE3ABD: it records ABEND Unnnn. - Java: the generated batch runtime gains CobolFiles (one call per I/O statement: the status the COBOL would see, plus the same plan and counting) and CobolAbend. CicsTask gains read(file, lookup) and withFaults. The CICS stub's READ reads the same plan. - Porting rules: an abend is CobolAbend.user; every batch I/O statement goes through CobolFiles; a CICS file READ goes through task.read, with every RESP arm ported. - The harness: faults in case.json (batch) or a scenario (CICS), --faults. A run is proven when both sides abend with the same code, or neither does and RETURN-CODE and outputs are equal, and the same faults fired (at least one). - INTCALC: 19 faults, the port rewritten onto CobolFiles. All 20 runs are proven, and COBOL coverage goes from 46/86 to 82/86 branches and 20/22 to 22/22 paragraphs. The 4 outcomes left are data gaps or unreachable. ACCTVIEW: 6 fault scenarios, the port's WHEN OTHER arms ported, all 11 scenarios proven, and 39/71 -> 47/71 branches. Claude-Session: https://claude.ai/code/session_01RZE6us7fUL6Hynk59rWLvZ Co-authored-by: Claude Opus 5.5 <[email protected]>
… implicit concatenation) CodeQL's py/implicit-string-concatenation-in-list flagged four report paragraphs split over several source lines inside a list (alerts 1205-1208). Each is now one parenthesised string, as #3762 did for the porting rules. The generated text is unchanged: the crucible report regenerated from the same results is byte-identical. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01RZE6us7fUL6Hynk59rWLvZ
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #4023. Part of #3989.
A proven port only proves the paths its scenarios run. This PR adds a tool that measures which paths those are, and uses it in the three places that run COBOL: the CICS crucible, the CardDemo equivalence cases, and the opensourcecobol4j (cobol4j) estate.
The tool:
tests/tools/cobol_coverage.pycobc -ftracealland run withCOB_SET_TRACE/COB_TRACE_FILE. GnuCOBOL then writes every paragraph and section entered, and every statement executed, with its line.procedure_units/reachable_units), so "nothing can reach it" and "no scenario reaches it" are never the same line.dead_but_executed). So is a unit the engine does not read at all (unread).Where it runs
docs/language_status/cics_crucible.mdgets a COBOL coverage section. Each ported program carries its claim, e.g. PCCONF: "proven on 3 scenarios, covering 4/5 paragraphs and 6/14 branches". The section also lists the live code no scenario reaches, as scenarios to propose.tests/cics_crucible/coverage.jsonholds, per passing scenario, what it executed.--cifails when that is lost or gained until--update-baselinerecords it.--report-dir) carries the claim.equivalence.py, batch and CICS): each run writescobol/coverage.json. The report gives the claim when the run is proven, and "not proven; …" otherwise. For example, INTCALC is "proven on 1 run, covering 20/22 paragraphs and 46/86 branches", and ACCTVIEW is "proven on 5 scenarios, covering 30/32 paragraphs and 39/71 branches".cobol_coverage.py autotest <at_extract cases>runs each case under GnuCOBOL.${COMPILE}/${COBJ}build traced modules, andjava PROGruns them withcobcrun. On cobol_utf8 + jp-compat (250 cases): 116 ran, 16 skipped, 79 don't compile under GnuCOBOL (oc4j-only dialect), and 39 are compile-only.Engine defect found
The trace shows paragraphs and sections that
cobol_graveyard_finderdoes not read: Japanese / full-width names, and a paragraph namedEND-IPROC1. Filed as #4026 and logged as field-testing D036. They are reported asunreadand left out of the counts. No pinned mainframe corpus has either shape.Verification
cics_crucible.py --update-baselinethen--cion JDK 17: 94 pass / 37 fail / 0 unsupported, the same cells as main.baseline.jsonis unchanged, and the coverage ledger reproduces run to run.EQUIVALENCE_E2E=1(the fixture through every side, now with coverage and a port claim). The newtest_cobol_coverage.pyneeds no Docker, and I ran it through plainpytestfrom another directory.audit_check.py: all clear.field_testing.py check: valid.Notes
tests/tools/cobol_coverage.pyjoins trial.py'sHARNESS_PATHS(the frozen harness), since every equivalence run now goes through it.coverage.json(docs/ecosystem.mdis updated).🤖 Generated with Claude Code
https://claude.ai/code/session_01RZE6us7fUL6Hynk59rWLvZ