参考所有分组:补 percent 文件 source 覆盖,测试通过

This commit is contained in:
cnc
2026-06-03 08:56:30 +08:00
parent 090a5fb89c
commit 9bf9206869
3 changed files with 27 additions and 0 deletions

View File

@@ -564,6 +564,7 @@ grep -F 'read_n_number()' test-linuxcnc-source-link.sh >/dev/null
grep -F 'tests/gcode/linuxcnc_fractional_linenumbers.ngc' test-linuxcnc-source-link.sh >/dev/null grep -F 'tests/gcode/linuxcnc_fractional_linenumbers.ngc' test-linuxcnc-source-link.sh >/dev/null
grep -F 'tests/gcode/linuxcnc_extended_linenumbers.ngc' test-linuxcnc-source-link.sh >/dev/null grep -F 'tests/gcode/linuxcnc_extended_linenumbers.ngc' test-linuxcnc-source-link.sh >/dev/null
grep -F 'tests/gcode/linuxcnc_close_and_downcase_words.ngc' test-linuxcnc-source-link.sh >/dev/null grep -F 'tests/gcode/linuxcnc_close_and_downcase_words.ngc' test-linuxcnc-source-link.sh >/dev/null
grep -F 'tests/gcode/linuxcnc_percent_file_ignores_trailing.ngc' test-linuxcnc-source-link.sh >/dev/null
for script in \ for script in \
test-native.sh \ test-native.sh \

View File

@@ -1501,6 +1501,13 @@ CNC_SIM_RS274_VAR="$var_file" \
CNC_SIM_RS274_VAR="$var_file" \ CNC_SIM_RS274_VAR="$var_file" \
"$build_dir/linuxcnc_rs274_source_dump" tests/gcode/linuxcnc_close_and_downcase_words.ngc \ "$build_dir/linuxcnc_rs274_source_dump" tests/gcode/linuxcnc_close_and_downcase_words.ngc \
>"$output_dir/cnc_sim_linuxcnc_source_close_and_downcase_words.json" >"$output_dir/cnc_sim_linuxcnc_source_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_source_dump" tests/gcode/linuxcnc_percent_file_ignores_trailing.ngc \
>"$output_dir/cnc_sim_linuxcnc_source_percent_file_ignores_trailing.json"
CNC_SIM_RS274_SOURCE_OUTPUT_DIR="$output_dir" python3 - <<'PY' CNC_SIM_RS274_SOURCE_OUTPUT_DIR="$output_dir" python3 - <<'PY'
import json import json
@@ -1572,6 +1579,18 @@ if not any(
): ):
raise SystemExit("missing source-linked close_and_downcase mixed-case spaced-word move") raise SystemExit("missing source-linked close_and_downcase mixed-case spaced-word move")
percent_file = load("cnc_sim_linuxcnc_source_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 source-linked percent-file feed sequence: "
f"{percent_file_feeds!r}"
)
block_delete_off = load("cnc_sim_linuxcnc_source_block_delete_off.json") block_delete_off = load("cnc_sim_linuxcnc_source_block_delete_off.json")
if not any( if not any(
event["type"] == "linear-feed" and event["line"] == 2 and event["end"]["x"] == 5 event["type"] == "linear-feed" and event["line"] == 2 and event["end"]["x"] == 5
@@ -3461,3 +3480,4 @@ echo "dumped $output_dir/cnc_sim_linuxcnc_source_g62_xz_nurbs.json"
echo "dumped $output_dir/cnc_sim_linuxcnc_source_fractional_linenumbers.json" echo "dumped $output_dir/cnc_sim_linuxcnc_source_fractional_linenumbers.json"
echo "dumped $output_dir/cnc_sim_linuxcnc_source_extended_linenumbers.json" echo "dumped $output_dir/cnc_sim_linuxcnc_source_extended_linenumbers.json"
echo "dumped $output_dir/cnc_sim_linuxcnc_source_close_and_downcase_words.json" echo "dumped $output_dir/cnc_sim_linuxcnc_source_close_and_downcase_words.json"
echo "dumped $output_dir/cnc_sim_linuxcnc_source_percent_file_ignores_trailing.json"

View File

@@ -0,0 +1,6 @@
%
G21 G90
F100
G1 X1
%
G1 X99