Skip to content

Fresh estates: extract GNU Autotest (.at) COBOL test programs and their expected output (#3806) - #3960

Merged
squid-protocol merged 1 commit into
mainfrom
feat/at-extract
Sep 28, 2026
Merged

squid-protocol merged 1 commit into
mainfrom
feat/at-extract

Conversation

@squid-protocol

Copy link
Copy Markdown
Owner

Part of #3806 (epic #3803): the first fresh estate is opensourcecobol4j, a Japanese COBOL-to-Java translator (GPL-3.0). Its GNU Autotest suites hold hundreds of small COBOL programs, each with the expected output its maintainers pinned and CI checks. This PR adds only the extractor. The extracted estate stays outside the repo because of the licence.

tests/tools/at_extract.py

python tests/tools/at_extract.py --suite i18n_sjis --at tests/i18n_sjis.at -I tests/i18n_sjis.src \
    --encoding shift_jis --out /data/fresh-estates/oc4j --source-repo URL --commit SHA

It writes one directory per test case:

  • the AT_DATA files, raw bytes;
  • expected.json: the ordered steps (each AT_DATA file; each AT_CHECK command with its expected exit status, stdout and stderr, where ignore / expout ... are modes; AT_SKIP_IF / AT_XFAIL_IF), the keywords, the encoding;
  • suite.json with the provenance.

The .at is read the way m4 and autom4te read it, byte by byte, so a Shift-JIS suite is never decoded in order to parse it:

  • quotes are stripped once at argument collection and once more at the AT_DATA / AT_CHECK rescan ([[x]] becomes [x], as autom4te writes it);
  • unquoted # comments and dnl are handled; m4_include is followed through -I;
  • autom4te drops every line's trailing blanks before it replaces the quadrigraphs, so @&t@ keeps them. This was found on the estate: cobol_utf8 relies on it.

The encoding is verified, not assumed. Each case's files and expected strings must decode strictly in the declared encoding through gitgalaxy.core.source_text. A case that fails is reported as encoding_error, and nothing is replaced.

Verified against autom4te itself

On opensourcecobol4j develop a4cb106, I extracted i18n_sjis (110 cases), i18n_utf8 (127), cobol_utf8 (127) and jp-compat (123). Every AT_DATA file byte, every command, status and exact stdout / stderr matches the testsuite script GNU Autoconf 2.71's autom4te --language=autotest generates from the same sources: 487 cases, 0 discrepancies. The cross-check script lives beside the estate and is not in this PR.

Tests

tests/tools/test_at_extract.py runs on a synthetic suite. It covers m4_include, dnl and # comments, nested quotes, quadrigraphs, @&t@ and trailing blanks, two programs in one case, the same file written twice (v2/), a negative compile with expected stderr, ignore modes, and Shift-JIS bytes whose trail byte is \ (kept raw and verified). A wrong declared encoding is reported, not replaced.

python tests/tools/pr_gates.py --fast: 5/5 pass.

Not in this PR (by design)

🤖 Generated with Claude Code

https://claude.ai/code/session_01TmgE1CwLgaqxqKEgQn5Dw5

…ted output

tests/tools/at_extract.py turns an Autotest suite into one directory per test case:
the AT_DATA files as raw bytes, and expected.json with the ordered AT_DATA / AT_CHECK
steps (command, expected exit status, stdout, stderr), AT_SKIP_IF / AT_XFAIL_IF and
keywords. The .at is read the way m4 and autom4te read it: byte by byte, so Shift-JIS is
never decoded to parse it. That means quote stripping at collection and at the rescan,
comments, dnl, m4_include, trailing blanks dropped before the quadrigraphs. Each case's
encoding is verified strictly through source_text; a case that fails is reported, and
nothing is replaced.

On opensourcecobol4j (i18n_sjis, i18n_utf8, cobol_utf8, jp-compat: 487 cases), every
file, command and expected output matches the testsuite that Autoconf 2.71's autom4te
generates from the same sources.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01TmgE1CwLgaqxqKEgQn5Dw5
@github-actions

Copy link
Copy Markdown
Contributor

🐦‍⬛ Muninn Security Scan

✅ No security issues found.

🐦‍⬛ Powered by Muninn · Skald Lab

@squid-protocol
squid-protocol merged commit 092f537 into main Sep 28, 2026
29 checks passed
@squid-protocol
squid-protocol deleted the feat/at-extract branch September 28, 2026 10:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant