From 74cb5f826cb56c6c1fb9f58b3bc8f48053228483 Mon Sep 17 00:00:00 2001 From: cnc Date: Wed, 3 Jun 2026 00:35:07 +0800 Subject: [PATCH] =?UTF-8?q?=E5=8F=82=E8=80=83=E6=89=80=E6=9C=89=E5=88=86?= =?UTF-8?q?=E7=BB=84=EF=BC=9A=E8=A1=A5=E8=AF=BB=E5=8F=96=E5=92=8C=E5=9C=86?= =?UTF-8?q?=E5=BC=A7=20native=20=E8=A6=86=E7=9B=96=EF=BC=8C=E6=B5=8B?= =?UTF-8?q?=E8=AF=95=E9=80=9A=E8=BF=87?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- docs/linuxcnc-porting.md | 6 +-- test-linuxcnc-rs274-native.sh | 75 +++++++++++++++++++++++++++++++++++ 2 files changed, 78 insertions(+), 3 deletions(-) diff --git a/docs/linuxcnc-porting.md b/docs/linuxcnc-porting.md index 0d51024..fc8b1a4 100644 --- a/docs/linuxcnc-porting.md +++ b/docs/linuxcnc-porting.md @@ -190,7 +190,7 @@ This matrix tracks LinuxCNC feature coverage for the web/WASM simulator. A featu | Area | Status | Regression | | --- | --- | --- | -| Basic modal motion `G0/G1/G2/G3` | covered, including `G91` incremental linear motion, R-format arcs, `G18`/`G19` arc plane mapping, and `G90.1`/`G91.1` IJK modes | `tests/gcode/linuxcnc_basic_motion.ngc`, `tests/gcode/basic_mill.ngc`, `tests/gcode/incremental_and_r_arc.ngc`, `tests/gcode/linuxcnc_arc_planes.ngc`, `tests/gcode/linuxcnc_arc_distance_modes.ngc` | +| Basic modal motion `G0/G1/G2/G3` | covered, including `G91` incremental linear motion, R-format arcs, `G18`/`G19` arc plane mapping, `G90.1`/`G91.1` IJK modes, and native/source center-format arc tolerance acceptance/rejection | `tests/gcode/linuxcnc_basic_motion.ngc`, `tests/gcode/basic_mill.ngc`, `tests/gcode/incremental_and_r_arc.ngc`, `tests/gcode/linuxcnc_arc_planes.ngc`, `tests/gcode/linuxcnc_arc_distance_modes.ngc`, `tests/gcode/linuxcnc_arc_center_tolerance_good_imperial.ngc`, `tests/gcode/linuxcnc_arc_center_tolerance_bad_metric.ngc` | | Polar coordinates and extended-plane motion restrictions | covered through LinuxCNC native/source `@`/`^` polar parsing, G17-only polar motion validation, absolute/incremental polar endpoint mapping, G53/origin rejection, and extended-plane arc/NURBS rejection | `tests/gcode/linuxcnc_polar_coordinates.ngc`, `tests/gcode/linuxcnc_polar_coordinate_variants.ngc`, `tests/gcode/linuxcnc_polar_g18_error.ngc`, `tests/gcode/linuxcnc_polar_with_x_error.ngc`, `tests/gcode/linuxcnc_polar_with_y_error.ngc`, `tests/gcode/linuxcnc_polar_g92_error.ngc`, `tests/gcode/linuxcnc_polar_g53_error.ngc`, `tests/gcode/linuxcnc_polar_radius_origin_error.ngc`, `tests/gcode/linuxcnc_polar_incremental_radius_origin_error.ngc`, `tests/gcode/linuxcnc_polar_incremental_theta_origin_error.ngc`, `tests/gcode/linuxcnc_extended_plane_arc_error.ngc`, `tests/gcode/linuxcnc_g62_extended_plane_error.ngc` | | Block-level axis/motion validation | covered through LinuxCNC native/source `enhance_block()` checks for invalid `G80` axes, missing `G52/G92` or motion axes, bare axes without active motion, and modal-0 axis consumers on motion blocks | `tests/gcode/linuxcnc_g80_axis_error.ngc`, `tests/gcode/linuxcnc_g52_missing_axis_error.ngc`, `tests/gcode/linuxcnc_g92_missing_axis_error.ngc`, `tests/gcode/linuxcnc_motion_missing_axis_error.ngc`, `tests/gcode/linuxcnc_axis_without_motion_error.ngc`, `tests/gcode/linuxcnc_motion_with_g92_axis_error.ngc` | | Predefined position moves `G28/G28.1`, `G30/G30.1` | covered for stored position, waypoint, selected-axis return, and all-axis return | `tests/gcode/linuxcnc_predefined_positions.ngc` | @@ -215,9 +215,9 @@ This matrix tracks LinuxCNC feature coverage for the web/WASM simulator. A featu | Cutter compensation | covered for tool-table `G41/G42 D...` and explicit-radius `G41.1/G42.1/G40` through LinuxCNC native/source backends | `tests/gcode/linuxcnc_cutter_comp.ngc` | | Probe moves `G38.2/G38.3/G38.4/G38.5` | covered as distinct probe events with LinuxCNC `probe_type` preserved through smoke, native, and source-linked paths | `tests/gcode/linuxcnc_probe_no_error.ngc` | | O-word and Fanuc subroutines, calls, and control flow | covered for numeric and named `O... sub/call/return/endsub`, Fanuc-style `M98 P... L...`/`M99`, plus `if`/`elseif`/`else`, `while`, `repeat`, `do`/`while`, `break`, and `continue` through LinuxCNC file mode; native/source read errors cover malformed O-word commands, missing control-expression brackets, too many or empty call parameters, Fanuc-style `M98` missing `P`, and midline/comment-prefixed `M98` falling through to normal M-code handling; native/source execution errors cover duplicate/undefined/unmatched labels, out-of-context `return`/`endsub`, wrong subroutine close style, too many nested call levels, lowercase numeric labels, O-word state parameters, `EXISTS[]` word-value checks, and M98/O-word local-parameter style differences; smoke parser also covers named `O` sub/call/return/endsub and loop-control forms | `tests/gcode/smoke_oword_subprogram.ngc`, `tests/gcode/linuxcnc_named_oword_subprogram.ngc`, `tests/gcode/smoke_subprogram_m98.ngc`, `tests/gcode/linuxcnc_oword_control_flow.ngc`, `tests/gcode/linuxcnc_value_returned.ngc`, `tests/gcode/linuxcnc_call_level.ngc`, `tests/gcode/linuxcnc_exists_word_value.ngc`, `tests/gcode/linuxcnc_lowercase_numeric_oword.ngc`, `tests/gcode/linuxcnc_m98_mixed_styles_variables.ngc`, `tests/gcode/linuxcnc_oword_unknown_command_error.ngc`, `tests/gcode/linuxcnc_oword_unexpected_trailing_item_error.ngc`, `tests/gcode/linuxcnc_oword_if_missing_bracket_error.ngc`, `tests/gcode/linuxcnc_oword_elseif_missing_bracket_error.ngc`, `tests/gcode/linuxcnc_oword_while_missing_bracket_error.ngc`, `tests/gcode/linuxcnc_oword_repeat_missing_bracket_error.ngc`, `tests/gcode/linuxcnc_oword_too_many_call_parameters_error.ngc`, `tests/gcode/linuxcnc_oword_empty_call_parameter_error.ngc`, `tests/gcode/linuxcnc_oword_too_many_call_levels_error.ngc`, `tests/gcode/linuxcnc_oword_endsub_without_sub_error.ngc`, `tests/gcode/linuxcnc_oword_return_without_sub_error.ngc`, `tests/gcode/linuxcnc_oword_duplicate_if_label_error.ngc`, `tests/gcode/linuxcnc_oword_elseif_undefined_label_error.ngc`, `tests/gcode/linuxcnc_oword_else_undefined_label_error.ngc`, `tests/gcode/linuxcnc_oword_endif_undefined_label_error.ngc`, `tests/gcode/linuxcnc_oword_break_undefined_label_error.ngc`, `tests/gcode/linuxcnc_oword_continue_undefined_label_error.ngc`, `tests/gcode/linuxcnc_oword_endwhile_undefined_label_error.ngc`, `tests/gcode/linuxcnc_oword_elseif_no_matching_if_error.ngc`, `tests/gcode/linuxcnc_oword_break_no_matching_loop_error.ngc`, `tests/gcode/linuxcnc_oword_continue_no_matching_loop_error.ngc`, `tests/gcode/linuxcnc_oword_endrepeat_no_matching_repeat_error.ngc`, `tests/gcode/linuxcnc_oword_endif_no_matching_if_error.ngc`, `tests/gcode/linuxcnc_oword_endwhile_no_matching_while_error.ngc`, `tests/gcode/linuxcnc_oword_fanuc_requires_m99_error.ngc`, `tests/gcode/linuxcnc_oword_sub_requires_endsub_error.ngc`, `tests/gcode/linuxcnc_m98_missing_p_word_error.ngc`, `tests/gcode/linuxcnc_midline_m98_error.ngc`, `tests/gcode/linuxcnc_comment_prefixed_m98_error.ngc` | -| Parameter expressions and operators | covered for parameter references, native/source `mod`, `**`, logical, and relational operator precedence, plus LinuxCNC parameter-setting syntax, parameter index validation, named-parameter termination, real-number parsing, divide-by-zero, negative sqrt/power, infinity rejection, malformed and bare `ATAN[]/[]`, unary operation syntax including bare unary items, `read_operation_unary()` unknown-word branches, `read_operation()` binary-operation prefix, unknown operation, and unclosed-expression error paths from `interp_read.cc`/`interp_execute.cc` | `tests/gcode/linuxcnc_parameter_expression_assignment.ngc`, `tests/gcode/linuxcnc_parameter_missing_equal_error.ngc`, `tests/gcode/linuxcnc_midline_parameter_missing_equal_error.ngc`, `tests/gcode/linuxcnc_parameter_missing_value_error.ngc`, `tests/gcode/linuxcnc_parameter_number_out_of_range_error.ngc`, `tests/gcode/linuxcnc_parameter_reference_out_of_range_error.ngc`, `tests/gcode/linuxcnc_non_integer_parameter_index_error.ngc`, `tests/gcode/linuxcnc_named_parameter_not_terminated_error.ngc`, `tests/gcode/linuxcnc_no_real_value_error.ngc`, `tests/gcode/linuxcnc_bad_number_format_error.ngc`, `tests/gcode/linuxcnc_expression_operators.ngc`, `tests/gcode/linuxcnc_negative_sqrt_error.ngc`, `tests/gcode/linuxcnc_divide_by_zero_error.ngc`, `tests/gcode/linuxcnc_negative_power_error.ngc`, `tests/gcode/linuxcnc_infinite_expression_error.ngc`, `tests/gcode/linuxcnc_atan_missing_slash_error.ngc`, `tests/gcode/linuxcnc_atan_missing_bracket_error.ngc`, `tests/gcode/linuxcnc_top_level_bare_atan_error.ngc`, `tests/gcode/linuxcnc_midline_bare_atan_error.ngc`, `tests/gcode/linuxcnc_unary_missing_bracket_error.ngc`, `tests/gcode/linuxcnc_unary_unknown_word_error.ngc`, `tests/gcode/linuxcnc_unary_unknown_c_word_error.ngc`, `tests/gcode/linuxcnc_unary_unknown_e_word_error.ngc`, `tests/gcode/linuxcnc_unary_unknown_f_word_error.ngc`, `tests/gcode/linuxcnc_unary_unknown_l_word_error.ngc`, `tests/gcode/linuxcnc_unary_unknown_r_word_error.ngc`, `tests/gcode/linuxcnc_unary_unknown_s_word_error.ngc`, `tests/gcode/linuxcnc_unary_unknown_t_word_error.ngc`, `tests/gcode/linuxcnc_unary_unknown_default_word_error.ngc`, `tests/gcode/linuxcnc_top_level_bare_unary_error.ngc`, `tests/gcode/linuxcnc_midline_bare_unary_error.ngc`, `tests/gcode/linuxcnc_binary_unknown_a_operation_error.ngc`, `tests/gcode/linuxcnc_binary_unknown_e_operation_error.ngc`, `tests/gcode/linuxcnc_binary_unknown_g_operation_error.ngc`, `tests/gcode/linuxcnc_binary_unknown_l_operation_error.ngc`, `tests/gcode/linuxcnc_binary_unknown_m_operation_error.ngc`, `tests/gcode/linuxcnc_binary_unknown_n_operation_error.ngc`, `tests/gcode/linuxcnc_binary_unknown_o_operation_error.ngc`, `tests/gcode/linuxcnc_binary_unknown_x_operation_error.ngc`, `tests/gcode/linuxcnc_binary_unknown_operation_error.ngc`, `tests/gcode/linuxcnc_unclosed_expression_error.ngc` | +| Parameter expressions and operators | covered for parameter references, native/source bracketed word-value whitespace, `mod`, `**`, logical, and relational operator precedence, plus LinuxCNC parameter-setting syntax, parameter index validation, named-parameter termination, real-number parsing, divide-by-zero, negative sqrt/power, infinity rejection, malformed and bare `ATAN[]/[]`, unary operation syntax including bare unary items, `read_operation_unary()` unknown-word branches, `read_operation()` binary-operation prefix, unknown operation, and unclosed-expression error paths from `interp_read.cc`/`interp_execute.cc` | `tests/gcode/linuxcnc_parameter_expression_assignment.ngc`, `tests/gcode/linuxcnc_word_bracket_whitespace.ngc`, `tests/gcode/linuxcnc_parameter_missing_equal_error.ngc`, `tests/gcode/linuxcnc_midline_parameter_missing_equal_error.ngc`, `tests/gcode/linuxcnc_parameter_missing_value_error.ngc`, `tests/gcode/linuxcnc_parameter_number_out_of_range_error.ngc`, `tests/gcode/linuxcnc_parameter_reference_out_of_range_error.ngc`, `tests/gcode/linuxcnc_non_integer_parameter_index_error.ngc`, `tests/gcode/linuxcnc_named_parameter_not_terminated_error.ngc`, `tests/gcode/linuxcnc_no_real_value_error.ngc`, `tests/gcode/linuxcnc_bad_number_format_error.ngc`, `tests/gcode/linuxcnc_expression_operators.ngc`, `tests/gcode/linuxcnc_negative_sqrt_error.ngc`, `tests/gcode/linuxcnc_divide_by_zero_error.ngc`, `tests/gcode/linuxcnc_negative_power_error.ngc`, `tests/gcode/linuxcnc_infinite_expression_error.ngc`, `tests/gcode/linuxcnc_atan_missing_slash_error.ngc`, `tests/gcode/linuxcnc_atan_missing_bracket_error.ngc`, `tests/gcode/linuxcnc_top_level_bare_atan_error.ngc`, `tests/gcode/linuxcnc_midline_bare_atan_error.ngc`, `tests/gcode/linuxcnc_unary_missing_bracket_error.ngc`, `tests/gcode/linuxcnc_unary_unknown_word_error.ngc`, `tests/gcode/linuxcnc_unary_unknown_c_word_error.ngc`, `tests/gcode/linuxcnc_unary_unknown_e_word_error.ngc`, `tests/gcode/linuxcnc_unary_unknown_f_word_error.ngc`, `tests/gcode/linuxcnc_unary_unknown_l_word_error.ngc`, `tests/gcode/linuxcnc_unary_unknown_r_word_error.ngc`, `tests/gcode/linuxcnc_unary_unknown_s_word_error.ngc`, `tests/gcode/linuxcnc_unary_unknown_t_word_error.ngc`, `tests/gcode/linuxcnc_unary_unknown_default_word_error.ngc`, `tests/gcode/linuxcnc_top_level_bare_unary_error.ngc`, `tests/gcode/linuxcnc_midline_bare_unary_error.ngc`, `tests/gcode/linuxcnc_binary_unknown_a_operation_error.ngc`, `tests/gcode/linuxcnc_binary_unknown_e_operation_error.ngc`, `tests/gcode/linuxcnc_binary_unknown_g_operation_error.ngc`, `tests/gcode/linuxcnc_binary_unknown_l_operation_error.ngc`, `tests/gcode/linuxcnc_binary_unknown_m_operation_error.ngc`, `tests/gcode/linuxcnc_binary_unknown_n_operation_error.ngc`, `tests/gcode/linuxcnc_binary_unknown_o_operation_error.ngc`, `tests/gcode/linuxcnc_binary_unknown_x_operation_error.ngc`, `tests/gcode/linuxcnc_binary_unknown_operation_error.ngc`, `tests/gcode/linuxcnc_unclosed_expression_error.ngc` | | 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 `$`, 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, and too many M-codes from `interp_read.cc`, `interp_array.cc`, and `interp_check.cc`; source-linked coverage also checks malformed leading `N` numbers, EOF/program-end file checks, and overlong file lines | `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` | +| 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, and too many M-codes from `interp_read.cc`, `interp_array.cc`, and `interp_check.cc`; source-linked coverage also checks malformed leading `N` numbers, EOF/program-end file checks, and overlong file lines | `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 | | 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` | diff --git a/test-linuxcnc-rs274-native.sh b/test-linuxcnc-rs274-native.sh index ada42b3..4753f25 100755 --- a/test-linuxcnc-rs274-native.sh +++ b/test-linuxcnc-rs274-native.sh @@ -131,6 +131,11 @@ CNC_SIM_RS274_VAR="$var_file" "$build_dir/linuxcnc_rs274_dump" tests/gcode/basic # convert_distance_mode() updates G90/G91 state, and convert_arc() routes # R-format arcs through src/emc/rs274ngc/interp_find.cc arc-center math. CNC_SIM_RS274_VAR="$var_file" "$build_dir/linuxcnc_rs274_dump" tests/gcode/incremental_and_r_arc.ngc >"$output_dir/cnc_sim_linuxcnc_incremental_and_r_arc.json" +# Source basis: LinuxCNC src/emc/rs274ngc/interp_read.cc read_text() +# returns INTERP_EXECUTE_FINISH for slash-prefixed block-delete lines, and +# src/emc/rs274ngc/rs274ngc_pre.cc skips execution when block delete is on. +CNC_SIM_RS274_VAR="$var_file" "$build_dir/linuxcnc_rs274_dump" tests/gcode/linuxcnc_block_delete.ngc >"$output_dir/cnc_sim_linuxcnc_block_delete_off.json" +CNC_SIM_BLOCK_DELETE=1 CNC_SIM_RS274_VAR="$var_file" "$build_dir/linuxcnc_rs274_dump" tests/gcode/linuxcnc_block_delete.ngc >"$output_dir/cnc_sim_linuxcnc_block_delete_on.json" CNC_SIM_RS274_VAR="$var_file" "$build_dir/linuxcnc_rs274_dump" tests/gcode/linuxcnc_rtcp_controls.ngc >"$output_dir/cnc_sim_linuxcnc_rtcp_controls.json" CNC_SIM_RS274_VAR="$var_file" "$build_dir/linuxcnc_rs274_dump" tests/gcode/linuxcnc_spindle_direction.ngc >"$output_dir/cnc_sim_linuxcnc_spindle_direction.json" CNC_SIM_RS274_VAR="$var_file" "$build_dir/linuxcnc_rs274_dump" tests/gcode/linuxcnc_spindle_modes.ngc >"$output_dir/cnc_sim_linuxcnc_spindle_modes.json" @@ -521,6 +526,18 @@ CNC_SIM_RS274_VAR="$var_file" "$build_dir/linuxcnc_rs274_dump" tests/gcode/linux 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_arc_planes.ngc >"$output_dir/cnc_sim_linuxcnc_arc_planes.json" CNC_SIM_RS274_VAR="$var_file" "$build_dir/linuxcnc_rs274_dump" tests/gcode/linuxcnc_arc_distance_modes.ngc >"$output_dir/cnc_sim_linuxcnc_arc_distance_modes.json" +# Source basis: LinuxCNC src/emc/rs274ngc/interp_convert.cc convert_arc() +# passes unit-specific center-arc tolerance to src/emc/rs274ngc/interp_arc.cc +# arc_data_ijk(), which rejects excessive start/end radius mismatch. +CNC_SIM_RS274_FILE_MODE=1 CNC_SIM_RS274_VAR="$var_file" "$build_dir/linuxcnc_rs274_dump" tests/gcode/linuxcnc_arc_center_tolerance_good_imperial.ngc >"$output_dir/cnc_sim_linuxcnc_arc_center_tolerance_good_imperial.json" +if CNC_SIM_RS274_FILE_MODE=1 CNC_SIM_RS274_VAR="$var_file" \ + "$build_dir/linuxcnc_rs274_dump" tests/gcode/linuxcnc_arc_center_tolerance_bad_metric.ngc \ + >"$output_dir/cnc_sim_linuxcnc_arc_center_tolerance_bad_metric.json" 2>"$output_dir/cnc_sim_linuxcnc_arc_center_tolerance_bad_metric.err"; then + echo "expected linuxcnc_arc_center_tolerance_bad_metric.ngc to fail" >&2 + exit 1 +fi +grep -Fq "Radius to end of arc differs from radius to start" \ + "$output_dir/cnc_sim_linuxcnc_arc_center_tolerance_bad_metric.err" # Source basis: LinuxCNC src/emc/rs274ngc/interp_read.cc read_atsign() # and read_carat() parse @/^ polar words; src/emc/rs274ngc/interp_internal.cc # enhance_block() restricts polar coordinates to G17 motion without X/Y words; @@ -653,6 +670,9 @@ CNC_SIM_RS274_FILE_MODE=1 CNC_SIM_RS274_VAR="$var_file" "$build_dir/linuxcnc_rs2 CNC_SIM_RS274_FILE_MODE=1 CNC_SIM_RS274_VAR="$var_file" "$build_dir/linuxcnc_rs274_dump" tests/gcode/linuxcnc_indexed_parameters.ngc >"$output_dir/cnc_sim_linuxcnc_indexed_parameters.json" CNC_SIM_RS274_FILE_MODE=1 CNC_SIM_RS274_VAR="$var_file" "$build_dir/linuxcnc_rs274_dump" tests/gcode/linuxcnc_named_parameter_normalization.ngc >"$output_dir/cnc_sim_linuxcnc_named_parameter_normalization.json" INI_FILE_NAME="$ini_named_parameter_file" CNC_SIM_RS274_FILE_MODE=1 CNC_SIM_RS274_VAR="$var_file" "$build_dir/linuxcnc_rs274_dump" tests/gcode/linuxcnc_ini_named_parameter.ngc >"$output_dir/cnc_sim_linuxcnc_ini_named_parameter.json" +# Source basis: LinuxCNC src/emc/rs274ngc/interp_read.cc read_real_value() +# and close_and_downcase() accept whitespace around bracketed word values. +CNC_SIM_RS274_FILE_MODE=1 CNC_SIM_RS274_VAR="$var_file" "$build_dir/linuxcnc_rs274_dump" tests/gcode/linuxcnc_word_bracket_whitespace.ngc >"$output_dir/cnc_sim_linuxcnc_word_bracket_whitespace.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_dump" tests/gcode/linuxcnc_readonly_named_parameters.ngc >"$output_dir/cnc_sim_linuxcnc_readonly_named_parameters.json" @@ -847,6 +867,25 @@ 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"}) +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 + for event in block_delete_off +): + raise SystemExit("expected LinuxCNC disabled block-delete line to execute") + +block_delete_on = load("cnc_sim_linuxcnc_block_delete_on.json") +if any( + event["type"] == "linear-feed" and event["line"] == 2 and event["end"]["x"] == 5 + for event in block_delete_on +): + raise SystemExit("expected LinuxCNC block-delete line to be skipped") +if not any( + event["type"] == "linear-feed" and event["line"] == 3 and event["end"]["x"] == 2 + for event in block_delete_on +): + raise SystemExit("expected LinuxCNC block-delete followup line to execute") + controls = load("cnc_sim_linuxcnc_rtcp_controls.json") kin = [event for event in controls if event["type"] == "kinematics-switch"] if [event["reserved"] for event in kin] != [1, 0, 2]: @@ -1466,6 +1505,15 @@ expected_arc_centers = [(5, 5, 0), (7, 15, 0), (9, 25, 0)] if arc_centers != expected_arc_centers: raise SystemExit(f"unexpected G90.1/G91.1 arc centers: {arc_centers!r}") +arc_center_tolerance_good = load("cnc_sim_linuxcnc_arc_center_tolerance_good_imperial.json") +if not any( + event["type"] == "arc-feed" and + event["line"] == 4 and + event["end"]["x"] == 5 + for event in arc_center_tolerance_good +): + raise SystemExit("missing LinuxCNC small imperial center-format arc within tolerance") + incremental_r_arc = load("cnc_sim_linuxcnc_incremental_and_r_arc.json") if not any( event["type"] == "linear-feed" and @@ -1878,6 +1926,29 @@ expected_indexed_moves = [ if indexed_moves != expected_indexed_moves: raise SystemExit(f"unexpected LinuxCNC indexed/indirect parameter motions: {indexed_moves!r}") +word_bracket_whitespace = load("cnc_sim_linuxcnc_word_bracket_whitespace.json") +if not any( + event["type"] == "linear-feed" and + event["line"] == 3 and + event["end"]["x"] == 3 + for event in word_bracket_whitespace +): + raise SystemExit("missing LinuxCNC spaced bracket word X motion") +if not any( + event["type"] == "linear-feed" and + event["line"] == 4 and + event["end"]["y"] == 3 + for event in word_bracket_whitespace +): + raise SystemExit("missing LinuxCNC plus-spaced bracket word Y motion") +if not any( + event["type"] == "linear-feed" and + event["line"] == 5 and + event["end"]["x"] == -3 + for event in word_bracket_whitespace +): + raise SystemExit("missing LinuxCNC minus-spaced bracket word X motion") + normalized = load("cnc_sim_linuxcnc_named_parameter_normalization.json") normalized_moves = [ (event["line"], event["end"]["x"], event["end"]["y"]) @@ -2265,6 +2336,8 @@ echo "linuxcnc rs274 native smoke passed" echo "dumped $output_dir/cnc_sim_linuxcnc_basic_motion.json" echo "dumped $output_dir/cnc_sim_linuxcnc_basic_mill.json" echo "dumped $output_dir/cnc_sim_linuxcnc_incremental_and_r_arc.json" +echo "dumped $output_dir/cnc_sim_linuxcnc_block_delete_off.json" +echo "dumped $output_dir/cnc_sim_linuxcnc_block_delete_on.json" echo "dumped $output_dir/cnc_sim_linuxcnc_rtcp_controls.json" echo "dumped $output_dir/cnc_sim_linuxcnc_spindle_direction.json" echo "dumped $output_dir/cnc_sim_linuxcnc_spindle_modes.json" @@ -2289,6 +2362,7 @@ echo "dumped $output_dir/cnc_sim_linuxcnc_canned_cycles_extended.json" echo "dumped $output_dir/cnc_sim_linuxcnc_canned_cycle_planes.json" echo "dumped $output_dir/cnc_sim_linuxcnc_arc_planes.json" echo "dumped $output_dir/cnc_sim_linuxcnc_arc_distance_modes.json" +echo "dumped $output_dir/cnc_sim_linuxcnc_arc_center_tolerance_good_imperial.json" echo "dumped $output_dir/cnc_sim_linuxcnc_predefined_positions.json" echo "dumped $output_dir/cnc_sim_linuxcnc_machine_coordinates.json" echo "dumped $output_dir/cnc_sim_linuxcnc_cutter_comp.json" @@ -2305,6 +2379,7 @@ echo "dumped $output_dir/cnc_sim_linuxcnc_lowercase_numeric_oword.json" echo "dumped $output_dir/cnc_sim_linuxcnc_m98_mixed_styles_variables.json" echo "dumped $output_dir/cnc_sim_linuxcnc_named_parameter_exists.json" echo "dumped $output_dir/cnc_sim_linuxcnc_indexed_parameters.json" +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"