继续按 align-linuxcnc 约束:补 word reader 源码错误覆盖
结论:覆盖 LinuxCNC interp_read.cc 中负数 F/G/H/L/M/S/T 和重复 F/H/L/S/T/X/Y/Z word reader 错误;未扩展 smoke。 验证:./test-linuxcnc-source-link.sh;./test-native.sh。
This commit is contained in:
@@ -213,5 +213,6 @@ This matrix tracks LinuxCNC feature coverage for the web/WASM simulator. A featu
|
|||||||
| 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` |
|
| 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 subroutines, calls, and control flow | covered for numeric and named `O... sub/call/return/endsub` plus `if`/`elseif`/`else`, `while`, `repeat`, `do`/`while`, `break`, and `continue` through LinuxCNC file mode; smoke parser also covers named `O<name>` sub/call/return/endsub and loop-control forms | `tests/gcode/smoke_oword_subprogram.ngc`, `tests/gcode/linuxcnc_named_oword_subprogram.ngc`, `tests/gcode/linuxcnc_oword_control_flow.ngc` |
|
| O-word subroutines, calls, and control flow | covered for numeric and named `O... sub/call/return/endsub` plus `if`/`elseif`/`else`, `while`, `repeat`, `do`/`while`, `break`, and `continue` through LinuxCNC file mode; smoke parser also covers named `O<name>` sub/call/return/endsub and loop-control forms | `tests/gcode/smoke_oword_subprogram.ngc`, `tests/gcode/linuxcnc_named_oword_subprogram.ngc`, `tests/gcode/linuxcnc_oword_control_flow.ngc` |
|
||||||
| Parameter expressions and operators | covered for parameter references, source-linked `mod`, `**`, logical, and relational operator precedence, plus LinuxCNC divide-by-zero, negative-power, malformed `ATAN[]/[]`, unary operation, `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_expression_operators.ngc`, `tests/gcode/linuxcnc_divide_by_zero_error.ngc`, `tests/gcode/linuxcnc_negative_power_error.ngc`, `tests/gcode/linuxcnc_atan_missing_slash_error.ngc`, `tests/gcode/linuxcnc_atan_missing_bracket_error.ngc`, `tests/gcode/linuxcnc_unary_missing_bracket_error.ngc`, `tests/gcode/linuxcnc_unary_unknown_word_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, source-linked `mod`, `**`, logical, and relational operator precedence, plus LinuxCNC divide-by-zero, negative-power, malformed `ATAN[]/[]`, unary operation, `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_expression_operators.ngc`, `tests/gcode/linuxcnc_divide_by_zero_error.ngc`, `tests/gcode/linuxcnc_negative_power_error.ngc`, `tests/gcode/linuxcnc_atan_missing_slash_error.ngc`, `tests/gcode/linuxcnc_atan_missing_bracket_error.ngc`, `tests/gcode/linuxcnc_unary_missing_bracket_error.ngc`, `tests/gcode/linuxcnc_unary_unknown_word_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 | source-linked LinuxCNC reader errors covered for negative `F/G/H/L/M/S/T` values and repeated `F/H/L/S/T/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_f_words_error.ngc`, `tests/gcode/linuxcnc_multiple_h_words_error.ngc`, `tests/gcode/linuxcnc_multiple_l_words_error.ngc`, `tests/gcode/linuxcnc_multiple_s_words_error.ngc`, `tests/gcode/linuxcnc_multiple_t_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` |
|
||||||
| 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` | 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` |
|
| 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` |
|
||||||
|
|||||||
@@ -654,6 +654,53 @@ for case in "${binary_operation_error_cases[@]}"; do
|
|||||||
fi
|
fi
|
||||||
grep -q "$expected" "$output_dir/cnc_sim_linuxcnc_source_$fixture.err"
|
grep -q "$expected" "$output_dir/cnc_sim_linuxcnc_source_$fixture.err"
|
||||||
done
|
done
|
||||||
|
# Source basis: LinuxCNC src/emc/rs274ngc/interp_read.cc
|
||||||
|
# read_f()/read_g()/read_h()/read_l()/read_m()/read_s()/read_t()
|
||||||
|
# reject negative word values before command execution.
|
||||||
|
negative_word_error_cases=(
|
||||||
|
"linuxcnc_negative_f_word_error|Negative f word used"
|
||||||
|
"linuxcnc_negative_g_code_error|Negative g code used"
|
||||||
|
"linuxcnc_negative_h_word_error|Negative h word used"
|
||||||
|
"linuxcnc_negative_l_word_error|Negative l word used"
|
||||||
|
"linuxcnc_negative_m_code_error|Negative m code used"
|
||||||
|
"linuxcnc_negative_s_word_error|Negative spindle speed used"
|
||||||
|
"linuxcnc_negative_t_word_error|Negative tool id (tool not found)"
|
||||||
|
)
|
||||||
|
for case in "${negative_word_error_cases[@]}"; do
|
||||||
|
fixture=${case%%|*}
|
||||||
|
expected=${case#*|}
|
||||||
|
if CNC_SIM_RS274_FILE_MODE=1 CNC_SIM_RS274_VAR="$var_file" \
|
||||||
|
"$build_dir/linuxcnc_rs274_source_dump" "tests/gcode/$fixture.ngc" \
|
||||||
|
>"$output_dir/cnc_sim_linuxcnc_source_$fixture.json" 2>"$output_dir/cnc_sim_linuxcnc_source_$fixture.err"; then
|
||||||
|
echo "expected $fixture.ngc to fail" >&2
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
grep -q "$expected" "$output_dir/cnc_sim_linuxcnc_source_$fixture.err"
|
||||||
|
done
|
||||||
|
# Source basis: LinuxCNC src/emc/rs274ngc/interp_read.cc
|
||||||
|
# the word-specific reader functions reject repeated words while
|
||||||
|
# filling a single block.
|
||||||
|
multiple_word_error_cases=(
|
||||||
|
"linuxcnc_multiple_f_words_error|Multiple f words on one line"
|
||||||
|
"linuxcnc_multiple_h_words_error|Multiple h words on one line"
|
||||||
|
"linuxcnc_multiple_l_words_error|Multiple l words on one line"
|
||||||
|
"linuxcnc_multiple_s_words_error|Multiple s words on one line"
|
||||||
|
"linuxcnc_multiple_t_words_error|Multiple t words on one line"
|
||||||
|
"linuxcnc_multiple_x_words_error|Multiple x words on one line"
|
||||||
|
"linuxcnc_multiple_y_words_error|Multiple y words on one line"
|
||||||
|
"linuxcnc_multiple_z_words_error|Multiple z words on one line"
|
||||||
|
)
|
||||||
|
for case in "${multiple_word_error_cases[@]}"; do
|
||||||
|
fixture=${case%%|*}
|
||||||
|
expected=${case#*|}
|
||||||
|
if CNC_SIM_RS274_FILE_MODE=1 CNC_SIM_RS274_VAR="$var_file" \
|
||||||
|
"$build_dir/linuxcnc_rs274_source_dump" "tests/gcode/$fixture.ngc" \
|
||||||
|
>"$output_dir/cnc_sim_linuxcnc_source_$fixture.json" 2>"$output_dir/cnc_sim_linuxcnc_source_$fixture.err"; then
|
||||||
|
echo "expected $fixture.ngc to fail" >&2
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
grep -q "$expected" "$output_dir/cnc_sim_linuxcnc_source_$fixture.err"
|
||||||
|
done
|
||||||
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_value_returned.ngc \
|
"$build_dir/linuxcnc_rs274_source_dump" tests/gcode/linuxcnc_value_returned.ngc \
|
||||||
>"$output_dir/cnc_sim_linuxcnc_source_value_returned.json"
|
>"$output_dir/cnc_sim_linuxcnc_source_value_returned.json"
|
||||||
|
|||||||
1
tests/gcode/linuxcnc_multiple_f_words_error.ngc
Normal file
1
tests/gcode/linuxcnc_multiple_f_words_error.ngc
Normal file
@@ -0,0 +1 @@
|
|||||||
|
F1 F2
|
||||||
1
tests/gcode/linuxcnc_multiple_h_words_error.ngc
Normal file
1
tests/gcode/linuxcnc_multiple_h_words_error.ngc
Normal file
@@ -0,0 +1 @@
|
|||||||
|
H1 H2
|
||||||
1
tests/gcode/linuxcnc_multiple_l_words_error.ngc
Normal file
1
tests/gcode/linuxcnc_multiple_l_words_error.ngc
Normal file
@@ -0,0 +1 @@
|
|||||||
|
L1 L2
|
||||||
1
tests/gcode/linuxcnc_multiple_s_words_error.ngc
Normal file
1
tests/gcode/linuxcnc_multiple_s_words_error.ngc
Normal file
@@ -0,0 +1 @@
|
|||||||
|
S100 S200
|
||||||
1
tests/gcode/linuxcnc_multiple_t_words_error.ngc
Normal file
1
tests/gcode/linuxcnc_multiple_t_words_error.ngc
Normal file
@@ -0,0 +1 @@
|
|||||||
|
T1 T2
|
||||||
1
tests/gcode/linuxcnc_multiple_x_words_error.ngc
Normal file
1
tests/gcode/linuxcnc_multiple_x_words_error.ngc
Normal file
@@ -0,0 +1 @@
|
|||||||
|
G1 X1 X2 F100
|
||||||
1
tests/gcode/linuxcnc_multiple_y_words_error.ngc
Normal file
1
tests/gcode/linuxcnc_multiple_y_words_error.ngc
Normal file
@@ -0,0 +1 @@
|
|||||||
|
G1 Y1 Y2 F100
|
||||||
1
tests/gcode/linuxcnc_multiple_z_words_error.ngc
Normal file
1
tests/gcode/linuxcnc_multiple_z_words_error.ngc
Normal file
@@ -0,0 +1 @@
|
|||||||
|
G1 Z1 Z2 F100
|
||||||
1
tests/gcode/linuxcnc_negative_f_word_error.ngc
Normal file
1
tests/gcode/linuxcnc_negative_f_word_error.ngc
Normal file
@@ -0,0 +1 @@
|
|||||||
|
F-1
|
||||||
1
tests/gcode/linuxcnc_negative_g_code_error.ngc
Normal file
1
tests/gcode/linuxcnc_negative_g_code_error.ngc
Normal file
@@ -0,0 +1 @@
|
|||||||
|
G-1
|
||||||
1
tests/gcode/linuxcnc_negative_h_word_error.ngc
Normal file
1
tests/gcode/linuxcnc_negative_h_word_error.ngc
Normal file
@@ -0,0 +1 @@
|
|||||||
|
H-2
|
||||||
1
tests/gcode/linuxcnc_negative_l_word_error.ngc
Normal file
1
tests/gcode/linuxcnc_negative_l_word_error.ngc
Normal file
@@ -0,0 +1 @@
|
|||||||
|
L-1
|
||||||
1
tests/gcode/linuxcnc_negative_m_code_error.ngc
Normal file
1
tests/gcode/linuxcnc_negative_m_code_error.ngc
Normal file
@@ -0,0 +1 @@
|
|||||||
|
M-1
|
||||||
1
tests/gcode/linuxcnc_negative_s_word_error.ngc
Normal file
1
tests/gcode/linuxcnc_negative_s_word_error.ngc
Normal file
@@ -0,0 +1 @@
|
|||||||
|
S-1
|
||||||
1
tests/gcode/linuxcnc_negative_t_word_error.ngc
Normal file
1
tests/gcode/linuxcnc_negative_t_word_error.ngc
Normal file
@@ -0,0 +1 @@
|
|||||||
|
T-1
|
||||||
Reference in New Issue
Block a user