继续按 align-linuxcnc 约束:补增强块轴值错误源码覆盖,测试通过
This commit is contained in:
@@ -576,6 +576,29 @@ for case in "${polar_coordinate_error_cases[@]}"; do
|
||||
fi
|
||||
grep -Fq "$expected" "$output_dir/cnc_sim_linuxcnc_source_$fixture.err"
|
||||
done
|
||||
# Source basis: LinuxCNC src/emc/rs274ngc/interp_internal.cc
|
||||
# enhance_block() assigns motion_to_be and rejects invalid axis use with G80,
|
||||
# missing axes for G52/G92 or motion codes, bare axis words without active
|
||||
# motion, and modal-0 G codes that consume axis values on a motion block.
|
||||
enhance_block_error_cases=(
|
||||
"linuxcnc_g80_axis_error|Cannot use axis values with g80"
|
||||
"linuxcnc_g52_missing_axis_error|All axes missing with g52 or g92"
|
||||
"linuxcnc_g92_missing_axis_error|All axes missing with g52 or g92"
|
||||
"linuxcnc_motion_missing_axis_error|All axes missing with motion code"
|
||||
"linuxcnc_axis_without_motion_error|Cannot use axis values without a g code that uses them"
|
||||
"linuxcnc_motion_with_g92_axis_error|Cannot use two g codes that both use axis values"
|
||||
)
|
||||
for case in "${enhance_block_error_cases[@]}"; do
|
||||
fixture=${case%%|*}
|
||||
expected=${case#*|}
|
||||
if 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 -Fq "$expected" "$output_dir/cnc_sim_linuxcnc_source_$fixture.err"
|
||||
done
|
||||
CNC_SIM_RS274_VAR="$var_file" \
|
||||
"$build_dir/linuxcnc_rs274_source_dump" tests/gcode/linuxcnc_predefined_positions.ngc \
|
||||
>"$output_dir/cnc_sim_linuxcnc_source_predefined_positions.json"
|
||||
|
||||
@@ -147,6 +147,8 @@ grep -F 'tests/gcode/linuxcnc_lathe_diameter_g76.ngc' docs/linuxcnc-porting.md >
|
||||
grep -F 'missing source-linked G7 diameter-mode G76 final threading pass' test-linuxcnc-source-link.sh >/dev/null
|
||||
grep -F 'read_atsign()' test-linuxcnc-source-link.sh >/dev/null
|
||||
grep -F 'tests/gcode/linuxcnc_polar_coordinates.ngc' test-linuxcnc-source-link.sh >/dev/null
|
||||
grep -F 'enhance_block() assigns motion_to_be' test-linuxcnc-source-link.sh >/dev/null
|
||||
grep -F 'linuxcnc_g80_axis_error|Cannot use axis values with g80' test-linuxcnc-source-link.sh >/dev/null
|
||||
grep -F 'lookup_named_param()' test-linuxcnc-rs274-native.sh >/dev/null
|
||||
grep -F 'tests/gcode/linuxcnc_readonly_named_parameters.ngc' docs/linuxcnc-porting.md >/dev/null
|
||||
grep -F 'rs274ngc_pre.cc ini_load() consumes INI_FILE_NAME' test-web-wasm-node-smoke.cjs >/dev/null
|
||||
|
||||
3
tests/gcode/linuxcnc_axis_without_motion_error.ngc
Normal file
3
tests/gcode/linuxcnc_axis_without_motion_error.ngc
Normal file
@@ -0,0 +1,3 @@
|
||||
G21 G90 G17
|
||||
X1
|
||||
M30
|
||||
3
tests/gcode/linuxcnc_g52_missing_axis_error.ngc
Normal file
3
tests/gcode/linuxcnc_g52_missing_axis_error.ngc
Normal file
@@ -0,0 +1,3 @@
|
||||
G21 G90 G17
|
||||
G52
|
||||
M30
|
||||
3
tests/gcode/linuxcnc_g80_axis_error.ngc
Normal file
3
tests/gcode/linuxcnc_g80_axis_error.ngc
Normal file
@@ -0,0 +1,3 @@
|
||||
G21 G90 G17
|
||||
G80 X1
|
||||
M30
|
||||
3
tests/gcode/linuxcnc_g92_missing_axis_error.ngc
Normal file
3
tests/gcode/linuxcnc_g92_missing_axis_error.ngc
Normal file
@@ -0,0 +1,3 @@
|
||||
G21 G90 G17
|
||||
G92
|
||||
M30
|
||||
3
tests/gcode/linuxcnc_motion_missing_axis_error.ngc
Normal file
3
tests/gcode/linuxcnc_motion_missing_axis_error.ngc
Normal file
@@ -0,0 +1,3 @@
|
||||
G21 G90 G17
|
||||
G81 F100
|
||||
M30
|
||||
3
tests/gcode/linuxcnc_motion_with_g92_axis_error.ngc
Normal file
3
tests/gcode/linuxcnc_motion_with_g92_axis_error.ngc
Normal file
@@ -0,0 +1,3 @@
|
||||
G21 G90 G17
|
||||
G1 G92 X1 F100
|
||||
M30
|
||||
Reference in New Issue
Block a user