继续按 align-linuxcnc 约束:补只读命名参数源回归
结论:新增 LinuxCNC-backed readonly named parameter fixture,依据 interp_namedparams.cc::lookup_named_param 与 init_readonly_param,在 native librs274 与 source-link runner 中验证 #<_metric>/#<_imperial>/#<_absolute>/#<_incremental>/#<_feed>/#<_rpm>/#<_spindle_on>/#<_spindle_cw>;未扩展 smoke,test-native 与 test-linuxcnc-source-link 均通过。
This commit is contained in:
@@ -545,6 +545,11 @@ CNC_SIM_RS274_FILE_MODE=1 CNC_SIM_RS274_VAR="$var_file" \
|
||||
INI_FILE_NAME="$ini_named_parameter_file" CNC_SIM_RS274_FILE_MODE=1 CNC_SIM_RS274_VAR="$var_file" \
|
||||
"$build_dir/linuxcnc_rs274_source_dump" tests/gcode/linuxcnc_ini_named_parameter.ngc \
|
||||
>"$output_dir/cnc_sim_linuxcnc_source_ini_named_parameter.json"
|
||||
# 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_source_dump" tests/gcode/linuxcnc_readonly_named_parameters.ngc \
|
||||
>"$output_dir/cnc_sim_linuxcnc_source_readonly_named_parameters.json"
|
||||
CNC_SIM_RS274_FILE_MODE=1 CNC_SIM_RS274_VAR="$var_file" \
|
||||
"$build_dir/linuxcnc_rs274_source_dump" tests/gcode/linuxcnc_readonly_named_parameters_extra.ngc \
|
||||
>"$output_dir/cnc_sim_linuxcnc_source_readonly_named_parameters_extra.json"
|
||||
@@ -1826,6 +1831,23 @@ expected_ini_named_moves = [(3, 3.25, 0), (5, 3.25, 1)]
|
||||
if ini_named_moves != expected_ini_named_moves:
|
||||
raise SystemExit(f"unexpected source-linked INI named parameter motions: {ini_named_moves!r}")
|
||||
|
||||
readonly_common = json.loads((OUTPUT_DIR / "cnc_sim_linuxcnc_source_readonly_named_parameters.json").read_text())
|
||||
readonly_common_moves = [
|
||||
(event["line"], event["end"]["x"], event["end"]["y"], event["end"]["z"])
|
||||
for event in readonly_common
|
||||
if event["type"] == "linear-feed"
|
||||
]
|
||||
expected_readonly_common_moves = [
|
||||
(4, 1, 0, 0),
|
||||
(8, 0.0393701, 1, 0),
|
||||
(12, 1, 25.4, 1),
|
||||
(16, 2, 25.4, 1),
|
||||
(22, 2, 3, 1),
|
||||
(25, 2, 3, 2),
|
||||
]
|
||||
if readonly_common_moves != expected_readonly_common_moves:
|
||||
raise SystemExit(f"unexpected source-linked readonly named parameter motions: {readonly_common_moves!r}")
|
||||
|
||||
readonly_named = json.loads((OUTPUT_DIR / "cnc_sim_linuxcnc_source_readonly_named_parameters_extra.json").read_text())
|
||||
if not any(
|
||||
event["type"] == "linear-feed" and
|
||||
@@ -2539,6 +2561,7 @@ echo "dumped $output_dir/cnc_sim_linuxcnc_source_named_parameter_exists.json"
|
||||
echo "dumped $output_dir/cnc_sim_linuxcnc_source_indexed_parameters.json"
|
||||
echo "dumped $output_dir/cnc_sim_linuxcnc_source_named_parameter_normalization.json"
|
||||
echo "dumped $output_dir/cnc_sim_linuxcnc_source_ini_named_parameter.json"
|
||||
echo "dumped $output_dir/cnc_sim_linuxcnc_source_readonly_named_parameters.json"
|
||||
echo "dumped $output_dir/cnc_sim_linuxcnc_source_readonly_named_parameters_extra.json"
|
||||
echo "dumped $output_dir/cnc_sim_linuxcnc_source_value_returned.json"
|
||||
echo "dumped $output_dir/cnc_sim_linuxcnc_source_call_level.json"
|
||||
|
||||
Reference in New Issue
Block a user