按源验证当前位置命名参数

This commit is contained in:
cnc
2026-06-06 08:51:20 +08:00
parent de5f28f7ee
commit 92562db29f
3 changed files with 50 additions and 1 deletions

View File

@@ -887,6 +887,9 @@ CNC_SIM_RS274_FILE_MODE=1 CNC_SIM_RS274_VAR="$var_file" \
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"
CNC_SIM_RS274_FILE_MODE=1 CNC_SIM_RS274_VAR="$var_file" \
"$build_dir/linuxcnc_rs274_source_dump" tests/gcode/linuxcnc_readonly_named_current_position.ngc \
>"$output_dir/cnc_sim_linuxcnc_source_readonly_named_current_position.json"
if CNC_SIM_RS274_FILE_MODE=1 CNC_SIM_RS274_VAR="$var_file" \
"$build_dir/linuxcnc_rs274_source_dump" tests/gcode/linuxcnc_readonly_named_parameter_assign_error.ngc \
>"$output_dir/cnc_sim_linuxcnc_source_readonly_named_parameter_assign_error.json" 2>"$output_dir/cnc_sim_linuxcnc_source_readonly_named_parameter_assign_error.err"; then
@@ -3381,6 +3384,23 @@ expected_readonly_common_moves = [
if readonly_common_moves != expected_readonly_common_moves:
raise SystemExit(f"unexpected source-linked readonly named parameter motions: {readonly_common_moves!r}")
readonly_current = json.loads((OUTPUT_DIR / "cnc_sim_linuxcnc_source_readonly_named_current_position.json").read_text())
if not any(
event["type"] == "linear-feed" and
event["line"] == 6 and
event["end"]["x"] == 10 and
event["end"]["y"] == 2 and
event["end"]["z"] == 3 and
event["end"]["a"] == 4 and
event["end"]["b"] == 5 and
event["end"]["c"] == 6 and
event["end"]["u"] == 7 and
event["end"]["v"] == 8 and
event["end"]["w"] == 9
for event in readonly_current
):
raise SystemExit("missing source-linked readonly named current-position branch motion")
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
@@ -4172,6 +4192,7 @@ echo "dumped $output_dir/cnc_sim_linuxcnc_source_named_parameter_normalization.j
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_readonly_named_current_position.json"
echo "dumped $output_dir/cnc_sim_linuxcnc_source_value_returned.json"
echo "dumped $output_dir/cnc_sim_linuxcnc_source_call_level.json"
echo "dumped $output_dir/cnc_sim_linuxcnc_source_exists_word_value.json"