结论:补齐 WASM header、blocked-header、metadata 的 source map 文档闭环,并把 manifest/source-map 同步检查接入 native 必跑路径;未扩展 smoke 功能。
81 lines
2.6 KiB
Bash
Executable File
81 lines
2.6 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
set -euo pipefail
|
|
|
|
cd "$(dirname "$0")"
|
|
|
|
# LinuxCNC source basis: this guard keeps the local source map aligned with the
|
|
# LinuxCNC-root relative rs274 manifests that drive native and WASM source-link
|
|
# probes. It validates documentation/manifest drift only; it does not interpret
|
|
# CNC behavior.
|
|
python3 - <<'PY'
|
|
from pathlib import Path
|
|
|
|
source_map = Path("docs/linuxcnc-rs274-source-map.md").read_text(encoding="utf-8")
|
|
native_manifest = Path("linuxcnc-rs274-source-files.txt").read_text(encoding="utf-8").splitlines()
|
|
wasm_manifest = Path("linuxcnc-rs274-wasm-source-files.txt").read_text(encoding="utf-8").splitlines()
|
|
|
|
expected = {
|
|
"### Interpreter core": [
|
|
Path(line.split(":", 2)[1]).name
|
|
for line in native_manifest
|
|
if line.startswith("core:")
|
|
],
|
|
"### Python binding modules": [
|
|
Path(line.split(":", 2)[1]).name
|
|
for line in native_manifest
|
|
if line.startswith("binding:")
|
|
],
|
|
"### WASM-safe source core": [
|
|
line.split(":", 2)[1]
|
|
for line in wasm_manifest
|
|
if line.startswith("core:")
|
|
],
|
|
"### WASM-blocked sources": [
|
|
line.split(":", 2)[1]
|
|
for line in wasm_manifest
|
|
if line.startswith("blocked:")
|
|
],
|
|
"### WASM-tracked headers": [
|
|
line.split(":", 2)[1]
|
|
for line in wasm_manifest
|
|
if line.startswith("header:")
|
|
],
|
|
"### WASM-blocked headers": [
|
|
line.split(":", 2)[1]
|
|
for line in wasm_manifest
|
|
if line.startswith("blocked-header:")
|
|
],
|
|
"### WASM metadata sources": [
|
|
line.split(":", 2)[1]
|
|
for line in wasm_manifest
|
|
if line.startswith("metadata:")
|
|
],
|
|
}
|
|
|
|
actual = {section: [] for section in expected}
|
|
active_section = None
|
|
for line in source_map.splitlines():
|
|
if line in expected:
|
|
active_section = line
|
|
continue
|
|
if active_section and line.startswith("### "):
|
|
active_section = None
|
|
if active_section and line.startswith("- `"):
|
|
actual[active_section].append(line.split("`", 2)[1])
|
|
|
|
labels = {
|
|
"### Interpreter core": "interpreter core",
|
|
"### Python binding modules": "Python binding module",
|
|
"### WASM-safe source core": "WASM-safe source core",
|
|
"### WASM-blocked sources": "WASM-blocked source",
|
|
"### WASM-tracked headers": "WASM-tracked header",
|
|
"### WASM-blocked headers": "WASM-blocked header",
|
|
"### WASM metadata sources": "WASM metadata source",
|
|
}
|
|
for section, expected_entries in expected.items():
|
|
if actual[section] != expected_entries:
|
|
raise SystemExit(
|
|
f"docs/linuxcnc-rs274-source-map.md {labels[section]} list no longer matches source manifest"
|
|
)
|
|
PY
|