高效率推进 LinuxCNC 源码对齐流程

说明:集中 LinuxCNC 源码清单与 wasm/native probe 的路径解析,补强 manifest、shim、source-link 检查,并保持 LinuxCNC 源码后端对齐验证流程可复用。

验证:./test-native.sh;./test-linuxcnc-source-link.sh;./test-all-native.sh;wasm source/probe 相关脚本。
This commit is contained in:
cnc
2026-05-27 11:14:06 +08:00
parent ce2f3f3769
commit 40a63c76f7
44 changed files with 3566 additions and 475 deletions

View File

@@ -40,67 +40,37 @@ common_flags=(
)
linuxcnc_sources=()
while IFS=: read -r group path note; do
case "$group" in
core)
if [[ ! -f "$linuxcnc_root/$path" ]]; then
echo "missing manifest file: $path" >&2
exit 1
fi
linuxcnc_sources+=("$path")
;;
""|\#*|binding|tooldata)
;;
*)
echo "unknown manifest group: $group" >&2
exit 1
;;
esac
done < "$manifest"
source_list="$build_dir/linuxcnc_core_sources.txt"
LINUXCNC_ROOT="$linuxcnc_root" ./list-linuxcnc-source-manifest-sources.sh "$manifest" core full > "$source_list"
mapfile -t linuxcnc_sources < "$source_list"
objects=()
linuxcnc_index=0
for source in "${linuxcnc_sources[@]}"; do
obj="$build_dir/linuxcnc_${linuxcnc_index}.o"
"$cxx" "${common_flags[@]}" -c "$linuxcnc_root/$source" -o "$obj"
"$cxx" "${common_flags[@]}" -c "$source" -o "$obj"
objects+=("$obj")
linuxcnc_index=$((linuxcnc_index + 1))
done
project_index=0
for source in \
core/src/canon_event_sink.cpp \
core/src/linuxcnc_canon_bridge.cpp \
core/src/linuxcnc_tooldata_fixture.cpp \
core/src/rtcp_kinematics.cpp \
core/src/simulator_gcode_controls.cpp \
core/tools/linuxcnc_rs274_dump.cpp; do
project_source_list="$build_dir/linuxcnc_rs274_dump_project_sources.txt"
./list-linuxcnc-rs274-dump-project-sources.sh > "$project_source_list"
mapfile -t project_sources < "$project_source_list"
for source in "${project_sources[@]}"; do
obj="$build_dir/project_${project_index}.o"
"$cxx" "${common_flags[@]}" -c "$source" -o "$obj"
objects+=("$obj")
project_index=$((project_index + 1))
done
support_objects=(
"$linuxcnc_root/src/objects/emc/rs274ngc/interpmodule.o"
"$linuxcnc_root/src/objects/emc/rs274ngc/canonmodule.o"
"$linuxcnc_root/src/objects/emc/rs274ngc/pyarrays.o"
"$linuxcnc_root/src/objects/emc/rs274ngc/pyblock.o"
"$linuxcnc_root/src/objects/emc/rs274ngc/pyemctypes.o"
"$linuxcnc_root/src/objects/emc/rs274ngc/pyinterp1.o"
"$linuxcnc_root/src/objects/emc/rs274ngc/pyparamclass.o"
"$linuxcnc_root/src/objects/emc/nml_intf/emcops.o"
"$linuxcnc_root/src/objects/emc/sai/dummyemcstat.o"
"$linuxcnc_root/src/objects/libnml/nml/stat_msg.o"
)
"$cxx" -std=c++17 -I core/include -I core/src \
core/tests/linuxcnc_gees_table_smoke.cpp \
-o "$build_dir/linuxcnc_gees_table_smoke"
for obj in "${support_objects[@]}"; do
if [[ ! -f "$obj" ]]; then
echo "missing LinuxCNC support object: $obj" >&2
echo "build LinuxCNC first or set LINUXCNC_ROOT to a built tree" >&2
exit 1
fi
done
support_object_list="$build_dir/linuxcnc_support_objects.txt"
LINUXCNC_ROOT="$linuxcnc_root" ./list-linuxcnc-source-support-objects.sh > "$support_object_list"
mapfile -t support_objects < "$support_object_list"
"$cxx" "${objects[@]}" "${support_objects[@]}" \
-L "$linuxcnc_root/lib" \
@@ -126,6 +96,8 @@ mkdir -p "$output_dir"
cp "$linuxcnc_root/tests/halui/jogging/sim.var" "$base_var_file"
cp "$base_var_file" "$var_file"
LINUXCNC_ROOT="$linuxcnc_root" "$build_dir/linuxcnc_gees_table_smoke"
CNC_SIM_RS274_VAR="$var_file" \
"$build_dir/linuxcnc_rs274_source_dump" tests/gcode/basic_mill.ngc \
>"$output_dir/cnc_sim_linuxcnc_source_basic_mill.json"
@@ -543,6 +515,38 @@ if CNC_SIM_RS274_FILE_MODE=1 CNC_SIM_RS274_VAR="$var_file" \
echo "expected linuxcnc_canned_cycle_reject_rotary_followup.ngc to fail" >&2
exit 1
fi
if CNC_SIM_RS274_FILE_MODE=1 CNC_SIM_RS274_VAR="$var_file" \
"$build_dir/linuxcnc_rs274_source_dump" tests/gcode/linuxcnc_cutter_comp_tool_change_error.ngc \
>"$output_dir/cnc_sim_linuxcnc_source_cutter_comp_tool_change_error.json" 2>"$output_dir/cnc_sim_linuxcnc_source_cutter_comp_tool_change_error.err"; then
echo "expected linuxcnc_cutter_comp_tool_change_error.ngc to fail" >&2
exit 1
fi
grep -q "Cannot change tools with cutter radius compensation on" \
"$output_dir/cnc_sim_linuxcnc_source_cutter_comp_tool_change_error.err"
if CNC_SIM_RS274_FILE_MODE=1 CNC_SIM_RS274_VAR="$var_file" \
"$build_dir/linuxcnc_rs274_source_dump" tests/gcode/linuxcnc_cutter_comp_wait_input_error.ngc \
>"$output_dir/cnc_sim_linuxcnc_source_cutter_comp_wait_input_error.json" 2>"$output_dir/cnc_sim_linuxcnc_source_cutter_comp_wait_input_error.err"; then
echo "expected linuxcnc_cutter_comp_wait_input_error.ngc to fail" >&2
exit 1
fi
grep -q "Cannot wait for digital input with cutter radius compensation on" \
"$output_dir/cnc_sim_linuxcnc_source_cutter_comp_wait_input_error.err"
if CNC_SIM_RS274_FILE_MODE=1 CNC_SIM_RS274_VAR="$var_file" \
"$build_dir/linuxcnc_rs274_source_dump" tests/gcode/linuxcnc_cutter_comp_g71_error.ngc \
>"$output_dir/cnc_sim_linuxcnc_source_cutter_comp_g71_error.json" 2>"$output_dir/cnc_sim_linuxcnc_source_cutter_comp_g71_error.err"; then
echo "expected linuxcnc_cutter_comp_g71_error.ngc to fail" >&2
exit 1
fi
grep -q "G71.0 cannot be used with cutter compensation enabled" \
"$output_dir/cnc_sim_linuxcnc_source_cutter_comp_g71_error.err"
if CNC_SIM_RS274_FILE_MODE=1 CNC_SIM_RS274_VAR="$var_file" \
"$build_dir/linuxcnc_rs274_source_dump" tests/gcode/linuxcnc_canned_cycle_g98_retract_error.ngc \
>"$output_dir/cnc_sim_linuxcnc_source_canned_cycle_g98_retract_error.json" 2>"$output_dir/cnc_sim_linuxcnc_source_canned_cycle_g98_retract_error.err"; then
echo "expected linuxcnc_canned_cycle_g98_retract_error.ngc to fail" >&2
exit 1
fi
grep -q "Cannot change retract mode with cutter radius compensation on" \
"$output_dir/cnc_sim_linuxcnc_source_canned_cycle_g98_retract_error.err"
if CNC_SIM_RS274_FILE_MODE=1 CNC_SIM_RS274_VAR="$var_file" \
"$build_dir/linuxcnc_rs274_source_dump" tests/gcode/linuxcnc_nested_subroutine_definition_error.ngc \
>"$output_dir/cnc_sim_linuxcnc_source_nested_subroutine_definition_error.json" 2>"$output_dir/cnc_sim_linuxcnc_source_nested_subroutine_definition_error.err"; then
@@ -555,6 +559,8 @@ if CNC_SIM_RS274_FILE_MODE=1 CNC_SIM_RS274_VAR="$var_file" \
echo "expected linuxcnc_ccomp_arcexit_error.ngc to fail" >&2
exit 1
fi
grep -q "The move just after exiting cutter compensation mode must be straight, not an arc" \
"$output_dir/cnc_sim_linuxcnc_source_ccomp_arcexit_error.err"
if CNC_SIM_RS274_FILE_MODE=1 CNC_SIM_RS274_VAR="$var_file" \
"$build_dir/linuxcnc_rs274_source_dump" tests/gcode/linuxcnc_abort_hot_comment.ngc \
>"$output_dir/cnc_sim_linuxcnc_source_abort_hot_comment.json" 2>"$output_dir/cnc_sim_linuxcnc_source_abort_hot_comment.err"; then
@@ -567,6 +573,8 @@ if CNC_SIM_RS274_FILE_MODE=1 CNC_SIM_RS274_VAR="$var_file" \
echo "expected linuxcnc_ccomp_gouging_error.ngc to fail" >&2
exit 1
fi
grep -q "Straight feed in concave corner cannot be reached by the tool without gouging" \
"$output_dir/cnc_sim_linuxcnc_source_ccomp_gouging_error.err"
cp "$base_var_file" "$var_file"
CNC_SIM_RS274_FILE_MODE=1 CNC_SIM_RS274_VAR="$var_file" \
"$build_dir/linuxcnc_rs274_source_dump" tests/gcode/linuxcnc_numbered_parameters.ngc \