参考所有分组:补 G73 G85 G86 G89 source 覆盖,测试通过

This commit is contained in:
cnc
2026-06-03 06:30:24 +08:00
parent dbf27a4e6b
commit d0a7a9fcec
4 changed files with 129 additions and 1 deletions

View File

@@ -220,5 +220,5 @@ This matrix tracks LinuxCNC feature coverage for the web/WASM simulator. A featu
| Word reader validation | LinuxCNC native/source reader errors covered for negative `F/G/H/L/M/S/T` values and repeated `A/B/C/D/E/F/H/I/J/K/L/P/Q/R/S/T/U/V/W/X/Y/Z` words from `interp_read.cc` | `tests/gcode/linuxcnc_negative_f_word_error.ngc`, `tests/gcode/linuxcnc_negative_g_code_error.ngc`, `tests/gcode/linuxcnc_negative_h_word_error.ngc`, `tests/gcode/linuxcnc_negative_l_word_error.ngc`, `tests/gcode/linuxcnc_negative_m_code_error.ngc`, `tests/gcode/linuxcnc_negative_s_word_error.ngc`, `tests/gcode/linuxcnc_negative_t_word_error.ngc`, `tests/gcode/linuxcnc_multiple_a_words_error.ngc`, `tests/gcode/linuxcnc_multiple_b_words_error.ngc`, `tests/gcode/linuxcnc_multiple_c_words_error.ngc`, `tests/gcode/linuxcnc_multiple_d_words_error.ngc`, `tests/gcode/linuxcnc_multiple_e_words_error.ngc`, `tests/gcode/linuxcnc_multiple_f_words_error.ngc`, `tests/gcode/linuxcnc_multiple_h_words_error.ngc`, `tests/gcode/linuxcnc_multiple_i_words_error.ngc`, `tests/gcode/linuxcnc_multiple_j_words_error.ngc`, `tests/gcode/linuxcnc_multiple_k_words_error.ngc`, `tests/gcode/linuxcnc_multiple_l_words_error.ngc`, `tests/gcode/linuxcnc_multiple_p_words_error.ngc`, `tests/gcode/linuxcnc_multiple_q_words_error.ngc`, `tests/gcode/linuxcnc_multiple_r_words_error.ngc`, `tests/gcode/linuxcnc_multiple_s_words_error.ngc`, `tests/gcode/linuxcnc_multiple_t_words_error.ngc`, `tests/gcode/linuxcnc_multiple_u_words_error.ngc`, `tests/gcode/linuxcnc_multiple_v_words_error.ngc`, `tests/gcode/linuxcnc_multiple_w_words_error.ngc`, `tests/gcode/linuxcnc_multiple_x_words_error.ngc`, `tests/gcode/linuxcnc_multiple_y_words_error.ngc`, `tests/gcode/linuxcnc_multiple_z_words_error.ngc` |
| G/M reader validation | LinuxCNC native/source `read_g()`/`read_m()` errors covered for range checks, unknown code tables, and same-modal-group conflicts from `interp_read.cc` and `interp_array.cc` | `tests/gcode/linuxcnc_g_code_out_of_range_error.ngc`, `tests/gcode/linuxcnc_unknown_g_code_error.ngc`, `tests/gcode/linuxcnc_two_g_codes_same_modal_group_error.ngc`, `tests/gcode/linuxcnc_m_code_greater_199_error.ngc`, `tests/gcode/linuxcnc_unknown_m_code_error.ngc`, `tests/gcode/linuxcnc_two_m_codes_same_modal_group_error.ngc` |
| Block/item reader validation | LinuxCNC native/source errors covered for repeated `$`, block-delete execution skipping, unused `D/$/E/H/I/J/K/L/P/Q/R` words, bad item-start characters, middle-of-line or comment-prefixed `N` words, comment-prefixed or midline `O` words, top-level or midline bracket items, naked top-level numbers, non-leading ATAN argument slashes, malformed leading `N` numbers, EOF/program-end file checks, overlong file lines, and too many M-codes from `interp_read.cc`, `interp_array.cc`, and `interp_check.cc` | `tests/gcode/linuxcnc_block_delete.ngc`, `tests/gcode/linuxcnc_multiple_spindle_choice_words_error.ngc`, `tests/gcode/linuxcnc_d_word_no_use_error.ngc`, `tests/gcode/linuxcnc_spindle_dollar_no_use_error.ngc`, `tests/gcode/linuxcnc_e_word_no_use_error.ngc`, `tests/gcode/linuxcnc_h_word_no_use_error.ngc`, `tests/gcode/linuxcnc_i_word_no_use_error.ngc`, `tests/gcode/linuxcnc_j_word_no_use_error.ngc`, `tests/gcode/linuxcnc_k_word_no_use_error.ngc`, `tests/gcode/linuxcnc_l_word_no_use_error.ngc`, `tests/gcode/linuxcnc_p_word_no_use_error.ngc`, `tests/gcode/linuxcnc_q_word_no_use_error.ngc`, `tests/gcode/linuxcnc_r_word_no_use_error.ngc`, `tests/gcode/linuxcnc_bad_character_bang_error.ngc`, `tests/gcode/linuxcnc_bad_character_middle_n_word_error.ngc`, `tests/gcode/linuxcnc_comment_prefixed_n_word_error.ngc`, `tests/gcode/linuxcnc_comment_prefixed_spaced_n_word_error.ngc`, `tests/gcode/linuxcnc_comment_prefixed_oword_error.ngc`, `tests/gcode/linuxcnc_midline_numeric_oword_error.ngc`, `tests/gcode/linuxcnc_midline_named_oword_error.ngc`, `tests/gcode/linuxcnc_bad_character_top_left_bracket_error.ngc`, `tests/gcode/linuxcnc_bad_character_top_right_bracket_error.ngc`, `tests/gcode/linuxcnc_bad_character_midline_left_bracket_error.ngc`, `tests/gcode/linuxcnc_bad_character_midline_right_bracket_error.ngc`, `tests/gcode/linuxcnc_bad_character_top_number_error.ngc`, `tests/gcode/linuxcnc_top_level_bare_atan_error.ngc`, `tests/gcode/linuxcnc_midline_bare_atan_error.ngc`, `tests/gcode/linuxcnc_bad_n_number_format_error.ngc`, `tests/gcode/linuxcnc_file_ended_no_program_end_error.ngc`, `tests/gcode/linuxcnc_file_ended_no_percent_error.ngc`, generated `linuxcnc_command_too_long_error.ngc`, `tests/gcode/linuxcnc_too_many_m_codes_error.ngc` |
| Broader canned cycles `G73`, `G74`, `G82`-`G89` | partially covered: `G73`, `G74`, `G82`, `G83`, `G84`, `G85`, `G86`, `G87`, `G88`, `G89`; smoke parser maps supported cycles across `G17/G18/G19`, including LinuxCNC's special non-XY `G74/G84` tapping argument order and `G87` plane-specific `I/J/K` mapping; native/source regressions now check non-XY `G74/G84/G86/G87/G88` sequences | `tests/gcode/linuxcnc_canned_cycles_extended.ngc`, `tests/gcode/linuxcnc_canned_cycle_planes.ngc`, smoke API regression |
| Broader canned cycles `G73`, `G74`, `G82`-`G89` | covered for representative LinuxCNC native/source `G73`, `G74`, `G82`, `G83`, `G84`, `G85`, `G86`, `G87`, `G88`, and `G89` sequences from `interp_cycles.cc`, including peck drilling, feed-out boring, stop/restart boring, dwell/feed-out boring, special non-XY `G74/G84` tapping argument order, and `G87` plane-specific `I/J/K` mapping; smoke parser still maps supported cycles across `G17/G18/G19` | `tests/gcode/linuxcnc_canned_cycles_extended.ngc`, `tests/gcode/linuxcnc_canned_cycle_planes.ngc`, smoke API regression |
| Full source-level wasm build | covered for the current wasm-safe RS274 source set, with remaining work focused on broadening browser-hostile dependency replacement and feature coverage | `./build-wasm.sh`, `test-linuxcnc-wasm-runtime-link.sh`, `test-web-wasm-node-smoke.sh`, `test-web-wasm-browser-smoke.sh` |

View File

@@ -589,6 +589,9 @@ if CNC_SIM_RS274_FILE_MODE=1 CNC_SIM_RS274_VAR="$var_file" \
fi
grep -Fq "Cannot put an a in canned cycle" \
"$output_dir/cnc_sim_linuxcnc_canned_cycle_reject_rotary_followup.err"
# Source basis: LinuxCNC src/emc/rs274ngc/interp_cycles.cc
# convert_cycle_g73()/g85()/g86()/g89() expand peck, feed-out,
# stop/restart, dwell, and retract sequences through Canon motion.
CNC_SIM_RS274_VAR="$var_file" "$build_dir/linuxcnc_rs274_dump" tests/gcode/linuxcnc_canned_cycles_extended.ngc >"$output_dir/cnc_sim_linuxcnc_canned_cycles_extended.json"
CNC_SIM_RS274_VAR="$var_file" "$build_dir/linuxcnc_rs274_dump" tests/gcode/linuxcnc_canned_cycle_planes.ngc >"$output_dir/cnc_sim_linuxcnc_canned_cycle_planes.json"
CNC_SIM_RS274_VAR="$var_file" "$build_dir/linuxcnc_rs274_dump" tests/gcode/linuxcnc_extended_plane_cycle.ngc >"$output_dir/cnc_sim_linuxcnc_extended_plane_cycle.json"
@@ -1668,6 +1671,65 @@ expected_g87_sequence = [
if g87_sequence != expected_g87_sequence:
raise SystemExit(f"unexpected G87 back-boring sequence: {g87_sequence!r}")
g73_feed_depths = [
event["end"]["z"]
for event in extended_cycle
if event["type"] == "linear-feed" and event["line"] == 15
]
if g73_feed_depths != [1, 0, -1, -2, -3]:
raise SystemExit(f"unexpected G73 peck depths: {g73_feed_depths!r}")
g73_rapid_depths = [
event["end"]["z"]
for event in extended_cycle
if event["type"] == "rapid" and event["line"] == 15 and event["end"]["x"] == 70
]
if g73_rapid_depths != [2, 2, 1, 0, -1, 2]:
raise SystemExit(f"unexpected G73 short-retract depths: {g73_rapid_depths!r}")
g85_sequence = [
g84_signature(event)
for event in extended_cycle
if event["line"] == 16 and event["type"] == "linear-feed"
]
expected_g85_sequence = [
("linear-feed", 80, -2),
("linear-feed", 80, 2),
]
if g85_sequence != expected_g85_sequence:
raise SystemExit(f"unexpected G85 feed-out sequence: {g85_sequence!r}")
g86_sequence = [
g84_signature(event)
for event in extended_cycle
if event["line"] == 17 and event["type"] in {"linear-feed", "set-spindle", "dwell"}
]
expected_g86_sequence = [
("linear-feed", 90, -2),
("dwell", 0.06),
("set-spindle", 0, 0),
("set-spindle", 800, 1),
]
if g86_sequence != expected_g86_sequence:
raise SystemExit(f"unexpected G86 stop/restart sequence: {g86_sequence!r}")
if not any(
event["type"] == "rapid" and event["line"] == 17 and event["end"]["x"] == 90 and event["end"]["z"] == 2
for event in extended_cycle
):
raise SystemExit("missing G86 rapid retract")
g89_sequence = [
g84_signature(event)
for event in extended_cycle
if event["line"] == 18 and event["type"] in {"linear-feed", "dwell"}
]
expected_g89_sequence = [
("linear-feed", 100, -2),
("dwell", 0.08),
("linear-feed", 100, 2),
]
if g89_sequence != expected_g89_sequence:
raise SystemExit(f"unexpected G89 dwell/feed-out sequence: {g89_sequence!r}")
arc_planes = load("cnc_sim_linuxcnc_arc_planes.json")
if not any(
event["type"] == "arc-feed" and

View File

@@ -577,6 +577,9 @@ if CNC_SIM_RS274_VAR="$var_file" \
exit 1
fi
grep -q "J word missing with g87" "$output_dir/cnc_sim_linuxcnc_source_canned_cycle_g87_missing_j_error.err"
# Source basis: LinuxCNC src/emc/rs274ngc/interp_cycles.cc
# convert_cycle_g73()/g85()/g86()/g89() expand peck, feed-out,
# stop/restart, dwell, and retract sequences through Canon motion.
CNC_SIM_RS274_VAR="$var_file" \
"$build_dir/linuxcnc_rs274_source_dump" tests/gcode/linuxcnc_canned_cycles_extended.ngc \
>"$output_dir/cnc_sim_linuxcnc_source_canned_cycles_extended.json"
@@ -2141,6 +2144,65 @@ expected_g87_sequence = [
if g87_sequence != expected_g87_sequence:
raise SystemExit(f"unexpected source-linked G87 back-boring sequence: {g87_sequence!r}")
g73_feed_depths = [
event["end"]["z"]
for event in extended_cycle
if event["type"] == "linear-feed" and event["line"] == 15
]
if g73_feed_depths != [1, 0, -1, -2, -3]:
raise SystemExit(f"unexpected source-linked G73 peck depths: {g73_feed_depths!r}")
g73_rapid_depths = [
event["end"]["z"]
for event in extended_cycle
if event["type"] == "rapid" and event["line"] == 15 and event["end"]["x"] == 70
]
if g73_rapid_depths != [2, 2, 1, 0, -1, 2]:
raise SystemExit(f"unexpected source-linked G73 short-retract depths: {g73_rapid_depths!r}")
g85_sequence = [
g84_signature(event)
for event in extended_cycle
if event["line"] == 16 and event["type"] == "linear-feed"
]
expected_g85_sequence = [
("linear-feed", 80, -2),
("linear-feed", 80, 2),
]
if g85_sequence != expected_g85_sequence:
raise SystemExit(f"unexpected source-linked G85 feed-out sequence: {g85_sequence!r}")
g86_sequence = [
g84_signature(event)
for event in extended_cycle
if event["line"] == 17 and event["type"] in {"linear-feed", "set-spindle", "dwell"}
]
expected_g86_sequence = [
("linear-feed", 90, -2),
("dwell", 0.06),
("set-spindle", 0, 0),
("set-spindle", 800, 1),
]
if g86_sequence != expected_g86_sequence:
raise SystemExit(f"unexpected source-linked G86 stop/restart sequence: {g86_sequence!r}")
if not any(
event["type"] == "rapid" and event["line"] == 17 and event["end"]["x"] == 90 and event["end"]["z"] == 2
for event in extended_cycle
):
raise SystemExit("missing source-linked G86 rapid retract")
g89_sequence = [
g84_signature(event)
for event in extended_cycle
if event["line"] == 18 and event["type"] in {"linear-feed", "dwell"}
]
expected_g89_sequence = [
("linear-feed", 100, -2),
("dwell", 0.08),
("linear-feed", 100, 2),
]
if g89_sequence != expected_g89_sequence:
raise SystemExit(f"unexpected source-linked G89 dwell/feed-out sequence: {g89_sequence!r}")
arc_planes = json.loads((OUTPUT_DIR / "cnc_sim_linuxcnc_source_arc_planes.json").read_text())
if not any(
event["type"] == "arc-feed" and

View File

@@ -12,4 +12,8 @@ G99 G88 X50 Y0 Z-2 R2 P0.07 F70
G0 X0 Y0 Z5
S800 M3
G99 G87 X60 Y0 Z-4 R2 I0.2 J0.3 K-2 F80
G99 G73 X70 Y0 Z-3 R2 Q1 F90
G99 G85 X80 Y0 Z-2 R2 F90
G99 G86 X90 Y0 Z-2 R2 P0.06 F90
G99 G89 X100 Y0 Z-2 R2 P0.08 F90
M30