From 5e58f4d8111781242d2c555ab63090b3c81e1d5c Mon Sep 17 00:00:00 2001 From: wangdequan Date: Sun, 7 Jun 2026 23:37:23 +0800 Subject: [PATCH] =?UTF-8?q?=E6=8C=89=E5=BB=BA=E8=AE=AE=EF=BC=8C=E7=BB=A7?= =?UTF-8?q?=E7=BB=AD=E5=AE=8C=E6=88=90=E5=90=8E=E7=BB=AD=E5=B7=A5=E4=BD=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 结论:tool_semantics 的 T/M6/G43/G49 canonical 子集已通过 rs274 -t -i 纳入 upstream side-by-side baseline,M61 host-state 行为继续由 standalone fixture 验证,完整 native probes 验证通过。 --- wasm-port/docs/compatibility-validation.md | 22 +++--- wasm-port/docs/drift-report.md | 10 ++- ...verify_native_linuxcnc_fixture_baseline.sh | 73 ++++++++++++++++++- 3 files changed, 91 insertions(+), 14 deletions(-) diff --git a/wasm-port/docs/compatibility-validation.md b/wasm-port/docs/compatibility-validation.md index 34e73ea..9509bab 100644 --- a/wasm-port/docs/compatibility-validation.md +++ b/wasm-port/docs/compatibility-validation.md @@ -124,20 +124,22 @@ The current fixture expectations validate standalone behavior against both the vendored LinuxCNC source path and an upstream `rs274` side-by-side baseline for parser/conversion, arc geometry, offsets, feed-control, comment/logging, numbered-parameter, probing, spindle-orient, file-open reset, file-finish, -tool-reload, canned-cycle, state-tag motion, tool-table setup, and O-word -subroutine fixtures, plus threading/rigid tap, NURBS dispatch boundaries, and -the comparable canonical runtime edge and program-end cleanup calls. Fixtures -that depend on standalone-only runtime adapters, HAL/INI/tool-change state, -upstream `rs274` output gaps such as `WAIT` or hidden NURBS control-point -detail, or richer machine session state still need dedicated native LinuxCNC -baselines. +tool-reload, tool select/change/length-offset, canned-cycle, state-tag motion, +tool-table setup, and O-word subroutine fixtures, plus threading/rigid tap, +NURBS dispatch boundaries, and the comparable canonical runtime edge and +program-end cleanup calls. Fixtures that depend on standalone-only runtime +adapters, HAL/INI/tool-change state, upstream `rs274` output gaps such as +`WAIT` or hidden NURBS control-point detail, or richer machine session state +still need dedicated native LinuxCNC baselines. Remaining positive fixtures that are not in the upstream `rs274` side-by-side baseline are intentionally held out until they get a dedicated native LinuxCNC baseline: `namedparam_semantics` depends on standalone INI/HAL adapter -resolution, and `tool_semantics` depends on tool-change host state. -`state_tag_motion` now compares its motion events with upstream `rs274`, while -`UPDATE_TAG` events remain a standalone state-tag capture boundary. +resolution. `state_tag_motion` now compares its motion events with upstream +`rs274`, while `UPDATE_TAG` events remain a standalone state-tag capture +boundary. `tool_semantics` now compares T/M6/G43/G49 canonical events with +upstream `rs274`; M61 current-pocket host-state behavior remains covered by the +standalone fixture expectation. The kinematics probes currently cover LinuxCNC identity/trivial kinematics, the switchable `5axiskins` XYZBCW bridge-mill model, TRT `xyzac`/`xyzbc` diff --git a/wasm-port/docs/drift-report.md b/wasm-port/docs/drift-report.md index d319166..fb0c384 100644 --- a/wasm-port/docs/drift-report.md +++ b/wasm-port/docs/drift-report.md @@ -69,9 +69,10 @@ semantic rewrites: path. The upstream `rs274` side-by-side baseline now covers simple motion, arc geometry, offsets, feed-control, comment/logging, numbered-parameter, probing, spindle-orient, file-open reset, file-finish, tool-reload, and - canned-cycle, state-tag motion, tool-table setup, and O-word subroutine - fixtures; it also covers threading/rigid tap, NURBS dispatch boundaries, and - comparable canonical runtime edge and program-end cleanup calls. + tool select/change/length-offset, canned-cycle, state-tag motion, tool-table + setup, and O-word subroutine fixtures; it also covers threading/rigid tap, + NURBS dispatch boundaries, and comparable canonical runtime edge and + program-end cleanup calls. Adapter-heavy fixtures, standalone modal-state assertions, and upstream `rs274` output gaps such as `WAIT` or hidden NURBS control-point detail still need dedicated native LinuxCNC baselines. @@ -80,6 +81,9 @@ semantic rewrites: default `G73/G83` peck-clearance values for millimeter units. - `tool_table_setup` is now in the upstream `rs274` side-by-side baseline using a dedicated `rs274 -t` tool table and `-i` millimeter-unit INI boundary. +- `tool_semantics` now compares its T/M6/G43/G49 canonical subset with + upstream `rs274 -t -i`; M61 current-pocket host-state behavior remains a + standalone fixture expectation. ## Current Drift Conclusion diff --git a/wasm-port/tools/verify_native_linuxcnc_fixture_baseline.sh b/wasm-port/tools/verify_native_linuxcnc_fixture_baseline.sh index 277f52d..e9802c6 100755 --- a/wasm-port/tools/verify_native_linuxcnc_fixture_baseline.sh +++ b/wasm-port/tools/verify_native_linuxcnc_fixture_baseline.sh @@ -31,6 +31,7 @@ FIXTURES=( spindle_orient state_tag_motion threading_sync + tool_semantics tool_table_setup tool_reload ) @@ -101,6 +102,11 @@ normalize_standalone_events() { next } + if (line == "CHANGE_TOOL") { + print line + next + } + if (line ~ /^NURBS_G5_FEED /) { print "NURBS_G5_FEED" next @@ -217,6 +223,39 @@ normalize_standalone_events() { next } + if (line ~ /^SELECT_TOOL /) { + split(line, fields, /[[:space:]]+/) + for (i in fields) { + split(fields[i], pair, "=") + values[pair[1]] = pair[2] + } + print "SELECT_TOOL|" values["tool"] + delete values + next + } + + if (line ~ /^CHANGE_TOOL_NUMBER /) { + split(line, fields, /[[:space:]]+/) + for (i in fields) { + split(fields[i], pair, "=") + values[pair[1]] = pair[2] + } + print "CHANGE_TOOL_NUMBER|" values["pocket"] + delete values + next + } + + if (line ~ /^USE_TOOL_LENGTH_OFFSET /) { + split(line, fields, /[[:space:]]+/) + for (i in fields) { + split(fields[i], pair, "=") + values[pair[1]] = pair[2] + } + print "USE_TOOL_LENGTH_OFFSET|" norm(values["x"]) "|" norm(values["y"]) "|" norm(values["z"]) + delete values + next + } + if (line ~ /^(ENABLE|DISABLE)_SPEED_OVERRIDE /) { split(line, fields, /[[:space:]]+/) for (i in fields) { @@ -490,6 +529,11 @@ normalize_upstream_rs274_output() { next } + if (line == "CHANGE_TOOL()") { + print "CHANGE_TOOL" + next + } + if (line ~ /^(MIST_ON|MIST_OFF|FLOOD_ON|FLOOD_OFF|ENABLE_FEED_OVERRIDE|DISABLE_FEED_OVERRIDE|DISABLE_ADAPTIVE_FEED|ENABLE_ADAPTIVE_FEED|DISABLE_FEED_HOLD|ENABLE_FEED_HOLD|PROGRAM_STOP|PROGRAM_END)\(\)$/) { value = line sub(/\(\)$/, "", value) @@ -562,6 +606,27 @@ normalize_upstream_rs274_output() { next } + if (line ~ /^SELECT_TOOL\(/) { + args = args_of(line) + print "SELECT_TOOL|" trim(args) + next + } + + if (line ~ /^CHANGE_TOOL_NUMBER\(/) { + args = args_of(line) + print "CHANGE_TOOL_NUMBER|" trim(args) + next + } + + if (line ~ /^USE_TOOL_LENGTH_OFFSET\(/) { + args = args_of(line) + split(args, groups, ",") + gsub(/[[:space:]]+/, " ", groups[1]) + split(trim(groups[1]), offset, " ") + print "USE_TOOL_LENGTH_OFFSET|" norm(offset[1]) "|" norm(offset[2]) "|" norm(offset[3]) + next + } + if (line ~ /^(ENABLE|DISABLE)_SPEED_OVERRIDE\(/) { op = line sub(/\(.*/, "", op) @@ -760,7 +825,7 @@ for name in "${FIXTURES[@]}"; do fi set +e - if [[ "$name" == "tool_table_setup" ]]; then + if [[ "$name" == "tool_table_setup" || "$name" == "tool_semantics" ]]; then "$UPSTREAM_RS274" -g -i "$TOOL_TABLE_INI" -t "$TOOL_TABLE_BASELINE" "$gcode_file" > "$native_raw" 2>&1 else "$UPSTREAM_RS274" -g "$gcode_file" > "$native_raw" 2>&1 @@ -782,6 +847,12 @@ for name in "${FIXTURES[@]}"; do mv "$TMP_DIR/$name.rs274.no-comments" "$native_norm" mv "$TMP_DIR/$name.expected.no-comments" "$expected_norm" fi + if [[ "$name" == "tool_semantics" ]]; then + grep -Ev '^(CHANGE_TOOL_NUMBER|MESSAGE\| tool after_m61)' "$native_norm" > "$TMP_DIR/$name.rs274.tool-subset" + grep -Ev '^(CHANGE_TOOL_NUMBER|MESSAGE\| tool after_m61)' "$expected_norm" > "$TMP_DIR/$name.expected.tool-subset" + mv "$TMP_DIR/$name.rs274.tool-subset" "$native_norm" + mv "$TMP_DIR/$name.expected.tool-subset" "$expected_norm" + fi if grep -Eq '^STRAIGHT_(TRAVERSE|FEED)$' "$expected_norm"; then sparse_ops_file="$TMP_DIR/$name.sparse_ops" grep -E '^STRAIGHT_(TRAVERSE|FEED)$' "$expected_norm" > "$sparse_ops_file"