参考所有分组:补只读命名参数 native 覆盖,测试通过

This commit is contained in:
cnc
2026-06-03 06:00:29 +08:00
parent 33e1ee5a06
commit 59287b9920
2 changed files with 33 additions and 1 deletions

View File

@@ -749,6 +749,7 @@ CNC_SIM_RS274_FILE_MODE=1 CNC_SIM_RS274_VAR="$var_file" "$build_dir/linuxcnc_rs2
# Source basis: LinuxCNC src/emc/rs274ngc/interp_namedparams.cc lookup_named_param()
# and init_readonly_param() expose modal/unit/feed/spindle readonly parameters.
CNC_SIM_RS274_FILE_MODE=1 CNC_SIM_RS274_VAR="$var_file" "$build_dir/linuxcnc_rs274_dump" tests/gcode/linuxcnc_readonly_named_parameters.ngc >"$output_dir/cnc_sim_linuxcnc_readonly_named_parameters.json"
CNC_SIM_RS274_FILE_MODE=1 CNC_SIM_RS274_VAR="$var_file" "$build_dir/linuxcnc_rs274_dump" tests/gcode/linuxcnc_readonly_named_parameters_extra.ngc >"$output_dir/cnc_sim_linuxcnc_readonly_named_parameters_extra.json"
# Source basis: LinuxCNC src/emc/rs274ngc/interp_array.cc defines
# required/readonly numbered parameters; interp_internal.cc set_probe_data()
# and interp_convert.cc update probe, tool, G28/G30, G92, G5X, and current
@@ -994,6 +995,36 @@ expected_spindle_mode_states = [
if spindle_mode_states != expected_spindle_mode_states:
raise SystemExit(f"unexpected G96/G97 spindle mode states: {spindle_mode_states!r}")
readonly_named = load("cnc_sim_linuxcnc_readonly_named_parameters_extra.json")
if not any(
event["type"] == "linear-feed" and
event["line"] == 4 and
event["end"]["x"] == 1
for event in readonly_named
):
raise SystemExit("missing native #<_spindle_rpm_mode> / #<_spindle_css_mode> G97 branch motion")
if not any(
event["type"] == "linear-feed" and
event["line"] == 8 and
event["end"]["y"] == 1
for event in readonly_named
):
raise SystemExit("missing native #<_ccomp> left-compensation branch motion")
if not any(
event["type"] == "linear-feed" and
event["line"] == 13 and
event["end"]["x"] == 2
for event in readonly_named
):
raise SystemExit("missing native #<_ccomp> right-compensation branch motion")
if not any(
event["type"] == "linear-feed" and
event["line"] == 18 and
event["end"]["a"] == 1
for event in readonly_named
):
raise SystemExit("missing native #<_spindle_rpm_mode> / #<_spindle_css_mode> G96 branch motion")
spindle_orient = load("cnc_sim_linuxcnc_spindle_orient.json")
if not any(
event["type"] == "comment" and
@@ -2456,6 +2487,7 @@ echo "dumped $output_dir/cnc_sim_linuxcnc_word_bracket_whitespace.json"
echo "dumped $output_dir/cnc_sim_linuxcnc_named_parameter_normalization.json"
echo "dumped $output_dir/cnc_sim_linuxcnc_ini_named_parameter.json"
echo "dumped $output_dir/cnc_sim_linuxcnc_readonly_named_parameters.json"
echo "dumped $output_dir/cnc_sim_linuxcnc_readonly_named_parameters_extra.json"
echo "dumped $output_dir/cnc_sim_linuxcnc_numbered_parameters.json"
echo "dumped $output_dir/cnc_sim_linuxcnc_rotary_probe_numbered_parameters.json"
echo "dumped $output_dir/cnc_sim_linuxcnc_multi_rotary_probe_numbered_parameters.json"