参考所有分组,完成尽量多的内容。禁止顺手扩功能 smoke

结论:按 align-linuxcnc 约束让 switchkins/remap 生成器读取 LinuxCNC INI [EMCIO] TOOL_TABLE,仅用于校验 linuxcnc-kinematics-source-files.txt 的 tooldata 源覆盖;不把 TOOL_TABLE 输出为新 API case,不扩展 smoke 行为。

源依据:../linuxcnc/configs/sim 下 M428/M429/M430 switchkins INI 的 [EMCIO] TOOL_TABLE 条目,以及现有 kinematics manifest 的 tooldata 条目。

验证:./check-linuxcnc-switchkins-remap-table.sh linuxcnc-kinematics-source-files.txt 通过;./test-native.sh 通过;./test-linuxcnc-source-link.sh 通过。
This commit is contained in:
cnc
2026-06-03 13:36:25 +08:00
parent 0d4e248811
commit 7d28d0a025
2 changed files with 118 additions and 0 deletions

View File

@@ -100,6 +100,8 @@ read_ini_switchkins_config() {
print "halfile\t" value
} else if (section == "hal" && key == "postgui_halfile") {
print "postgui_halfile\t" value
} else if (section == "emcio" && key == "tool_table") {
print "tool_table\t" value
} else if (section == "rs274ngc" && key == "subroutine_path") {
print "subroutine_path\t" value
} else if (section == "rs274ngc" && key == "remap") {
@@ -152,8 +154,11 @@ declare -A manifest_config_sources=()
declare -A used_config_sources=()
declare -A manifest_remap_sources=()
declare -A used_remap_sources=()
declare -A manifest_tooldata_sources=()
declare -A used_tooldata_sources=()
manifest_config_count=0
manifest_remap_count=0
manifest_tooldata_count=0
validate_manifest_source_path() {
local group=$1
@@ -208,6 +213,19 @@ while IFS=: read -r manifest_group manifest_path _manifest_note; do
manifest_remap_sources[$manifest_path]=1
manifest_remap_count=$((manifest_remap_count + 1))
;;
tooldata)
validate_manifest_source_path "$manifest_group" "$manifest_path"
if [[ "$manifest_path" != *.tbl ]]; then
echo "LinuxCNC switchkins tooldata source must be a tbl file in $manifest: $manifest_path" >&2
exit 1
fi
if [[ -n "${manifest_tooldata_sources[$manifest_path]:-}" ]]; then
echo "duplicate LinuxCNC switchkins tooldata source in $manifest: $manifest_path" >&2
exit 1
fi
manifest_tooldata_sources[$manifest_path]=1
manifest_tooldata_count=$((manifest_tooldata_count + 1))
;;
esac
done <"$manifest"
@@ -283,6 +301,27 @@ config_source_for_halfile() {
resolved_config_source=$resolved_linuxcnc_path
}
resolved_tooldata_source=
tooldata_source_for_tool_table() {
local config=$1
local tool_table=$2
resolved_tooldata_source=
[[ -n "$tool_table" ]] || return 1
local tool_path=${tool_table%%[[:space:]]*}
[[ -n "$tool_path" ]] || return 1
local config_dir
config_dir_for "$config"
config_dir=$resolved_config_dir
local resolved
resolve_config_path "$config_dir" "$tool_path"
resolved=$resolved_config_path
[[ -f "$resolved" ]] || return 1
relative_linuxcnc_path "$resolved"
resolved_tooldata_source=$resolved_linuxcnc_path
}
resolved_kinstype=
declare -A kinstype_cache=()
kinstype_for_remap_source() {
@@ -353,6 +392,16 @@ record_config_source() {
used_config_sources[$source]=1
}
record_tooldata_source() {
local config_path=$1
local source=$2
if [[ -z "${manifest_tooldata_sources[$source]:-}" ]]; then
echo "LinuxCNC TOOL_TABLE source is not listed as tooldata in $manifest: $source ($config_path)" >&2
exit 1
fi
used_tooldata_sources[$source]=1
}
declare -A seen_aliases=()
declare -A seen_cases=()
declare -A seen_case_values=()
@@ -363,6 +412,7 @@ processed_config_count=0
resolved_remap_count=0
unique_config_source_count=0
unique_resolved_remap_count=0
unique_tooldata_source_count=0
add_alias() {
local alias=$1
@@ -612,6 +662,7 @@ while IFS=: read -r group path _note; do
kinematics=
halfiles=
postgui_halfiles=
tool_tables=
subroutine_paths=
remap_ngc_428=
remap_ngc_429=
@@ -630,6 +681,9 @@ while IFS=: read -r group path _note; do
postgui_halfile)
postgui_halfiles+="${postgui_halfiles:+$'\n'}$ini_value"
;;
tool_table)
tool_tables+="${tool_tables:+$'\n'}$ini_value"
;;
subroutine_path)
subroutine_paths+="${subroutine_paths:+$'\n'}$ini_value"
;;
@@ -740,6 +794,11 @@ while IFS=: read -r group path _note; do
add_postgui_halfile_cases "$halfile" "$m428" "$m429" "$m430"
add_halfile_aliases "$halfile" "$m428" "$m429" "$m430"
done <<<"$postgui_halfiles"
while IFS= read -r tool_table; do
if tooldata_source_for_tool_table "$config" "$tool_table"; then
record_tooldata_source "$path" "$resolved_tooldata_source"
fi
done <<<"$tool_tables"
for remap_source in "$remap_source_428" "$remap_source_429" "$remap_source_430"; do
if [[ -n "$remap_source" ]]; then
@@ -761,6 +820,7 @@ done <"$manifest"
unique_config_source_count=${#used_config_sources[@]}
unique_resolved_remap_count=${#used_remap_sources[@]}
unique_tooldata_source_count=${#used_tooldata_sources[@]}
validate_generated_content() {
if ((manifest_config_count == 0)); then
@@ -787,6 +847,10 @@ validate_generated_content() {
echo "no unique LinuxCNC config sources used from manifest: $manifest" >&2
exit 1
fi
if ((manifest_tooldata_count > 0 && unique_tooldata_source_count == 0)); then
echo "no unique LinuxCNC TOOL_TABLE sources used from manifest: $manifest" >&2
exit 1
fi
if ((unique_config_source_count != manifest_config_count)); then
echo "LinuxCNC config manifest coverage mismatch: used $unique_config_source_count of $manifest_config_count config sources" >&2
local config_source
@@ -797,6 +861,16 @@ validate_generated_content() {
done
exit 1
fi
if ((unique_tooldata_source_count != manifest_tooldata_count)); then
echo "LinuxCNC tooldata manifest coverage mismatch: used $unique_tooldata_source_count of $manifest_tooldata_count tooldata sources" >&2
local tooldata_source
for tooldata_source in "${!manifest_tooldata_sources[@]}"; do
if [[ -z "${used_tooldata_sources[$tooldata_source]:-}" ]]; then
echo "unused LinuxCNC tooldata manifest source: $tooldata_source" >&2
fi
done
exit 1
fi
if ((unique_resolved_remap_count != manifest_remap_count)); then
echo "LinuxCNC remap manifest coverage mismatch: resolved $unique_resolved_remap_count of $manifest_remap_count remap sources" >&2
local remap_source