参考所有分组:补 native read path source 覆盖,测试通过
This commit is contained in:
@@ -1062,6 +1062,22 @@ cp "$base_var_file" "$var_file"
|
||||
CNC_SIM_RS274_VAR="$var_file" "$build_dir/linuxcnc_rs274_dump" tests/gcode/linuxcnc_g52_offset.ngc >"$output_dir/cnc_sim_linuxcnc_g52_offset.json"
|
||||
CNC_SIM_RS274_FILE_MODE=1 CNC_SIM_RS274_VAR="$var_file" "$build_dir/linuxcnc_rs274_dump" tests/gcode/linuxcnc_g52_xz_nurbs.ngc >"$output_dir/cnc_sim_linuxcnc_g52_xz_nurbs.json"
|
||||
CNC_SIM_RS274_FILE_MODE=1 CNC_SIM_RS274_VAR="$var_file" "$build_dir/linuxcnc_rs274_dump" tests/gcode/linuxcnc_g62_xz_nurbs.ngc >"$output_dir/cnc_sim_linuxcnc_g62_xz_nurbs.json"
|
||||
# Source basis: LinuxCNC src/emc/rs274ngc/interp_read.cc read_n_number()
|
||||
# accepts and ignores the fractional suffix after an N word, preserves leading
|
||||
# zero line numbers, and has the >99999 range check disabled; execute_block()
|
||||
# in src/emc/rs274ngc/interp_execute.cc still tags canon output with the
|
||||
# interpreter sequence number.
|
||||
CNC_SIM_RS274_VAR="$var_file" "$build_dir/linuxcnc_rs274_dump" tests/gcode/linuxcnc_fractional_linenumbers.ngc >"$output_dir/cnc_sim_linuxcnc_fractional_linenumbers.json"
|
||||
CNC_SIM_RS274_VAR="$var_file" "$build_dir/linuxcnc_rs274_dump" tests/gcode/linuxcnc_extended_linenumbers.ngc >"$output_dir/cnc_sim_linuxcnc_extended_linenumbers.json"
|
||||
# Source basis: LinuxCNC src/emc/rs274ngc/interp_read.cc read_text()
|
||||
# calls close_and_downcase() to downcase words and remove spaces/tabs outside
|
||||
# comments before read_items() dispatches the words.
|
||||
CNC_SIM_RS274_VAR="$var_file" "$build_dir/linuxcnc_rs274_dump" tests/gcode/linuxcnc_close_and_downcase_words.ngc >"$output_dir/cnc_sim_linuxcnc_close_and_downcase_words.json"
|
||||
# Source basis: LinuxCNC src/emc/rs274ngc/rs274ngc_pre.cc open() enables
|
||||
# percent-file mode when the first nonblank line is '%'; read_text() in
|
||||
# src/emc/rs274ngc/interp_read.cc returns INTERP_ENDFILE at the matching '%',
|
||||
# so later lines are ignored.
|
||||
CNC_SIM_RS274_FILE_MODE=1 CNC_SIM_RS274_VAR="$var_file" "$build_dir/linuxcnc_rs274_dump" tests/gcode/linuxcnc_percent_file_ignores_trailing.ngc >"$output_dir/cnc_sim_linuxcnc_percent_file_ignores_trailing.json"
|
||||
CNC_SIM_RS274_NATIVE_OUTPUT_DIR="$output_dir" python3 - <<'PY'
|
||||
import json
|
||||
import os
|
||||
@@ -1087,6 +1103,52 @@ required_motion = {"set-units", "set-plane", "set-spindle", "rapid", "set-feed",
|
||||
check(OUTPUT_DIR / "cnc_sim_linuxcnc_basic_motion.json", required_motion)
|
||||
check(OUTPUT_DIR / "cnc_sim_linuxcnc_basic_mill.json", required_motion | {"tool-change"})
|
||||
|
||||
fractional_linenumbers = load("cnc_sim_linuxcnc_fractional_linenumbers.json")
|
||||
fractional_spindle_states = [
|
||||
(event["line"], event["spindle"])
|
||||
for event in fractional_linenumbers
|
||||
if event["type"] == "set-spindle"
|
||||
]
|
||||
if fractional_spindle_states[:3] != [(1, 300), (2, 600), (3, 1200)]:
|
||||
raise SystemExit(
|
||||
"unexpected native fractional N-word spindle sequence: "
|
||||
f"{fractional_spindle_states!r}"
|
||||
)
|
||||
|
||||
extended_linenumbers = load("cnc_sim_linuxcnc_extended_linenumbers.json")
|
||||
extended_spindle_states = [
|
||||
(event["line"], event["spindle"])
|
||||
for event in extended_linenumbers
|
||||
if event["type"] == "set-spindle"
|
||||
]
|
||||
if extended_spindle_states[:3] != [(1, 111), (2, 222), (3, 333)]:
|
||||
raise SystemExit(
|
||||
"unexpected native extended N-word spindle sequence: "
|
||||
f"{extended_spindle_states!r}"
|
||||
)
|
||||
|
||||
close_and_downcase_words = load("cnc_sim_linuxcnc_close_and_downcase_words.json")
|
||||
if not any(
|
||||
event["type"] == "linear-feed" and
|
||||
event["line"] == 3 and
|
||||
event["end"]["x"] == 3 and
|
||||
event["end"]["y"] == 4
|
||||
for event in close_and_downcase_words
|
||||
):
|
||||
raise SystemExit("missing native close_and_downcase mixed-case spaced-word move")
|
||||
|
||||
percent_file = load("cnc_sim_linuxcnc_percent_file_ignores_trailing.json")
|
||||
percent_file_feeds = [
|
||||
(event["line"], event["end"]["x"])
|
||||
for event in percent_file
|
||||
if event["type"] == "linear-feed"
|
||||
]
|
||||
if percent_file_feeds != [(4, 1)]:
|
||||
raise SystemExit(
|
||||
"unexpected native percent-file feed sequence: "
|
||||
f"{percent_file_feeds!r}"
|
||||
)
|
||||
|
||||
block_delete_off = load("cnc_sim_linuxcnc_block_delete_off.json")
|
||||
if not any(
|
||||
event["type"] == "linear-feed" and event["line"] == 2 and event["end"]["x"] == 5
|
||||
@@ -2896,3 +2958,7 @@ echo "dumped $output_dir/cnc_sim_linuxcnc_g92_restore.json"
|
||||
echo "dumped $output_dir/cnc_sim_linuxcnc_g52_offset.json"
|
||||
echo "dumped $output_dir/cnc_sim_linuxcnc_g52_xz_nurbs.json"
|
||||
echo "dumped $output_dir/cnc_sim_linuxcnc_g62_xz_nurbs.json"
|
||||
echo "dumped $output_dir/cnc_sim_linuxcnc_fractional_linenumbers.json"
|
||||
echo "dumped $output_dir/cnc_sim_linuxcnc_extended_linenumbers.json"
|
||||
echo "dumped $output_dir/cnc_sim_linuxcnc_close_and_downcase_words.json"
|
||||
echo "dumped $output_dir/cnc_sim_linuxcnc_percent_file_ignores_trailing.json"
|
||||
|
||||
Reference in New Issue
Block a user