Test official ACM journals and proceedings

This commit is contained in:
gloamxun committed 2026-11-19 18:25:37 +08:00
1 parent ab50ca7dad
commit 3faac740bd
3 files changed
+86 -4

No files matched your search

+49 -3
View File
@@ -26,6 +26,9 @@ CASES = [
("acl", "conference", "acl", "acl-style-files-master/acl_latex.tex"),
("cvpr-2026", "conference", "cvpr-2026", "author-kit-CVPR2026-v1-latex-/main.tex"),
("neurips-2025", "conference", "neurips-2025", "Styles/neurips_2025.tex"),
("acm-acmsmall", "journal-single-column", "acmart", "acmart/samples/acmsmall.tex"),
("acm-acmtog", "journal-two-columns", "acmart", "acmart/samples/acmtog.tex"),
("acm-sigconf", "conference", "acmart", "acmart/samples/sigconf.tex"),
]
EPS_FIGURES = {
"springer-nature": ["fig.eps"],
@@ -66,6 +69,41 @@ def run(command, cwd, env, label, evidence):
return {"command": list(map(str, command)), "exit_code": status, "label": label}
def prepare_acmart(directory, evidence):
"""Extract the published class and samples with the package's DocStrip installers."""
upstream = directory / "acmart"
samples = upstream / "samples"
workspace = evidence / "docstrip"
sample_workspace = workspace / "samples"
sample_workspace.mkdir(parents=True)
env = {**os.environ, "TEXINPUTS": os.pathsep, "SOURCE_DATE_EPOCH": "1783900800"}
latex = ["pdflatex", "-interaction=nonstopmode", "-halt-on-error", "-no-shell-escape", "-recorder"]
commands = []
for original, work, installer, sources in (
(upstream, workspace, "acmart.ins", ["acmart.dtx"]),
(samples, sample_workspace, "samples.ins", ["samples.dtx", "acmengage.dtx"]),
):
for name in [installer, *sources]:
shutil.copyfile(original / name, work / name)
result = run([*latex, installer], work, env, installer, evidence)
if result["exit_code"]:
raise RuntimeError(f"ACM sample extraction failed: {evidence / installer}")
commands.append(result)
generated = {}
for source, destination in [
(workspace / "acmart.cls", samples / "acmart.cls"),
*[(sample_workspace / name, samples / name)
for name in ("acmsmall.tex", "acmtog.tex", "sigconf.tex")],
*[(upstream / name, samples / name)
for name in ("ACM-Reference-Format.bst", "acm-jdslogo.png")],
]:
if destination.exists():
raise ValueError(f"ACM installer output already exists: {destination}")
shutil.copyfile(source, destination)
generated[destination.relative_to(directory).as_posix()] = sha(destination)
return {"commands": commands, "sample_inputs": generated}
def diagnostics(evidence, label):
lines = []
for stream in ("stderr", "stdout"):
@@ -215,7 +253,12 @@ def main():
args = parser.parse_args()
if args.font_map and args.font_map.name != "pdftex.map":
parser.error("--font-map must name a pdftex.map file")
config = json.loads((ROOT / "scripts/publisher-template-matrix.json").read_text())
selected = [item for item in CASES if not args.case or item[0] in args.case]
archives = {item[2] for item in selected if item[2]}
registry = json.loads((ROOT / "scripts/publisher-template-matrix.json").read_text())
config = {name: registry[name] for name in registry if name in archives}
if config.keys() != archives:
raise ValueError(f"publisher archives missing from registry: {archives - config.keys()}")
sources = args.output / "inputs"
sources.mkdir(parents=True)
for archive, (digest, url) in config.items():
@@ -223,6 +266,10 @@ def main():
if sha(path) != digest:
raise ValueError(f"archive bytes differ from the pinned SHA-256: {path}")
unpack(path, sources / archive)
archive_preparation = {}
if "acmart" in config:
archive_preparation["acmart"] = prepare_acmart(
sources / "acmart", args.output / "preparation/acmart")
if args.texmf_overlay and not args.texmf_overlay.is_dir():
raise ValueError(f"missing overlay: {args.texmf_overlay}")
additions = inputs(args.texmf_overlay) if args.texmf_overlay else {}
@@ -247,7 +294,6 @@ def main():
print(name, row["reference"]["pdf_built"], row["native"]["pdf_built"], flush=True)
return row
selected = [item for item in CASES if not args.case or item[0] in args.case]
with ThreadPoolExecutor(max_workers=2) as pool:
results = list(pool.map(case, selected))
report = {"schema": 1, "scope": "compile and collect evidence; PDF creation alone is not fidelity",
@@ -255,7 +301,7 @@ def main():
"native_format_sha256": sha(args.native_format),
"reference_format_sha256": sha(args.reference_format), "texmf_overlay": additions,
"font_map_sha256": font_map_sha256,
"templates": results}
"archive_preparation": archive_preparation, "templates": results}
assert not args.texmf_overlay or inputs(args.texmf_overlay) == additions
assert not args.font_map or sha(args.font_map) == font_map_sha256
(args.output / "report.json").write_text(json.dumps(report, indent=2) + "\n")
+4
View File
@@ -30,5 +30,9 @@
"neurips-2025": [
"72032130232955b785cd622b7c52d893e3166f30a90e1e6279d0a28e8373beef",
"https://media.neurips.cc/Conferences/NeurIPS2025/Styles.zip"
],
"acmart": [
"81977a834f5cfd5302c37181ede34d2663eeea60604d1d89230e3c5e74b9a4bb",
"https://mirrors.bfsu.edu.cn/CTAN/macros/latex/contrib/acmart.zip"
]
}