按推荐建议,继续执行

结论:新增 source-probes.tsv 映射并在 native 验证中比对 source-manifest,确保每个 vendored LinuxCNC .c/.cc 源文件都有显式 standalone 源码编译探针。
This commit is contained in:
2026-06-07 18:28:35 +08:00
parent 1729e4a5c9
commit e776020b08
3 changed files with 59 additions and 0 deletions

View File

@@ -483,6 +483,11 @@ Current verified progress:
existing INI parser harness. With this probe, every `.c` and `.cc` file
listed in `tools/source-manifest.txt` has a native source-level compile
check under the standalone build boundary.
- `tools/build_native_probes.sh` now emits `build/native/source-probes.tsv`
while compiling vendored `*_source_probe` targets. The native verification
script compares that map against every `.c` and `.cc` entry in
`tools/source-manifest.txt`, so future LinuxCNC source additions fail
validation unless they also get an explicit standalone source compile probe.
## Phase 4: Port INI Parsing Without Editing Upstream

View File

@@ -12,6 +12,46 @@ NAMEDPARAM_INI_FIXTURE="$ROOT_DIR/tests/fixtures/ini/namedparams.ini"
"$ROOT_DIR/tools/verify_vendor_sync.sh"
"$ROOT_DIR/tools/build_native_probes.sh"
check_source_probe_coverage() {
local manifest_sources="$BUILD_DIR/source-manifest-sources.sorted"
local probe_sources="$BUILD_DIR/source-probe-sources.sorted"
local duplicate_probe_sources="$BUILD_DIR/source-probe-sources.duplicates"
awk '
/^[[:space:]]*($|#)/ { next }
/\.(c|cc)$/ { print }
' "$ROOT_DIR/tools/source-manifest.txt" | sort > "$manifest_sources"
if [[ ! -f "$BUILD_DIR/source-probes.tsv" ]]; then
echo "missing source probe map: $BUILD_DIR/source-probes.tsv" >&2
exit 1
fi
cut -f1 "$BUILD_DIR/source-probes.tsv" | sort > "$probe_sources"
uniq -d "$probe_sources" > "$duplicate_probe_sources"
if [[ -s "$duplicate_probe_sources" ]]; then
echo "duplicate source probe entries:" >&2
cat "$duplicate_probe_sources" >&2
exit 1
fi
local missing_sources
missing_sources="$(comm -23 "$manifest_sources" "$probe_sources")"
if [[ -n "$missing_sources" ]]; then
echo "manifest source files without source probes:" >&2
printf '%s\n' "$missing_sources" >&2
exit 1
fi
local extra_sources
extra_sources="$(comm -13 "$manifest_sources" "$probe_sources")"
if [[ -n "$extra_sources" ]]; then
echo "source probes not listed in manifest:" >&2
printf '%s\n' "$extra_sources" >&2
exit 1
fi
}
check_exitcode() {
local name="$1"
local file="$BUILD_DIR/$name.exitcode"
@@ -32,6 +72,7 @@ check_exitcode() {
fi
}
check_source_probe_coverage
check_exitcode linuxcnc_interp_state_probe
check_exitcode linuxcnc_inifile_source_probe
check_exitcode linuxcnc_tp_api_probe

View File

@@ -7,12 +7,14 @@ BUILD_DIR="$ROOT_DIR/build/native"
WRAP_DIR="$ROOT_DIR/runtime/core/linuxcnc_wrap"
SHIM_DIR="$ROOT_DIR/runtime/core/shims"
INCLUDE_DIR="$ROOT_DIR/runtime/core/include"
SOURCE_PROBE_MAP="$BUILD_DIR/source-probes.tsv"
MINIMAL_GCODE_FIXTURE="$ROOT_DIR/tests/fixtures/gcode/minimal_linear.ngc"
NAMEDPARAM_INI_FIXTURE="$ROOT_DIR/tests/fixtures/ini/namedparams.ini"
CXX="${CXX:-g++}"
CC="${CC:-gcc}"
mkdir -p "$BUILD_DIR"
: > "$SOURCE_PROBE_MAP"
COMMON_FLAGS=(
-std=c++20
@@ -179,6 +181,15 @@ compile_c_object() {
return 1
}
record_source_probe() {
local target="$1"
local source="$2"
[[ "$target" == *_source_probe ]] || return 0
[[ "$source" == "$VENDOR_DIR/"* ]] || return 0
printf '%s\t%s\n' "${source#"$VENDOR_DIR"/}" "$target" >> "$SOURCE_PROBE_MAP"
}
link_needs_rebuild() {
local output="$1"
local cmdfile="$2"
@@ -293,6 +304,7 @@ build_object_target() {
status=1
fi
record_source_probe "$target" "$source"
echo "$status" > "$BUILD_DIR/$target.exitcode"
return "$status"
}
@@ -314,6 +326,7 @@ build_c_object_target() {
status=1
fi
record_source_probe "$target" "$source"
echo "$status" > "$BUILD_DIR/$target.exitcode"
return "$status"
}